www/js/prod_edit.js

Wed, 23 Oct 2019 14:20:50 +0200

author
Michiel Broek <mbroek@mbse.eu>
date
Wed, 23 Oct 2019 14:20:50 +0200
branch
divide
changeset 533
be8691b7d634
parent 525
8bbc5730aaa8
child 542
dabe1c854a0f
permissions
-rw-r--r--

Added the product divide scripts. All parts have all the volumes and weights divided, including the master record. Splitted batches have their own records with the product code formatted as code-n. From this design, we can rebuild the print and checklist.

111
8c4ba91adf58 Basic screens for brew products.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1 /*****************************************************************************
164
0a5abea575a9 Added the last tab, fermentation to the product editer.
Michiel Broek <mbroek@mbse.eu>
parents: 163
diff changeset
2 * Copyright (C) 2018-2019
111
8c4ba91adf58 Basic screens for brew products.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
3 *
8c4ba91adf58 Basic screens for brew products.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
4 * Michiel Broek <mbroek at mbse dot eu>
8c4ba91adf58 Basic screens for brew products.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
5 *
8c4ba91adf58 Basic screens for brew products.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
6 * This file is part of BMS
8c4ba91adf58 Basic screens for brew products.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
7 *
8c4ba91adf58 Basic screens for brew products.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
8 * This is free software; you can redistribute it and/or modify it
8c4ba91adf58 Basic screens for brew products.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
9 * under the terms of the GNU General Public License as published by the
8c4ba91adf58 Basic screens for brew products.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
10 * Free Software Foundation; either version 2, or (at your option) any
8c4ba91adf58 Basic screens for brew products.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
11 * later version.
8c4ba91adf58 Basic screens for brew products.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
12 *
8c4ba91adf58 Basic screens for brew products.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
13 * BrewCloud is distributed in the hope that it will be useful, but
8c4ba91adf58 Basic screens for brew products.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
14 * WITHOUT ANY WARRANTY; without even the implied warranty of
8c4ba91adf58 Basic screens for brew products.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
8c4ba91adf58 Basic screens for brew products.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
16 * General Public License for more details.
8c4ba91adf58 Basic screens for brew products.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
17 *
8c4ba91adf58 Basic screens for brew products.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
18 * You should have received a copy of the GNU General Public License
8c4ba91adf58 Basic screens for brew products.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
19 * along with ThermFerm; see the file COPYING. If not, write to the Free
8c4ba91adf58 Basic screens for brew products.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
20 * Software Foundation, 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
8c4ba91adf58 Basic screens for brew products.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
21 *****************************************************************************/
8c4ba91adf58 Basic screens for brew products.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
22
8c4ba91adf58 Basic screens for brew products.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
23
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
24 function createDelElements() {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
25
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
26 $('#eventWindow').jqxWindow({
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
27 theme: theme,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
28 position: { x: 490, y: 210 },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
29 width: 300,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
30 height: 175,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
31 resizable: false,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
32 isModal: true,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
33 modalOpacity: 0.4,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
34 okButton: $('#delOk'),
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
35 cancelButton: $('#delCancel'),
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
36 initContent: function() {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
37 $('#delOk').jqxButton({ template: 'danger', width: '65px', theme: theme });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
38 $('#delCancel').jqxButton({ template: 'success', width: '65px', theme: theme });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
39 $('#delCancel').focus();
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
40 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
41 });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
42 $('#eventWindow').jqxWindow('hide');
112
7ef48396f705 Added some buttons. Only allow product delete if it has no serious data.
Michiel Broek <mbroek@mbse.eu>
parents: 111
diff changeset
43 }
7ef48396f705 Added some buttons. Only allow product delete if it has no serious data.
Michiel Broek <mbroek@mbse.eu>
parents: 111
diff changeset
44
7ef48396f705 Added some buttons. Only allow product delete if it has no serious data.
Michiel Broek <mbroek@mbse.eu>
parents: 111
diff changeset
45
7ef48396f705 Added some buttons. Only allow product delete if it has no serious data.
Michiel Broek <mbroek@mbse.eu>
parents: 111
diff changeset
46
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
47 $(document).ready(function() {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
48
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
49 var i,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
50 to_100 = false, // Fermentables adjust to 100%
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
51 preboil_sg = 0,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
52 aboil_sg = 0,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
53 est_mash_sg = 0,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
54 psugar = 0, // Percentage real sugars
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
55 pcara = 0, // Percentage cara/crystal malts
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
56 svg = 77, // Default attenuation
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
57 mashkg = 0, // Malt in mash weight
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
58 pitchrate = 0.75, // Yeast pitch rate default
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
59 initcells = 0, // Initial yeast cell count
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
60
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
61 ok_fermentables = 1, // Fermentables are in stock
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
62 ok_hops = 1, // Hops are in stock
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
63 ok_miscs = 1, // Miscs are in stock
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
64 ok_yeasts = 1, // Yeasts are in stock
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
65 ok_waters = 1, // Waters are in stock
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
66
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
67 hop_flavour = 0,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
68 hop_aroma = 0,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
69 mash_infuse = 0,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
70 last_base = '',
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
71 last_acid = '',
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
72
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
73 MMCa = 40.048,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
74 MMMg = 24.305,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
75 MMNa = 22.98976928,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
76 MMCl = 35.453,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
77 MMSO4 = 96.0626,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
78 MMHCO3 = 61.01684,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
79 MMCaSO4 = 172.171,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
80 MMCaCl2 = 147.015,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
81 MMCaCO3 = 100.087,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
82 MMMgSO4 = 246.475,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
83 MMNaHCO3 = 84.007,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
84 MMNa2CO3 = 105.996,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
85 MMNaCl = 58.443,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
86 MMCaOH2 = 74.06268,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
87
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
88 fermentableRow = 0,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
89 fermentableData = {},
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
90 fermentableInit = 1,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
91 hopRow = 0,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
92 hopData = {},
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
93 miscRow = 0,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
94 miscData = {},
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
95 yeastRow = 0,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
96 yeastData = {},
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
97 mashRow = 0,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
98 mashData = {},
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
99 Ka1 = 0.0000004445,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
100 Ka2 = 0.0000000000468,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
101 dataRecord = {},
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
102 url = 'includes/db_product.php',
484
2083c274b283 In the product editor mash tab, display the total mash volume and the total mash time.
Michiel Broek <mbroek@mbse.eu>
parents: 479
diff changeset
103 MaltVolume = 0.87, // l/kg 0.688 volgens internetbronnen, gemeten 0.874 l/kg, na enige tijd maischen 0,715 l/kg (A3 Otten).
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
104
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
105 // Prepare the data
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
106 source = {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
107 datatype: 'json',
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
108 cache: false,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
109 datafields: [
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
110 // From prod_main
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
111 { name: 'record', type: 'number' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
112 { name: 'uuid', type: 'string' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
113 { name: 'name', type: 'string' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
114 { name: 'code', type: 'string' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
115 { name: 'birth', type: 'string' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
116 { name: 'stage', type: 'int' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
117 { name: 'notes', type: 'string' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
118 { name: 'log_brew', type: 'int' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
119 { name: 'log_fermentation', type: 'int' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
120 { name: 'inventory_reduced', type: 'int' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
121 { name: 'locked', type: 'int' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
122 { name: 'eq_name', type: 'string' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
123 { name: 'eq_boil_size', type: 'float' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
124 { name: 'eq_batch_size', type: 'float' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
125 { name: 'eq_tun_volume', type: 'float' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
126 { name: 'eq_tun_weight', type: 'float' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
127 { name: 'eq_tun_specific_heat', type: 'float' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
128 { name: 'eq_tun_material', type: 'int' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
129 { name: 'eq_tun_height', type: 'float' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
130 { name: 'eq_top_up_water', type: 'float' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
131 { name: 'eq_trub_chiller_loss', type: 'float' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
132 { name: 'eq_evap_rate', type: 'float' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
133 { name: 'eq_boil_time', type: 'float' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
134 { name: 'eq_calc_boil_volume', type: 'int' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
135 { name: 'eq_top_up_kettle', type: 'float' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
136 { name: 'eq_hop_utilization', type: 'float' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
137 { name: 'eq_notes', type: 'string' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
138 { name: 'eq_lauter_volume', type: 'float' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
139 { name: 'eq_lauter_height', type: 'float' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
140 { name: 'eq_lauter_deadspace', type: 'float' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
141 { name: 'eq_kettle_volume', type: 'float' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
142 { name: 'eq_kettle_height', type: 'float' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
143 { name: 'eq_mash_volume', type: 'float' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
144 { name: 'eq_mash_max', type: 'float' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
145 { name: 'eq_efficiency', type: 'float' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
146 { name: 'brew_date_start', type: 'string' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
147 { name: 'brew_mash_ph', type: 'float' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
148 { name: 'brew_mash_sg', type: 'float' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
149 { name: 'brew_mash_efficiency', type: 'float' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
150 { name: 'brew_sparge_est', type: 'float' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
151 { name: 'brew_sparge_ph', type: 'float' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
152 { name: 'brew_preboil_volume', type: 'float' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
153 { name: 'brew_preboil_sg', type: 'float' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
154 { name: 'brew_preboil_ph', type: 'float' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
155 { name: 'brew_preboil_efficiency', type: 'float' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
156 { name: 'brew_aboil_volume', type: 'float' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
157 { name: 'brew_aboil_sg', type: 'float' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
158 { name: 'brew_aboil_ph', type: 'float' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
159 { name: 'brew_aboil_efficiency', type: 'float' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
160 { name: 'brew_cooling_method', type: 'int' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
161 { name: 'brew_cooling_time', type: 'float' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
162 { name: 'brew_cooling_to', type: 'float' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
163 { name: 'brew_whirlpool9', type: 'float' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
164 { name: 'brew_whirlpool7', type: 'float' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
165 { name: 'brew_whirlpool6', type: 'float' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
166 { name: 'brew_whirlpool2', type: 'float' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
167 { name: 'brew_fermenter_volume', type: 'float' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
168 { name: 'brew_fermenter_extrawater', type: 'float' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
169 { name: 'brew_fermenter_tcloss', type: 'float' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
170 { name: 'brew_aeration_time', type: 'float' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
171 { name: 'brew_aeration_speed', type: 'float' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
172 { name: 'brew_aeration_type', type: 'int' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
173 { name: 'brew_fermenter_sg', type: 'float' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
174 { name: 'brew_fermenter_ibu', type: 'float' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
175 { name: 'brew_fermenter_color', type: 'float' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
176 { name: 'brew_date_end', type: 'string' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
177 { name: 'og', type: 'float' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
178 { name: 'fg', type: 'float' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
179 { name: 'primary_start_temp', type: 'float' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
180 { name: 'primary_max_temp', type: 'float' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
181 { name: 'primary_end_temp', type: 'float' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
182 { name: 'primary_end_sg', type: 'float' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
183 { name: 'primary_end_date', type: 'string' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
184 { name: 'secondary_temp', type: 'float' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
185 { name: 'secondary_end_sg', type: 'float' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
186 { name: 'secondary_end_date', type: 'string' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
187 { name: 'tertiary_temp', type: 'float' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
188 { name: 'package_date', type: 'string' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
189 { name: 'package_volume', type: 'float' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
190 { name: 'package_infuse_amount', type: 'float' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
191 { name: 'package_infuse_abv', type: 'float' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
192 { name: 'package_infuse_notes', type: 'string' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
193 { name: 'package_abv', type: 'float' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
194 { name: 'package_ph', type: 'float' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
195 { name: 'bottle_amount', type: 'float' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
196 { name: 'bottle_carbonation', type: 'float' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
197 { name: 'bottle_priming_water', type: 'float' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
198 { name: 'bottle_priming_amount', type: 'float' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
199 { name: 'bottle_carbonation_temp', type: 'float' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
200 { name: 'keg_amount', type: 'float' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
201 { name: 'keg_carbonation', type: 'float' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
202 { name: 'keg_priming_water', type: 'float' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
203 { name: 'keg_priming_amount', type: 'float' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
204 { name: 'keg_carbonation_temp', type: 'float' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
205 { name: 'keg_forced_carb', type: 'int' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
206 { name: 'keg_pressure', type: 'float' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
207 { name: 'taste_notes', type: 'string' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
208 { name: 'taste_rate', type: 'float' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
209 { name: 'taste_date', type: 'string' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
210 { name: 'taste_color', type: 'string' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
211 { name: 'taste_transparency', type: 'string' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
212 { name: 'taste_head', type: 'string' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
213 { name: 'taste_aroma', type: 'string' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
214 { name: 'taste_taste', type: 'string' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
215 { name: 'taste_mouthfeel', type: 'string' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
216 { name: 'taste_aftertaste', type: 'string' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
217 { name: 'st_name', type: 'string' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
218 { name: 'st_letter', type: 'string' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
219 { name: 'st_guide', type: 'string' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
220 { name: 'st_category', type: 'string' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
221 { name: 'st_category_number', type: 'float' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
222 { name: 'st_type', type: 'int' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
223 { name: 'st_og_min', type: 'float' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
224 { name: 'st_og_max', type: 'float' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
225 { name: 'st_fg_min', type: 'float' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
226 { name: 'st_fg_max', type: 'float' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
227 { name: 'st_ibu_min', type: 'float' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
228 { name: 'st_ibu_max', type: 'float' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
229 { name: 'st_color_min', type: 'float' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
230 { name: 'st_color_max', type: 'float' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
231 { name: 'st_carb_min', type: 'float' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
232 { name: 'st_carb_max', type: 'float' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
233 { name: 'st_abv_min', type: 'float' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
234 { name: 'st_abv_max', type: 'float' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
235 { name: 'type', type: 'int' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
236 { name: 'batch_size', type: 'float' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
237 { name: 'boil_size', type: 'float' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
238 { name: 'boil_time', type: 'float' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
239 { name: 'efficiency', type: 'float' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
240 { name: 'est_og', type: 'float' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
241 { name: 'est_fg', type: 'float' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
242 { name: 'est_abv', type: 'float' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
243 { name: 'est_color', type: 'float' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
244 { name: 'color_method', type: 'int' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
245 { name: 'est_ibu', type: 'float' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
246 { name: 'ibu_method', type: 'int' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
247 { name: 'est_carb', type: 'float' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
248 { name: 'sparge_temp', type: 'float' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
249 { name: 'sparge_ph', type: 'float' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
250 { name: 'sparge_volume', type: 'float' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
251 { name: 'sparge_source', type: 'int' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
252 { name: 'sparge_acid_type', type: 'int' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
253 { name: 'sparge_acid_perc', type: 'float' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
254 { name: 'sparge_acid_amount', type: 'float' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
255 { name: 'mash_ph', type: 'float' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
256 { name: 'mash_name', type: 'string' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
257 { name: 'calc_acid', type: 'int' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
258 { name: 'w1_name', type: 'string' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
259 { name: 'w1_amount', type: 'float' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
260 { name: 'w1_calcium', type: 'float' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
261 { name: 'w1_sulfate', type: 'float' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
262 { name: 'w1_chloride', type: 'float' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
263 { name: 'w1_sodium', type: 'float' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
264 { name: 'w1_magnesium', type: 'float' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
265 { name: 'w1_total_alkalinity', type: 'float' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
266 { name: 'w1_ph', type: 'float' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
267 { name: 'w1_cost', type: 'float' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
268 { name: 'w2_name', type: 'string' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
269 { name: 'w2_amount', type: 'float' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
270 { name: 'w2_calcium', type: 'float' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
271 { name: 'w2_sulfate', type: 'float' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
272 { name: 'w2_chloride', type: 'float' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
273 { name: 'w2_sodium', type: 'float' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
274 { name: 'w2_magnesium', type: 'float' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
275 { name: 'w2_total_alkalinity', type: 'float' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
276 { name: 'w2_ph', type: 'float' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
277 { name: 'w2_cost', type: 'float' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
278 { name: 'wg_amount', type: 'float' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
279 { name: 'wg_calcium', type: 'float' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
280 { name: 'wg_sulfate', type: 'float' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
281 { name: 'wg_chloride', type: 'float' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
282 { name: 'wg_sodium', type: 'float' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
283 { name: 'wg_magnesium', type: 'float' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
284 { name: 'wg_total_alkalinity', type: 'float' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
285 { name: 'wg_ph', type: 'float' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
286 { name: 'wb_calcium', type: 'float' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
287 { name: 'wb_sulfate', type: 'float' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
288 { name: 'wb_chloride', type: 'float' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
289 { name: 'wb_sodium', type: 'float' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
290 { name: 'wb_magnesium', type: 'float' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
291 { name: 'wb_total_alkalinity', type: 'float' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
292 { name: 'wb_ph', type: 'float' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
293 { name: 'wa_acid_name', type: 'int' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
294 { name: 'wa_acid_perc', type: 'int' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
295 { name: 'wa_base_name', type: 'int' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
296 { name: 'starter_enable', type: 'int' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
297 { name: 'starter_type', type: 'int' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
298 { name: 'starter_sg', type: 'float' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
299 { name: 'starter_viability', type: 'int' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
300 { name: 'prop1_type', type: 'int' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
301 { name: 'prop1_volume', type: 'float' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
302 { name: 'prop2_type', type: 'int' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
303 { name: 'prop2_volume', type: 'float' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
304 { name: 'prop3_type', type: 'int' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
305 { name: 'prop3_volume', type: 'float' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
306 { name: 'prop4_type', type: 'int' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
307 { name: 'prop4_volume', type: 'float' },
497
0fe366d953ab Prepare screens for product divide batch.
Michiel Broek <mbroek@mbse.eu>
parents: 495
diff changeset
308 { name: 'divide_type', type: 'int' },
0fe366d953ab Prepare screens for product divide batch.
Michiel Broek <mbroek@mbse.eu>
parents: 495
diff changeset
309 { name: 'divide_size', type: 'float' },
533
be8691b7d634 Added the product divide scripts. All parts have all the volumes and weights divided, including the master record. Splitted batches have their own records with the product code formatted as code-n. From this design, we can rebuild the print and checklist.
Michiel Broek <mbroek@mbse.eu>
parents: 525
diff changeset
310 { name: 'divide_factor', type: 'float' },
497
0fe366d953ab Prepare screens for product divide batch.
Michiel Broek <mbroek@mbse.eu>
parents: 495
diff changeset
311 { name: 'divide_parts', type: 'int' },
533
be8691b7d634 Added the product divide scripts. All parts have all the volumes and weights divided, including the master record. Splitted batches have their own records with the product code formatted as code-n. From this design, we can rebuild the print and checklist.
Michiel Broek <mbroek@mbse.eu>
parents: 525
diff changeset
312 { name: 'divide_part', type: 'int' },
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
313 { name: 'fermentables', type: 'array' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
314 { name: 'hops', type: 'array' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
315 { name: 'miscs', type: 'array' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
316 { name: 'yeasts', type: 'array' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
317 { name: 'mashs', type: 'array' }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
318 ],
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
319 id: 'record',
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
320 url: url + '?record=' + my_record
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
321 },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
322
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
323 // Load data and select one record.
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
324 dataAdapter = new $.jqx.dataAdapter(source, {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
325 loadComplete: function() {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
326 var records = dataAdapter.records;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
327 dataRecord = records[0];
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
328 // Hidden record uuid
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
329 $('#name').val(dataRecord.name);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
330 $('#code').val(dataRecord.code);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
331 $('#birth').val(dataRecord.birth);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
332 $('#stage').val(StageData[dataRecord.stage].nl);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
333 $('#notes').val(dataRecord.notes);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
334 $('#locked').val(dataRecord.locked);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
335 $('#eq_name').val(dataRecord.eq_name);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
336 $('#eq_notes').val(dataRecord.eq_notes);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
337 $('#eq_boil_size').val(dataRecord.eq_boil_size);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
338 $('#eq_batch_size').val(dataRecord.eq_batch_size);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
339 $('#eq_tun_volume').val(dataRecord.eq_tun_volume);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
340 $('#eq_top_up_water').val(dataRecord.eq_top_up_water);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
341 $('#eq_trub_chiller_loss').val(dataRecord.eq_trub_chiller_loss);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
342 $('#eq_evap_rate').val(dataRecord.eq_evap_rate);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
343 $('#eq_boil_time').val(dataRecord.eq_boil_time);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
344 $('#eq_top_up_kettle').val(dataRecord.eq_top_up_kettle);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
345 $('#eq_hop_utilization').val(dataRecord.eq_hop_utilization);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
346 $('#eq_lauter_volume').val(dataRecord.eq_lauter_volume);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
347 $('#eq_lauter_deadspace').val(dataRecord.eq_lauter_deadspace);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
348 $('#eq_kettle_volume').val(dataRecord.eq_kettle_volume);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
349 $('#eq_mash_volume').val(dataRecord.eq_mash_volume);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
350 $('#eq_mash_max').val(dataRecord.eq_mash_max);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
351 $('#eq_efficiency').val(dataRecord.eq_efficiency);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
352 // Brewdate
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
353 $('#brew_date_start').val(dataRecord.brew_date_start);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
354 $('#brew_mash_ph').val(dataRecord.brew_mash_ph);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
355 $('#brew_mash_sg').val(dataRecord.brew_mash_sg);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
356 $('#brew_mash_efficiency').val(dataRecord.brew_mash_efficiency);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
357 // Header Spoelen en filteren
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
358 $('#brew_sparge_temperature').val(dataRecord.sparge_temp);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
359 $('#brew_sparge_volume').val(dataRecord.sparge_volume);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
360 $('#brew_sparge_est').val(dataRecord.brew_sparge_est);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
361 $('#brew_sparge_ph').val(dataRecord.brew_sparge_ph);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
362 // Header Beluchten
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
363 $('#brew_aeration_type').val(dataRecord.brew_aeration_type);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
364 $('#brew_aeration_time').val(dataRecord.brew_aeration_time);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
365 $('#brew_aeration_speed').val(dataRecord.brew_aeration_speed);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
366
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
367 $('#brew_preboil_ph').val(dataRecord.brew_preboil_ph);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
368 $('#brew_preboil_sg').val(dataRecord.brew_preboil_sg);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
369 $('#brew_preboil_volume').val(dataRecord.brew_preboil_volume);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
370 $('#brew_preboil_efficiency').val(dataRecord.brew_preboil_efficiency);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
371 // Header Koelen en whirlpoolen
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
372 $('#brew_whirlpool9').val(dataRecord.brew_whirlpool9);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
373 $('#brew_whirlpool7').val(dataRecord.brew_whirlpool7);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
374 $('#brew_whirlpool6').val(dataRecord.brew_whirlpool6);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
375 $('#brew_whirlpool2').val(dataRecord.brew_whirlpool2);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
376 // Header Naar gistvat
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
377 $('#brew_fermenter_volume').val(dataRecord.brew_fermenter_volume);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
378 $('#brew_fermenter_sg').val(dataRecord.brew_fermenter_sg);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
379 $('#brew_fermenter_sg2').val(dataRecord.brew_fermenter_sg);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
380 $('#brew_fermenter_ibu').val(dataRecord.brew_fermenter_ibu);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
381 $('#brew_fermenter_color').val(dataRecord.brew_fermenter_color);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
382 $('#brew_fermenter_extrawater').val(dataRecord.brew_fermenter_extrawater);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
383 $('#brew_fermenter_tcloss').val(dataRecord.brew_fermenter_tcloss);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
384
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
385 $('#brew_aboil_ph').val(dataRecord.brew_aboil_ph);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
386 $('#brew_aboil_sg').val(dataRecord.brew_aboil_sg);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
387 $('#brew_aboil_volume').val(dataRecord.brew_aboil_volume);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
388 $('#brew_aboil_efficiency').val(dataRecord.brew_aboil_efficiency);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
389 // Header Koelen en whirlpoolen
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
390 $('#brew_cooling_to').val(dataRecord.brew_cooling_to);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
391 $('#brew_cooling_method').val(dataRecord.brew_cooling_method);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
392 $('#brew_cooling_time').val(dataRecord.brew_cooling_time);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
393 // Niks
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
394 $('#brew_date_end').val(dataRecord.brew_date_end);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
395 $('#og').val(dataRecord.og);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
396 $('#fg').val(dataRecord.fg);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
397 $('#primary_start_temp').val(dataRecord.primary_start_temp);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
398 $('#primary_max_temp').val(dataRecord.primary_max_temp);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
399 $('#primary_end_temp').val(dataRecord.primary_end_temp);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
400 $('#primary_end_sg').val(dataRecord.primary_end_sg);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
401 $('#primary_end_date').val(dataRecord.primary_end_date);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
402 $('#secondary_temp').val(dataRecord.secondary_temp);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
403 $('#secondary_end_sg').val(dataRecord.secondary_end_sg);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
404 $('#secondary_end_date').val(dataRecord.secondary_end_date);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
405 $('#tertiary_temp').val(dataRecord.tertiary_temp);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
406 $('#package_date').val(dataRecord.package_date);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
407 $('#package_volume').val(dataRecord.package_volume);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
408 $('#package_infuse_amount').val(dataRecord.package_infuse_amount);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
409 $('#package_infuse_abv').val(dataRecord.package_infuse_abv);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
410 $('#package_infuse_notes').val(dataRecord.package_infuse_notes);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
411 $('#package_abv').val(dataRecord.package_abv);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
412 $('#package_ph').val(dataRecord.package_ph);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
413 $('#bottle_amount').val(dataRecord.bottle_amount);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
414 $('#bottle_carbonation').val(dataRecord.bottle_carbonation);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
415 $('#bottle_priming_water').val(dataRecord.bottle_priming_water);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
416 $('#bottle_priming_amount').val(dataRecord.bottle_priming_amount);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
417 $('#bottle_carbonation_temp').val(dataRecord.bottle_carbonation_temp);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
418 $('#keg_amount').val(dataRecord.keg_amount);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
419 $('#keg_carbonation').val(dataRecord.keg_carbonation);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
420 $('#keg_priming_water').val(dataRecord.keg_priming_water);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
421 $('#keg_priming_amount').val(dataRecord.keg_priming_amount);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
422 $('#keg_carbonation_temp').val(dataRecord.keg_carbonation_temp);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
423 $('#keg_forced_carb').val(dataRecord.keg_forced_carb);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
424 $('#keg_pressure').val(dataRecord.keg_pressure);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
425 $('#taste_notes').val(dataRecord.taste_notes);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
426 $('#taste_rate').val(dataRecord.taste_rate);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
427 $('#taste_date').val(dataRecord.taste_date);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
428 $('#taste_color').val(dataRecord.taste_color);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
429 $('#taste_transparency').val(dataRecord.taste_transparency);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
430 $('#taste_head').val(dataRecord.taste_head);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
431 $('#taste_aroma').val(dataRecord.taste_aroma);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
432 $('#taste_taste').val(dataRecord.taste_taste);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
433 $('#taste_mouthfeel').val(dataRecord.taste_mouthfeel);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
434 $('#taste_aftertaste').val(dataRecord.taste_aftertaste);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
435
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
436 // Recipe
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
437 $('#st_name').val(dataRecord.st_name);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
438 $('#st_letter').val(dataRecord.st_letter);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
439 $('#st_guide').val(dataRecord.st_guide);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
440 $('#st_category').val(dataRecord.st_category);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
441 $('#st_category_number').val(dataRecord.st_category_number);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
442 $('#st_type').val(StyleTypeData[dataRecord.st_type].nl);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
443 $('#st_og_min').val(dataRecord.st_og_min);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
444 $('#st_og_max').val(dataRecord.st_og_max);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
445 $('#st_fg_min').val(dataRecord.st_fg_min);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
446 $('#st_fg_max').val(dataRecord.st_fg_max);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
447 $('#st_abv_min').val(dataRecord.st_abv_min);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
448 $('#st_abv_max').val(dataRecord.st_abv_max);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
449 $('#st_color_min').val(dataRecord.st_color_min);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
450 $('#st_color_max').val(dataRecord.st_color_max);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
451 $('#st_ibu_min').val(dataRecord.st_ibu_min);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
452 $('#st_ibu_max').val(dataRecord.st_ibu_max);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
453 $('#st_carb_min').val(dataRecord.st_carb_min);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
454 $('#st_carb_min2').val(dataRecord.st_carb_min);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
455 $('#st_carb_max').val(dataRecord.st_carb_max);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
456 $('#st_carb_max2').val(dataRecord.st_carb_max);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
457 $('#type').val(dataRecord.type);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
458 $('#batch_size').val(dataRecord.batch_size);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
459 $('#est_a_vol').val(dataRecord.batch_size * 1.04);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
460 $('#boil_size').val(dataRecord.boil_size);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
461 $('#est_pre_vol').val(dataRecord.boil_size * 1.04);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
462 $('#boil_time').val(dataRecord.boil_time);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
463 $('#efficiency').val(dataRecord.efficiency);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
464 $('#est_og').val(dataRecord.est_og);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
465 $('#est_og2').val(dataRecord.est_og);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
466 $('#est_og3').val(0);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
467 $('#est_fg').val(dataRecord.est_fg);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
468 $('#est_fg2').val(dataRecord.est_fg);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
469 $('#est_fg3').val(dataRecord.est_fg);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
470 $('#est_color').val(dataRecord.est_color);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
471 $('#est_color2').val(dataRecord.est_color);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
472 $('#est_abv').val(dataRecord.est_abv);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
473 $('#color_method').val(dataRecord.color_method);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
474 $('#est_ibu').val(dataRecord.est_ibu);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
475 $('#est_ibu2').val(dataRecord.est_ibu);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
476 $('#ibu_method').val(dataRecord.ibu_method);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
477 $('#est_carb').val(dataRecord.est_carb);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
478 $('#mash_name').val(dataRecord.mash_name);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
479 $('#mash_ph').val(dataRecord.mash_ph);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
480 $('#sparge_temp').val(dataRecord.sparge_temp);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
481 $('#sparge_ph').val(dataRecord.sparge_ph);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
482 $('#sparge_volume').val(dataRecord.sparge_volume);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
483 $('#sparge_source').val(dataRecord.sparge_source);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
484 $('#sparge_acid_type').val(dataRecord.sparge_acid_type);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
485 $('#sparge_acid_perc').val(dataRecord.sparge_acid_perc);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
486 $('#sparge_acid_amount').val(dataRecord.sparge_acid_amount * 1000);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
487 $('#calc_acid').val(dataRecord.calc_acid);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
488 $('#w1_name').val(dataRecord.w1_name);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
489 $('#w1_amount').val(dataRecord.w1_amount);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
490 $('#w1_calcium').val(dataRecord.w1_calcium);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
491 $('#w1_sulfate').val(dataRecord.w1_sulfate);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
492 $('#w1_chloride').val(dataRecord.w1_chloride);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
493 $('#w1_sodium').val(dataRecord.w1_sodium);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
494 $('#w1_magnesium').val(dataRecord.w1_magnesium);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
495 $('#w1_total_alkalinity').val(dataRecord.w1_total_alkalinity);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
496 $('#w1_ph').val(dataRecord.w1_ph);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
497 $('#w1_cost').val(dataRecord.w1_cost);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
498 $('#w2_name').val(dataRecord.w2_name);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
499 $('#w2_amount').val(dataRecord.w2_amount);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
500 $('#w2_calcium').val(dataRecord.w2_calcium);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
501 $('#w2_sulfate').val(dataRecord.w2_sulfate);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
502 $('#w2_chloride').val(dataRecord.w2_chloride);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
503 $('#w2_sodium').val(dataRecord.w2_sodium);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
504 $('#w2_magnesium').val(dataRecord.w2_magnesium);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
505 $('#w2_total_alkalinity').val(dataRecord.w2_total_alkalinity);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
506 $('#w2_ph').val(dataRecord.w2_ph);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
507 $('#w2_cost').val(dataRecord.w2_cost);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
508 $('#wg_amount').val(dataRecord.wg_amount);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
509 $('#wg_calcium').val(dataRecord.wg_calcium);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
510 $('#wg_sulfate').val(dataRecord.wg_sulfate);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
511 $('#wg_chloride').val(dataRecord.wg_chloride);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
512 $('#wg_sodium').val(dataRecord.wg_sodium);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
513 $('#wg_magnesium').val(dataRecord.wg_magnesium);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
514 $('#wg_total_alkalinity').val(dataRecord.wg_total_alkalinity);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
515 $('#wg_ph').val(dataRecord.wg_ph);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
516 $('#wb_calcium').val(dataRecord.wb_calcium);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
517 $('#wb_sulfate').val(dataRecord.wb_sulfate);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
518 $('#wb_chloride').val(dataRecord.wb_chloride);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
519 $('#wb_sodium').val(dataRecord.wb_sodium);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
520 $('#wb_magnesium').val(dataRecord.wb_magnesium);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
521 $('#wb_total_alkalinity').val(dataRecord.wb_total_alkalinity);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
522 $('#wb_ph').val(dataRecord.wb_ph);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
523 $('#wa_acid_name').val(dataRecord.wa_acid_name);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
524 $('#wa_acid_perc').val(dataRecord.wa_acid_perc);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
525 $('#wa_base_name').val(dataRecord.wa_base_name);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
526 $('#starter_enable').val(dataRecord.starter_enable);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
527 $('#starter_type').val(dataRecord.starter_type);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
528 $('#starter_sg').val(dataRecord.starter_sg);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
529 $('#starter_viability').val(dataRecord.starter_viability);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
530 $('#prop1_type').val(dataRecord.prop1_type);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
531 $('#prop1_volume').val(dataRecord.prop1_volume);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
532 $('#prop2_type').val(dataRecord.prop2_type);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
533 $('#prop2_volume').val(dataRecord.prop2_volume);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
534 $('#prop3_type').val(dataRecord.prop3_type);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
535 $('#prop3_volume').val(dataRecord.prop3_volume);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
536 $('#prop4_type').val(dataRecord.prop4_type);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
537 $('#prop4_volume').val(dataRecord.prop4_volume);
500
8d53ad389204 Reworked the splitted batches, the data is now in a separate table and there is only one product record.
Michiel Broek <mbroek@mbse.eu>
parents: 497
diff changeset
538 $('#divide_type').val(SplitData[dataRecord.divide_type].nl);
497
0fe366d953ab Prepare screens for product divide batch.
Michiel Broek <mbroek@mbse.eu>
parents: 495
diff changeset
539 // hidden divide_size
533
be8691b7d634 Added the product divide scripts. All parts have all the volumes and weights divided, including the master record. Splitted batches have their own records with the product code formatted as code-n. From this design, we can rebuild the print and checklist.
Michiel Broek <mbroek@mbse.eu>
parents: 525
diff changeset
540 // hidden divide_factor
500
8d53ad389204 Reworked the splitted batches, the data is now in a separate table and there is only one product record.
Michiel Broek <mbroek@mbse.eu>
parents: 497
diff changeset
541 $('#divide_parts').val(dataRecord.divide_parts);
533
be8691b7d634 Added the product divide scripts. All parts have all the volumes and weights divided, including the master record. Splitted batches have their own records with the product code formatted as code-n. From this design, we can rebuild the print and checklist.
Michiel Broek <mbroek@mbse.eu>
parents: 525
diff changeset
542 // hidden divide_part
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
543 editFermentable(dataRecord);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
544 editHop(dataRecord);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
545 editMisc(dataRecord);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
546 editYeast(dataRecord);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
547 editMash(dataRecord);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
548 calcStage();
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
549 $('#jqxTabs').jqxTabs('select', 2);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
550 },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
551 loadError: function(jqXHR, status, error) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
552 },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
553 beforeLoadComplete: function(records) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
554 $('#jqxLoader').jqxLoader('open');
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
555 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
556 });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
557
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
558 // Inline fermentables editor
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
559 var editFermentable = function(data) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
560 var fermentableSource = {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
561 localdata: data.fermentables,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
562 datatype: 'local',
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
563 cache: false,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
564 async: false,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
565 datafields: [
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
566 { name: 'f_name', type: 'string' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
567 { name: 'f_origin', type: 'string' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
568 { name: 'f_supplier', type: 'string' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
569 { name: 'f_amount', type: 'float' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
570 { name: 'f_cost', type: 'float' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
571 { name: 'f_type', type: 'int' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
572 { name: 'f_yield', type: 'float' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
573 { name: 'f_color', type: 'float' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
574 { name: 'f_coarse_fine_diff', type: 'float' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
575 { name: 'f_moisture', type: 'float' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
576 { name: 'f_diastatic_power', type: 'float' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
577 { name: 'f_protein', type: 'float' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
578 { name: 'f_max_in_batch', type: 'float' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
579 { name: 'f_graintype', type: 'int' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
580 { name: 'f_added', type: 'int' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
581 { name: 'f_dissolved_protein', type: 'float' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
582 { name: 'f_recommend_mash', type: 'int' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
583 { name: 'f_add_after_boil', type: 'int' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
584 { name: 'f_adjust_to_total_100', type: 'int' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
585 { name: 'f_percentage', type: 'float' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
586 { name: 'f_di_ph', type: 'float' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
587 { name: 'f_acid_to_ph_57', type: 'float' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
588 { name: 'f_inventory', type: 'float' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
589 { name: 'f_avail', type: 'int' }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
590 ],
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
591 addrow: function(rowid, rowdata, position, commit) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
592 //console.log("fermentable addrow "+rowid);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
593 commit(true);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
594 },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
595 deleterow: function(rowid, commit) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
596 //console.log("fermentable deleterow "+rowid);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
597 commit(true);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
598 },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
599 updaterow: function(rowid, rowdata, commit) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
600 //console.log("fermentable updaterow "+rowid);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
601 commit(true);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
602 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
603 },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
604 fermentableAdapter = new $.jqx.dataAdapter(fermentableSource);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
605
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
606 $('#fermentableGrid').jqxGrid({
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
607 width: 1240,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
608 height: 470,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
609 source: fermentableAdapter,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
610 theme: theme,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
611 selectionmode: 'singlerow',
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
612 showtoolbar: true,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
613 rendertoolbar: function(toolbar) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
614 var container = $("<div style='overflow: hidden; position: relative; margin: 5px;'></div>");
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
615 toolbar.append(container);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
616 container.append('<div style="float: left; margin-left: 165px;" id="faddrowbutton"></div>');
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
617 container.append('<div style="float: left; margin-left: 10px; margin-top: 5px;">In voorraad:</div>');
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
618 container.append('<div style="float: left; margin-left: 10px;" id="finstockbutton"></div>');
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
619 container.append('<input style="float: left; margin-left: 400px;" id="fdeleterowbutton" type="button" value="Verwijder mout" />');
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
620 // add fermentable from dropdownlist.
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
621 $('#faddrowbutton').jqxDropDownList({
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
622 placeHolder: 'Kies mout:',
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
623 theme: theme,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
624 template: 'primary',
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
625 source: fermentablelist,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
626 displayMember: 'name',
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
627 disabled: (dataRecord.stage > 3),
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
628 width: 150,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
629 height: 27,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
630 dropDownWidth: 500,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
631 dropDownHeight: 500,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
632 renderer: function(index, label, value) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
633 var datarecord = fermentablelist.records[index];
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
634 return datarecord.supplier + ' / ' + datarecord.name + ' (' + datarecord.color + ' EBC)';
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
635 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
636 });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
637 $('#faddrowbutton').on('select', function(event) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
638 if (event.args) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
639 var index, datarecord, row = {}, rowscount = $('#fermentableGrid').jqxGrid('getdatainformation').rowscount;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
640 index = event.args.index;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
641 datarecord = fermentablelist.records[index];
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
642 row['f_name'] = datarecord.name;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
643 row['f_origin'] = datarecord.origin;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
644 row['f_supplier'] = datarecord.supplier;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
645 row['f_amount'] = 0;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
646 row['f_cost'] = datarecord.cost;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
647 row['f_type'] = datarecord.type;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
648 row['f_yield'] = datarecord.yield;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
649 row['f_color'] = datarecord.color;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
650 row['f_coarse_fine_diff'] = datarecord.coarse_fine_diff;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
651 row['f_moisture'] = datarecord.moisture;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
652 row['f_diastatic_power'] = datarecord.diastatic_power;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
653 row['f_protein'] = datarecord.protein;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
654 row['f_max_in_batch'] = datarecord.max_in_batch;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
655 row['f_graintype'] = datarecord.graintype;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
656 if (datarecord.add_after_boil) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
657 row['f_added'] = 2; // Fermentation
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
658 } else if ((datarecord.type == 1) || (datarecord.type == 4)) { // Sugar or Adjunct
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
659 row['f_added'] = 1; // Boil
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
660 } else {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
661 row['f_added'] = 0; // Mash
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
662 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
663 row['f_dissolved_protein'] = datarecord.dissolved_protein;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
664 row['f_recommend_mash'] = datarecord.recommend_mash;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
665 row['f_add_after_boil'] = datarecord.add_after_boil;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
666 if (rowscount == 0) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
667 // The first fermentable
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
668 row['f_adjust_to_total_100'] = 1;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
669 row['f_percentage'] = 100;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
670 } else {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
671 row['f_adjust_to_total_100'] = 0;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
672 row['f_percentage'] = 0;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
673 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
674 row['f_di_ph'] = datarecord.di_ph;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
675 row['f_acid_to_ph_57'] = datarecord.acid_to_ph_57;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
676 row['f_inventory'] = datarecord.inventory;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
677 $('#fermentableGrid').jqxGrid('addrow', null, row);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
678 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
679 });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
680
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
681 $('#finstockbutton').jqxCheckBox({ theme: theme, height: 27, disabled: (dataRecord.stage > 3) });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
682 $('#finstockbutton').on('change', function(event) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
683 fermentableinstock = event.args.checked;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
684 fermentablelist.dataBind();
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
685 });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
686
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
687 // delete selected fermentable.
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
688 $('#fdeleterowbutton').jqxButton({ template: 'danger', theme: theme, height: 27, width: 150, disabled: (dataRecord.stage > 3) });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
689 $('#fdeleterowbutton').on('click', function() {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
690 var rowscount, id, percent, amount, i, rowdata,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
691 selectedrowindex = $('#fermentableGrid').jqxGrid('getselectedrowindex');
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
692 rowscount = $('#fermentableGrid').jqxGrid('getdatainformation').rowscount;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
693 if (selectedrowindex >= 0 && selectedrowindex < rowscount) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
694 id = $('#fermentableGrid').jqxGrid('getrowid', selectedrowindex);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
695 percent = $('#fermentableGrid').jqxGrid('getcellvalue', id, 'f_percentage');
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
696 amount = $('#fermentableGrid').jqxGrid('getcellvalue', id, 'f_amount');
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
697 $('#fermentableGrid').jqxGrid('deleterow', id);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
698 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
699 rowscount = $('#fermentableGrid').jqxGrid('getdatainformation').rowscount;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
700 if (rowscount > 1) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
701 if (to_100) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
702 for (i = 0; i < rowscount; i++) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
703 rowdata = $('#fermentableGrid').jqxGrid('getrowdata', i);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
704 if (rowdata.f_adjust_to_total_100) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
705 rowdata.f_percentage += percent;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
706 rowdata.f_amount += amount;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
707 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
708 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
709 } else {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
710 calcPercentages();
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
711 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
712 } else {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
713 $('#fermentableGrid').jqxGrid('setcellvalue', 0, 'f_percentage', 100);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
714 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
715 calcFermentables();
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
716 calcIBUs();
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
717 });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
718 },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
719 ready: function() {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
720 calcFermentables();
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
721 $('#jqxTabs').jqxTabs('next');
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
722 },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
723 columns: [
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
724 { text: 'Vergistbaar ingredi&euml;nt', datafield: 'f_name',
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
725 cellsrenderer: function(index, datafield, value, defaultvalue, column, rowdata) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
726 return '<span style="margin: 3px; margin-top: 6px; float: left;">' + rowdata.f_supplier + ' / ' +
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
727 rowdata.f_name + ' (' + rowdata.f_color + ' EBC)</span>';
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
728 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
729 },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
730 { text: 'Type', width: 100, datafield: 'f_type',
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
731 cellsrenderer: function(index, datafield, value, defaultvalue, column, rowdata) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
732 return '<span style="margin: 3px; margin-top: 6px; float: left;">' + FermentableTypeData[value].nl + '</span>';
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
733 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
734 },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
735 { text: 'Moment', width: 110, datafield: 'f_added',
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
736 cellsrenderer: function(index, datafield, value, defaultvalue, column, rowdata) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
737 return '<span style="margin: 3px; margin-top: 6px; float: left;">' + AddedData[value].nl + '</span>';
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
738 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
739 },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
740 { text: 'Maxinbatch', datafield: 'f_max_in_batch', hidden: true },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
741 { text: 'Opbrengst', datafield: 'f_yield', width: 90, align: 'right', cellsalign: 'right', cellsformat: 'p1' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
742 { text: 'Gewicht Kg', datafield: 'f_amount', width: 120, align: 'right', cellsalign: 'right', cellsformat: 'f3' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
743 { text: 'Voorraad Kg', datafield: 'f_inventory', width: 120, align: 'right',
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
744 cellsrenderer: function(row, columnfield, value, defaulthtml, columnproperties, rowdata) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
745 var color = '#ffffff';
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
746 if (((dataRecord.inventory_reduced <= 2) && (rowdata.f_added <= 1)) || // Mash or boil
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
747 ((dataRecord.inventory_reduced <= 3) && (rowdata.f_added == 2)) || // Primary
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
748 ((dataRecord.inventory_reduced <= 5) && (rowdata.f_added == 3)) || // Secondary or Tertiary
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
749 ((dataRecord.inventory_reduced <= 6) && (rowdata.f_added == 4)) || // Bottle
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
750 ((dataRecord.inventory_reduced <= 6) && (rowdata.f_added == 5))) { // Kegs
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
751 if (value < rowdata.f_amount)
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
752 color = '#ff4040';
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
753 return '<span style="margin: 4px; margin-top: 6px; float: right; color: ' + color + ';">' + fermentableAdapter.formatNumber(value, 'f3') + '</span>';
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
754 } else {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
755 return '<span></span>';
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
756 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
757 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
758 },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
759 { text: 'Procent', datafield: 'f_percentage', width: 90, align: 'right',
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
760 cellsrenderer: function(row, columnfield, value, defaulthtml, columnproperties, rowdata) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
761 if (rowdata.f_added >= 4)
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
762 return '<span></span>';
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
763 var color = '#ffffff';
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
764 if (value > rowdata.f_max_in_batch)
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
765 color = '#ff4040';
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
766 return '<span style="margin: 4px; margin-top: 6px; float: right; color: ' + color + ';">' + fermentableAdapter.formatNumber(value, 'p1') + '</span>';
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
767 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
768 },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
769 { text: '100%', datafield: 'f_adjust_to_total_100', width: 70, align: 'center', cellsalign: 'center',
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
770 cellsrenderer: function(index, datafield, value, defaultvalue, column, rowdata) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
771 if (value == 0)
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
772 return '<span></span>';
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
773 return '<span><img style="float:left; margin-left:25px; margin-top:4px;" src="images/dialog-ok-apply.png"></span>';
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
774 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
775 },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
776 { text: '', datafield: 'Edit', columntype: 'button', width: 100, align: 'center',
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
777 cellsrenderer: function() {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
778 return 'Wijzig';
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
779 }, buttonclick: function(row) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
780 fermentableRow = row;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
781 fermentableData = $('#fermentableGrid').jqxGrid('getrowdata', fermentableRow);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
782 if (fermentableData.f_added >= 4) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
783 alert('Wijzig dit in de Verpakken tab');
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
784 } else if (dataRecord.stage > 3) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
785 alert('Ingredieënt is al verwerkt.');
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
786 } else {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
787 $('#wf_name').val(fermentableData.f_name);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
788 $('#wf_amount').val(fermentableData.f_amount);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
789 $('#wf_percentage').val(fermentableData.f_percentage);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
790 $('#wf_max_in_batch').val(fermentableData.f_max_in_batch);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
791 $('#wf_adjust_to_total_100').val(fermentableData.f_adjust_to_total_100);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
792 $('#wf_added').val(fermentableData.f_added);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
793 // show the popup window.
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
794 $('#popupFermentable').jqxWindow('open');
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
795 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
796 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
797 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
798 ]
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
799 });
525
8bbc5730aaa8 Code cleanup and manual compress
Michiel Broek <mbroek@mbse.eu>
parents: 518
diff changeset
800 };
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
801
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
802 // Inline hops editor
525
8bbc5730aaa8 Code cleanup and manual compress
Michiel Broek <mbroek@mbse.eu>
parents: 518
diff changeset
803 var editHop = function(data) {
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
804 var hopSource = {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
805 localdata: data.hops,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
806 datatype: 'local',
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
807 cache: false,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
808 async: false,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
809 datafields: [
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
810 { name: 'h_name', type: 'string' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
811 { name: 'h_origin', type: 'string' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
812 { name: 'h_amount', type: 'float' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
813 { name: 'h_cost', type: 'float' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
814 { name: 'h_type', type: 'int' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
815 { name: 'h_form', type: 'int' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
816 { name: 'h_useat', type: 'int' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
817 { name: 'h_time', type: 'float' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
818 { name: 'h_alpha', type: 'float' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
819 { name: 'h_beta', type: 'float' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
820 { name: 'h_hsi', type: 'float' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
821 { name: 'h_humulene', type: 'float' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
822 { name: 'h_caryophyllene', type: 'float' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
823 { name: 'h_cohumulone', type: 'float' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
824 { name: 'h_myrcene', type: 'float' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
825 { name: 'h_total_oil', type: 'float' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
826 { name: 'h_inventory', type: 'float' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
827 { name: 'h_avail', type: 'int' }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
828 ],
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
829 addrow: function(rowid, rowdata, position, commit) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
830 console.log('hop addrow ' + rowid);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
831 commit(true);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
832 },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
833 deleterow: function(rowid, commit) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
834 console.log('hop deleterow ' + rowid);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
835 commit(true);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
836 },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
837 updaterow: function(rowid, rowdata, commit) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
838 console.log('hop updaterow ' + rowid);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
839 commit(true);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
840 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
841 },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
842 hopAdapter = new $.jqx.dataAdapter(hopSource);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
843
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
844 $('#hopGrid').jqxGrid({
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
845 width: 1240,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
846 height: 560,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
847 source: hopAdapter,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
848 theme: theme,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
849 selectionmode: 'singlerow',
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
850 showtoolbar: true,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
851 rendertoolbar: function(toolbar) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
852 var container = $("<div style='overflow: hidden; position: relative; margin: 5px;'></div>");
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
853 toolbar.append(container);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
854 container.append('<div style="float: left; margin-left: 165px;" id="haddrowbutton"></div>');
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
855 container.append('<div style="float: left; margin-left: 10px; margin-top: 5px;">In voorraad:</div>');
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
856 container.append('<div style="float: left; margin-left: 10px;" id="hinstockbutton"></div>');
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
857 container.append('<input style="float: left; margin-left: 400px;" id="hdeleterowbutton" type="button" value="Verwijder hop" />');
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
858 // add hop from dropdownlist.
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
859 $('#haddrowbutton').jqxDropDownList({
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
860 placeHolder: 'Kies hop:',
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
861 theme: theme,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
862 template: 'primary',
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
863 source: hoplist,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
864 disabled: (dataRecord.stage > 3),
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
865 displayMember: 'name',
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
866 width: 150,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
867 height: 27,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
868 dropDownWidth: 500,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
869 dropDownHeight: 500,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
870 renderer: function(index, label, value) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
871 var datarecord = hoplist.records[index];
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
872 return datarecord.origin + ' - ' + datarecord.name + ' / ' + HopFormData[datarecord.form].nl + ' (' + datarecord.alpha + '% &alpha;)';
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
873 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
874 });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
875 $('#haddrowbutton').on('select', function(event) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
876 if (event.args) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
877 var datarecord, row = {}, index = event.args.index;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
878 datarecord = hoplist.records[index];
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
879 row['h_name'] = datarecord.name;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
880 row['h_origin'] = datarecord.origin;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
881 row['h_amount'] = 0;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
882 row['h_cost'] = datarecord.cost;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
883 row['h_type'] = datarecord.type;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
884 row['h_form'] = datarecord.form;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
885 row['h_useat'] = 2; // Boil
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
886 row['h_time'] = 0;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
887 row['h_alpha'] = datarecord.alpha;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
888 row['h_beta'] = datarecord.beta;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
889 row['h_hsi'] = datarecord.hsi;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
890 row['h_humulene'] = datarecord.humulene;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
891 row['h_caryophyllene'] = datarecord.caryophyllene;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
892 row['h_cohumulone'] = datarecord.cohumulone;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
893 row['h_myrcene'] = datarecord.myrcene;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
894 row['h_total_oil'] = datarecord.total_oil;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
895 row['h_inventory'] = datarecord.inventory;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
896 $('#hopGrid').jqxGrid('addrow', null, row);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
897 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
898 $('#haddrowbutton').jqxDropDownList('clearSelection');
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
899 });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
900
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
901 $('#hinstockbutton').jqxCheckBox({ theme: theme, height: 27, disabled: (dataRecord.stage > 3) });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
902 $('#hinstockbutton').on('change', function(event) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
903 hopinstock = event.args.checked;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
904 hoplist.dataBind();
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
905 });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
906
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
907 // delete selected hop.
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
908 $('#hdeleterowbutton').jqxButton({ template: 'danger', theme: theme, height: 27, width: 150, disabled: (dataRecord.stage > 3) });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
909 $('#hdeleterowbutton').on('click', function() {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
910 var rowscount, id, selectedrowindex = $('#hopGrid').jqxGrid('getselectedrowindex');
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
911 rowscount = $('#hopGrid').jqxGrid('getdatainformation').rowscount;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
912 if (selectedrowindex >= 0 && selectedrowindex < rowscount) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
913 id = $('#hopGrid').jqxGrid('getrowid', selectedrowindex);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
914 $('#hopGrid').jqxGrid('deleterow', id);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
915 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
916 calcIBUs();
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
917 });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
918 },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
919 ready: function() {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
920 calcIBUs();
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
921 $('#jqxTabs').jqxTabs('next');
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
922 },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
923 columns: [
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
924 { text: 'Hop', datafield: 'h_name',
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
925 cellsrenderer: function(index, datafield, value, defaultvalue, column, rowdata) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
926 return '<span style="margin: 3px; margin-top: 6px; float: left;">' + rowdata.h_origin + ' / ' + rowdata.h_name + '</span>';
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
927 },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
928 },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
929 { text: 'Type', width: 90, datafield: 'h_type',
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
930 cellsrenderer: function(index, datafield, value, defaultvalue, column, rowdata) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
931 return '<span style="margin: 4px; margin-top: 6px; float: left;">' + HopTypeData[value].nl + '</span>';
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
932 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
933 },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
934 { text: 'Vorm', width: 90, datafield: 'h_form',
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
935 cellsrenderer: function(index, datafield, value, defaultvalue, column, rowdata) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
936 return '<span style="margin: 4px; margin-top: 6px; float: left;">' + HopFormData[value].nl + '</span>';
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
937 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
938 },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
939 { text: 'Alpha', datafield: 'h_alpha', width: 80, align: 'right', cellsalign: 'right', cellsformat: 'p1' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
940 { text: 'Gebruik', width: 110, datafield: 'h_useat',
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
941 cellsrenderer: function(index, datafield, value, defaultvalue, column, rowdata) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
942 return '<span style="margin: 4px; margin-top: 6px; float: left;">' + HopUseData[value].nl + '</span>';
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
943 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
944 },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
945 { text: 'Tijdsduur', datafield: 'h_time', width: 90, align: 'right',
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
946 cellsrenderer: function(index, datafield, value, defaultvalue, column, rowdata) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
947 var duration = '';
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
948 if ((rowdata.h_useat == 2) || (rowdata.h_useat == 4)) // Boil, Whirlpool
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
949 duration = dataAdapter.formatNumber(value, 'f0') + ' min.';
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
950 else if (rowdata.h_useat == 5) // Dry hop
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
951 duration = dataAdapter.formatNumber(value / 1440, 'f0') + ' dagen';
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
952 return '<span style="margin: 4px; margin-top: 6px; float: right;">' + duration + '</span>';
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
953 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
954 },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
955 { text: 'IBU', datafield: 'ibu', width: 80, align: 'right',
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
956 cellsrenderer: function(index, datafield, value, defaultvalue, column, rowdata) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
957 var ibu = toIBU(rowdata.h_useat, rowdata.h_form, preboil_sg, parseFloat($('#batch_size').jqxNumberInput('decimal')),
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
958 parseFloat(rowdata.h_amount), parseFloat(rowdata.h_time), parseFloat(rowdata.h_alpha), $('#ibu_method').val());
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
959 return '<span style="margin: 4px; margin-top: 6px; float: right;">' + dataAdapter.formatNumber(ibu, 'f1') + '</span>';
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
960 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
961 },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
962 { text: 'Gewicht', datafield: 'h_amount', width: 110, align: 'right',
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
963 cellsrenderer: function(index, datafield, value, defaultvalue, column, rowdata) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
964 var amount = dataAdapter.formatNumber(value, 'f1') + ' kg';
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
965 if (value < 1)
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
966 amount = dataAdapter.formatNumber(value * 1000, 'f1') + ' gr';
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
967 return '<span style="margin: 4px; margin-top: 6px; float: right;">' + amount + '</span>';
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
968 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
969 },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
970 { text: 'Voorraad', datafield: 'h_inventory', width: 110, align: 'right',
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
971 cellsrenderer: function(index, datafield, value, defaultvalue, column, rowdata) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
972 if (((dataRecord.inventory_reduced <= 2) && (rowdata.h_useat <= 4)) || // Mash, FW, Boil, Aroma, Whirlpool
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
973 ((dataRecord.inventory_reduced <= 6) && (rowdata.h_useat == 5))) { // Dry hop
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
974 var amount, color = '#ffffff';
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
975 if (value < rowdata.h_amount)
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
976 color = '#ff4040';
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
977 amount = dataAdapter.formatNumber(value, 'f1') + ' kg';
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
978 if (value < 1)
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
979 amount = dataAdapter.formatNumber(value * 1000, 'f1') + ' gr';
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
980 return '<span style="margin: 4px; margin-top: 6px; float: right; color: ' + color + ';">' + amount + '</span>';
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
981 } else {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
982 return '<span></span>';
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
983 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
984 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
985 },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
986 { text: '', datafield: 'Edit', columntype: 'button', width: 100, align: 'center',
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
987 cellsrenderer: function() {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
988 return 'Wijzig';
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
989 }, buttonclick: function(row) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
990 if (dataRecord.stage > 3) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
991 alert('Ingredieënt is al verwerkt.');
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
992 } else {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
993 console.log('edit button row ' + row);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
994 hopRow = row;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
995 hopData = $('#hopGrid').jqxGrid('getrowdata', hopRow);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
996 $('#wh_name').val(hopData.h_name);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
997 $('#wh_amount').val(hopData.h_amount * 1000);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
998 var ibu = toIBU(hopData.h_useat, hopData.h_form, preboil_sg, parseFloat($('#batch_size').jqxNumberInput('decimal')),
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
999 parseFloat(hopData.h_amount), parseFloat(hopData.h_time), parseFloat(hopData.h_alpha), $('#ibu_method').val());
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1000 $('#wh_ibu').val(ibu);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1001 if (hopData.h_useat == 5) // Dry hop
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1002 $('#wh_time').val(hopData.h_time / 1440);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1003 else
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1004 $('#wh_time').val(hopData.h_time);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1005 $('#wh_useat').val(hopData.h_useat);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1006 // show the popup window.
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1007 $('#popupHop').jqxWindow('open');
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1008 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1009 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1010 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1011 ]
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1012 });
525
8bbc5730aaa8 Code cleanup and manual compress
Michiel Broek <mbroek@mbse.eu>
parents: 518
diff changeset
1013 };
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1014
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1015 // Inline miscs editor
525
8bbc5730aaa8 Code cleanup and manual compress
Michiel Broek <mbroek@mbse.eu>
parents: 518
diff changeset
1016 var editMisc = function(data) {
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1017 var miscSource = {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1018 localdata: data.miscs,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1019 datatype: 'local',
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1020 cache: false,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1021 async: false,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1022 datafields: [
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1023 { name: 'm_name', type: 'string' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1024 { name: 'm_amount', type: 'float' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1025 { name: 'm_cost', type: 'float' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1026 { name: 'm_type', type: 'int' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1027 { name: 'm_use_use', type: 'int' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1028 { name: 'm_time', type: 'float' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1029 { name: 'm_amount_is_weight', type: 'int' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1030 { name: 'm_inventory', type: 'float' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1031 { name: 'm_avail', type: 'int' }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1032 ],
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1033 addrow: function(rowid, rowdata, position, commit) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1034 console.log('misc addrow ' + rowid);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1035 commit(true);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1036 },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1037 deleterow: function(rowid, commit) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1038 console.log('misc deleterow ' + rowid);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1039 commit(true);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1040 },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1041 updaterow: function(rowid, rowdata, commit) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1042 console.log('misc updaterow ' + rowid);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1043 commit(true);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1044 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1045 },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1046 miscAdapter = new $.jqx.dataAdapter(miscSource, {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1047 beforeLoadComplete: function(records) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1048 var row, i, data = new Array();
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1049 for (i = 0; i < records.length; i++) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1050 row = records[i];
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1051 data.push(row);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1052 // Initial set water agent values.
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1053 switch (row.m_name) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1054 case 'CaCl2':
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1055 $('#wa_cacl2').val(row.m_amount * 1000);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1056 break;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1057 case 'CaSO4':
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1058 $('#wa_caso4').val(row.m_amount * 1000);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1059 break;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1060 case 'MgSO4':
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1061 $('#wa_mgso4').val(row.m_amount * 1000);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1062 break;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1063 case 'NaCl':
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1064 $('#wa_nacl').val(row.m_amount * 1000);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1065 break;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1066 case 'Melkzuur':
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1067 $('#wa_acid_name').val(0);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1068 $('#wa_acid').val(row.m_amount * 1000);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1069 $('#wa_acid_perc').val(80);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1070 last_acid = 'Melkzuur';
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1071 break;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1072 case 'Zoutzuur':
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1073 $('#wa_acid_name').val(1);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1074 $('#wa_acid').val(row.m_amount * 1000);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1075 $('#wa_acid_perc').val(80);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1076 last_acid = 'Zoutzuur';
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1077 break;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1078 case 'Fosforzuur':
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1079 $('#wa_acid_name').val(2);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1080 $('#wa_acid').val(row.m_amount * 1000);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1081 $('#wa_acid_perc').val(80);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1082 last_acid = 'Fosforzuur';
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1083 break;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1084 case 'Zwavelzuur':
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1085 $('#wa_acid_name').val(3);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1086 $('#wa_acid').val(row.m_amount * 1000);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1087 $('#wa_acid_perc').val(80);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1088 last_acid = 'Zwavelzuur';
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1089 break;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1090 case 'NaHCO3':
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1091 $('#wa_base_name').val(0);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1092 $('#wa_base').val(row.m_amount * 1000);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1093 last_base = 'NaHCO3';
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1094 break;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1095 case 'Na2CO3':
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1096 $('#wa_base_name').val(1);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1097 $('#wa_base').val(row.m_amount * 1000);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1098 last_base = 'Na2CO3';
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1099 break;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1100 case 'CaCO3':
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1101 $('#wa_base_name').val(2);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1102 $('#wa_base').val(row.m_amount * 1000);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1103 last_base = 'CaCO3';
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1104 break;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1105 case 'Ca(OH)2':
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1106 $('#wa_base_name').val(3);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1107 $('#wa_base').val(row.m_amount * 1000);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1108 last_base = 'Ca(OH)2';
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1109 break;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1110 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1111 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1112 return data;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1113 },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1114 loadError: function(jqXHR, status, error) {
151
2c9cfe2f0860 Merged prod_main and prod_recipe database tables into products. Added recipe tabs in the products editor.
Michiel Broek <mbroek@mbse.eu>
parents: 149
diff changeset
1115 $('#err').text(status + ' ' + error);
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1116 },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1117 });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1118 $('#miscGrid').jqxGrid({
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1119 width: 1240,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1120 height: 575,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1121 source: miscAdapter,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1122 theme: theme,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1123 selectionmode: 'singlerow',
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1124 showtoolbar: true,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1125 rendertoolbar: function(toolbar) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1126 var container = $("<div style='overflow: hidden; position: relative; margin: 5px;'></div>");
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1127 toolbar.append(container);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1128 container.append('<div style="float: left; margin-left: 165px;" id="maddrowbutton"></div>');
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1129 container.append('<div style="float: left; margin-left: 10px; margin-top: 5px;">In voorraad:</div>');
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1130 container.append('<div style="float: left; margin-left: 10px;" id="minstockbutton"></div>');
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1131 container.append('<input style="float: left; margin-left: 400px;" id="mdeleterowbutton" type="button" value="Verwijder ingredient" />');
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1132 // add misc from dropdownlist.
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1133 $('#maddrowbutton').jqxDropDownList({
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1134 placeHolder: 'Kies ingredi&euml;nt:',
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1135 theme: theme,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1136 template: 'primary',
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1137 source: misclist,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1138 disabled: (dataRecord.stage > 3),
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1139 displayMember: 'name',
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1140 width: 150,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1141 height: 27,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1142 dropDownWidth: 500,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1143 dropDownHeight: 500
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1144 });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1145 $('#maddrowbutton').on('select', function(event) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1146 if (event.args) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1147 var datarecord, row = {}, index = event.args.index;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1148 datarecord = misclist.records[index];
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1149 row['m_name'] = datarecord.name;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1150 row['m_amount'] = 0;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1151 row['m_cost'] = datarecord.cost;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1152 row['m_type'] = datarecord.type;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1153 row['m_use_use'] = datarecord.use_use;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1154 row['m_time'] = 0;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1155 row['m_amount_is_weight'] = datarecord.amount_is_weight;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1156 row['m_inventory'] = datarecord.inventory;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1157 $('#miscGrid').jqxGrid('addrow', null, row);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1158 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1159 });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1160 $('#minstockbutton').jqxCheckBox({ theme: theme, height: 27, disabled: (dataRecord.stage > 3) });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1161 $('#minstockbutton').on('change', function(event) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1162 miscinstock = event.args.checked;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1163 misclist.dataBind();
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1164 });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1165 // delete selected misc.
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1166 $('#mdeleterowbutton').jqxButton({ template: 'danger', theme: theme, height: 27, width: 150, disabled: (dataRecord.stage > 3) });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1167 $('#mdeleterowbutton').on('click', function() {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1168 var rowscount, type, id, selectedrowindex = $('#miscGrid').jqxGrid('getselectedrowindex');
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1169 rowscount = $('#miscGrid').jqxGrid('getdatainformation').rowscount;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1170 type = $('#miscGrid').jqxGrid('getcellvalue', selectedrowindex, 'm_type');
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1171 if (selectedrowindex >= 0 && selectedrowindex < rowscount && type != 4) { // Water agent
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1172 id = $('#miscGrid').jqxGrid('getrowid', selectedrowindex);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1173 $('#miscGrid').jqxGrid('deleterow', id);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1174 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1175 });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1176 },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1177 ready: function() {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1178 calcMiscs();
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1179 $('#jqxTabs').jqxTabs('next');
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1180 },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1181 columns: [
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1182 { text: 'Ingredient', datafield: 'm_name' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1183 { text: 'Type', width: 140, datafield: 'm_type',
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1184 cellsrenderer: function(index, datafield, value, defaultvalue, column, rowdata) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1185 return '<span style="margin: 3px; margin-top: 6px; float: left;">' + MiscTypeData[value].nl + '</span>';
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1186 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1187 },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1188 { text: 'Gebruik', width: 140, datafield: 'm_use_use',
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1189 cellsrenderer: function(index, datafield, value, defaultvalue, column, rowdata) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1190 return '<span style="margin: 3px; margin-top: 6px; float: left;">' + MiscUseData[value].nl + '</span>';
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1191 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1192 },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1193 { text: 'Tijd', datafield: 'm_time', width: 90, align: 'right',
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1194 cellsrenderer: function(index, datafield, value, defaultvalue, column, rowdata) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1195 var duration = '';
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1196 if (rowdata.m_use_use == 2) // Boil
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1197 duration = dataAdapter.formatNumber(value, 'f0') + ' min.';
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1198 else if ((rowdata.m_use_use == 3) || (rowdata.m_use_use == 4)) // Primary or Secondary
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1199 duration = dataAdapter.formatNumber(value / 1440, 'f0') + ' dagen';
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1200 return '<span style="margin: 4px; margin-top: 6px; float: right;">' + duration + '</span>';
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1201 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1202 },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1203 { text: 'Hoeveel', datafield: 'm_amount', width: 110, align: 'right',
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1204 cellsrenderer: function(index, datafield, value, defaultvalue, column, rowdata) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1205 var vstr = rowdata.m_amount_is_weight ? 'gr' : 'ml';
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1206 return '<span style="margin: 4px; margin-top: 6px; float: right;">' + dataAdapter.formatNumber(value * 1000, 'f2') + ' ' + vstr + '</span>';
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1207 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1208 },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1209 { text: 'Voorraad', datafield: 'm_inventory', width: 110, align: 'right',
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1210 cellsrenderer: function(index, datafield, value, defaultvalue, column, rowdata) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1211 var vstr, color, amount;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1212 if (((dataRecord.inventory_reduced <= 2) && (rowdata.m_use_use <= 2)) || // Starter, Mash, Boil
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1213 ((dataRecord.inventory_reduced <= 3) && (rowdata.m_use_use == 3)) || // Primary
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1214 ((dataRecord.inventory_reduced <= 5) && (rowdata.m_use_use == 4)) || // Secondary, Teriary
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1215 ((dataRecord.inventory_reduced <= 6) && (rowdata.m_use_use == 5))) { // Bottle
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1216 vstr = rowdata.m_amount_is_weight ? 'gr' : 'ml';
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1217 color = '#ffffff';
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1218 if (value < rowdata.m_amount)
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1219 color = '#ff4040';
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1220 amount = dataAdapter.formatNumber(value * 1000, 'f2') + ' ' + vstr;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1221 return '<span style="margin: 4px; margin-top: 6px; float: right; color: ' + color + ';">' + amount + '</span>';
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1222 } else {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1223 return '<span></span>';
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1224 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1225 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1226 },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1227 { text: '', datafield: 'Edit', columntype: 'button', width: 100, align: 'center',
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1228 cellsrenderer: function() {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1229 return 'Wijzig';
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1230 }, buttonclick: function(row) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1231 miscRow = row;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1232 miscData = $('#miscGrid').jqxGrid('getrowdata', miscRow);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1233 if (dataRecord.stage > 3) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1234 alert('Ingredieënt is al verwerkt.');
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1235 } else if (miscData.m_type == 4) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1236 alert('Brouwzouten wijzigen in de water tab.');
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1237 } else {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1238 console.log('edit button row ' + row);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1239 if (miscData.m_amount_is_weight)
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1240 $('#wm_pmpt_amount').html('Gewicht gram:');
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1241 else
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1242 $('#wm_pmpt_amount').html('Volume ml:');
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1243 $('#wm_name').val(miscData.m_name);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1244 $('#wm_amount').val(miscData.m_amount * 1000);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1245 if ((miscData.m_use_use == 3) || (miscData.m_use_use == 4)) // Primary or Secondary
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1246 $('#wm_time').val(miscData.m_time / 1440);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1247 else
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1248 $('#wm_time').val(miscData.m_time);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1249 $('#wm_use_use').val(miscData.m_use_use);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1250 // show the popup window.
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1251 $('#popupMisc').jqxWindow('open');
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1252 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1253 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1254 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1255 ]
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1256 });
525
8bbc5730aaa8 Code cleanup and manual compress
Michiel Broek <mbroek@mbse.eu>
parents: 518
diff changeset
1257 };
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1258
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1259 // Inline yeasts editor
525
8bbc5730aaa8 Code cleanup and manual compress
Michiel Broek <mbroek@mbse.eu>
parents: 518
diff changeset
1260 var editYeast = function(data) {
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1261 var yeastSource = {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1262 localdata: data.yeasts,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1263 datatype: 'local',
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1264 cache: false,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1265 async: false,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1266 datafields: [
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1267 { name: 'y_name', type: 'string' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1268 { name: 'y_laboratory', type: 'string' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1269 { name: 'y_product_id', type: 'string' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1270 { name: 'y_amount', type: 'float' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1271 { name: 'y_cost', type: 'float' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1272 { name: 'y_type', type: 'int' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1273 { name: 'y_form', type: 'int' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1274 { name: 'y_flocculation', type: 'int' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1275 { name: 'y_min_temperature', type: 'float' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1276 { name: 'y_max_temperature', type: 'float' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1277 { name: 'y_attenuation', type: 'float' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1278 { name: 'y_use', type: 'int' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1279 { name: 'y_cells', type: 'float' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1280 { name: 'y_tolerance', type: 'float' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1281 { name: 'y_inventory', type: 'float' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1282 { name: 'y_avail', type: 'int' }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1283 ],
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1284 addrow: function(rowid, rowdata, position, commit) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1285 console.log('yeast addrow ' + rowid);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1286 commit(true);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1287 },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1288 deleterow: function(rowid, commit) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1289 console.log('yeast deleterow ' + rowid);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1290 commit(true);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1291 },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1292 updaterow: function(rowid, rowdata, commit) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1293 console.log('yeast updaterow ' + rowid);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1294 commit(true);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1295 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1296 },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1297 yeastAdapter = new $.jqx.dataAdapter(yeastSource);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1298
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1299 $('#yeastGrid').jqxGrid({
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1300 width: 1240,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1301 height: 350,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1302 source: yeastAdapter,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1303 theme: theme,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1304 selectionmode: 'singlerow',
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1305 showtoolbar: true,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1306 rendertoolbar: function(toolbar) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1307 var container = $('<div style="overflow: hidden; position: relative; margin: 5px;"></div>');
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1308 toolbar.append(container);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1309 container.append('<div style="float: left; margin-left: 165px;" id="yaddrowbutton"></div>');
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1310 container.append('<div style="float: left; margin-left: 10px; margin-top: 5px;">In voorraad:</div>');
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1311 container.append('<div style="float: left; margin-left: 10px;" id="yinstockbutton"></div>');
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1312 container.append('<input style="float: left; margin-left: 400px;" id="ydeleterowbutton" type="button" value="Verwijder gist" />');
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1313 // add yeast from dropdownlist.
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1314 $('#yaddrowbutton').jqxDropDownList({
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1315 placeHolder: 'Kies gist:',
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1316 theme: theme,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1317 source: yeastlist,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1318 disabled: (dataRecord.stage > 3),
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1319 template: 'primary',
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1320 displayMember: 'name',
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1321 width: 150,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1322 height: 27,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1323 dropDownWidth: 500,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1324 dropDownHeight: 500,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1325 renderer: function(index, label, value) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1326 var datarecord = yeastlist.records[index];
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1327 return datarecord.laboratory + ' ' + datarecord.product_id + ' ' + datarecord.name;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1328 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1329 });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1330 $('#yaddrowbutton').on('select', function(event) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1331 if (event.args) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1332 var datarecord, row = {}, index = event.args.index;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1333 datarecord = yeastlist.records[index];
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1334 row['y_name'] = datarecord.name;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1335 row['y_laboratory'] = datarecord.laboratory;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1336 row['y_product_id'] = datarecord.product_id;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1337 row['y_type'] = datarecord.type;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1338 row['y_form'] = datarecord.form;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1339 row['y_amount'] = 0;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1340 row['y_cost'] = datarecord.cost;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1341 row['y_use'] = 0;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1342 row['y_min_temperature'] = datarecord.min_temperature;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1343 row['y_max_temperature'] = datarecord.max_temperature;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1344 row['y_attenuation'] = datarecord.attenuation;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1345 row['y_flocculation'] = datarecord.flocculation;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1346 row['y_cells'] = datarecord.cells;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1347 row['y_tolerance'] = datarecord.tolerance;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1348 row['y_inventory'] = datarecord.inventory;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1349 $('#yeastGrid').jqxGrid('addrow', null, row);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1350 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1351 calcYeast();
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1352 $('#yaddrowbutton').jqxDropDownList('clearSelection');
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1353 });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1354 $('#yinstockbutton').jqxCheckBox({ theme: theme, height: 27, disabled: (dataRecord.stage > 3) });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1355 $('#yinstockbutton').on('change', function(event) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1356 yeastinstock = event.args.checked;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1357 yeastlist.dataBind();
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1358 });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1359 // delete selected yeast.
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1360 $('#ydeleterowbutton').jqxButton({ template: 'danger', theme: theme, height: 27, width: 150, disabled: (dataRecord.stage > 3) });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1361 $('#ydeleterowbutton').on('click', function() {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1362 var id, rowscount, selectedrowindex = $('#yeastGrid').jqxGrid('getselectedrowindex');
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1363 rowscount = $('#yeastGrid').jqxGrid('getdatainformation').rowscount;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1364 if (selectedrowindex >= 0 && selectedrowindex < rowscount) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1365 id = $('#yeastGrid').jqxGrid('getrowid', selectedrowindex);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1366 $('#yeastGrid').jqxGrid('deleterow', id);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1367 calcYeast();
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1368 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1369 });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1370 },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1371 ready: function() {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1372 calcFermentables();
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1373 showStarter();
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1374 calcYeast();
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1375 $('#jqxTabs').jqxTabs('next');
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1376 },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1377 columns: [
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1378 { text: 'Gist', datafield: 'y_name' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1379 { text: 'Laboratorium', width: 150, datafield: 'y_laboratory' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1380 { text: 'Code', width: 90, datafield: 'y_product_id' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1381 { text: 'Soort', width: 100, datafield: 'y_form',
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1382 cellsrenderer: function(index, datafield, value, defaultvalue, column, rowdata) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1383 return '<span style="margin: 4px; margin-top: 6px; float: left;">' + YeastFormData[value].nl + '</span>';
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1384 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1385 },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1386 { text: 'Min. &deg;C', width: 70, align: 'right', cellsalign: 'right', datafield: 'y_min_temperature' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1387 { text: 'Max. &deg;C', width: 70, align: 'right', cellsalign: 'right', datafield: 'y_max_temperature' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1388 { text: 'Tol. %', width: 60, align: 'right', cellsalign: 'right', datafield: 'y_tolerance',
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1389 cellsrenderer: function(index, datafield, value, defaultvalue, column, rowdata) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1390 var amount = '', color = '#ffffff';
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1391 if (value > 0) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1392 amount = dataAdapter.formatNumber(value, 'f1');
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1393 if (dataRecord.est_abv > value)
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1394 color = '#ff4040';
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1395 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1396 return '<span style="margin: 4px; margin-top: 6px; float: right; color: ' + color + ';">' + amount + '</span>';
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1397 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1398 },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1399 { text: 'Attn. %', width: 70, align: 'right', cellsalign: 'right', datafield: 'y_attenuation', cellsformat: 'f1' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1400 { text: 'Voor', width: 120, datafield: 'y_use',
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1401 cellsrenderer: function(index, datafield, value, defaultvalue, column, rowdata) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1402 return '<span style="margin: 4px; margin-top: 6px; float: left;">' + YeastUseData[value].nl + '</span>';
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1403 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1404 },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1405 { text: 'Hoeveel', datafield: 'y_amount', width: 90, align: 'right',
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1406 cellsrenderer: function(index, datafield, value, defaultvalue, column, rowdata) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1407 var amount = dataAdapter.formatNumber(value * 1000, 'f0') + ' ml';
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1408 if (rowdata.y_form == 0) // Liquid
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1409 amount = dataAdapter.formatNumber(value, 'f0') + ' pk';
515
9d771385a8a0 Added dried yeast form. Pitch rate for Kveik initially set at 0.25. Dried Kveik cells set to 9000000000 cells/gram.
Michiel Broek <mbroek@mbse.eu>
parents: 500
diff changeset
1410 else if (rowdata.y_form == 1 || rowdata.y_form == 6) // Dry
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1411 amount = dataAdapter.formatNumber(value * 1000, 'f1') + ' gr';
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1412 return '<span style="margin: 4px; margin-top: 6px; float: right;">' + amount + '</span>';
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1413 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1414 },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1415 { text: 'Voorraad', datafield: 'y_inventory', width: 90, align: 'right',
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1416 cellsrenderer: function(index, datafield, value, defaultvalue, column, rowdata) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1417 var color, amount;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1418 if (((dataRecord.inventory_reduced <= 3) && (rowdata.y_use == 0)) || // Primary
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1419 ((dataRecord.inventory_reduced <= 4) && (rowdata.y_use == 1)) || // Secondary
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1420 ((dataRecord.inventory_reduced <= 5) && (rowdata.y_use == 2)) || // Tertiary
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1421 ((dataRecord.inventory_reduced <= 6) && (rowdata.y_use == 3))) { // Bottle
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1422 color = '#ffffff';
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1423 if (value < rowdata.y_amount)
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1424 color = '#ff4040';
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1425 amount = dataAdapter.formatNumber(value * 1000, 'f0') + ' ml';
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1426 if (rowdata.y_form == 0) // Liquid
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1427 amount = dataAdapter.formatNumber(value, 'f0') + ' pk';
515
9d771385a8a0 Added dried yeast form. Pitch rate for Kveik initially set at 0.25. Dried Kveik cells set to 9000000000 cells/gram.
Michiel Broek <mbroek@mbse.eu>
parents: 500
diff changeset
1428 else if (rowdata.y_form == 1 || rowdata.y_form == 6) // Dry
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1429 amount = dataAdapter.formatNumber(value * 1000, 'f1') + ' gr';
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1430 return '<span style="margin: 4px; margin-top: 6px; float: right; color: ' + color + ';">' + amount + '</span>';
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1431 } else {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1432 return '<span></span>';
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1433 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1434 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1435 },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1436 { text: '', datafield: 'Edit', columntype: 'button', width: 90, align: 'center',
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1437 cellsrenderer: function() {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1438 return 'Wijzig';
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1439 }, buttonclick: function(row) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1440 if (dataRecord.stage > 3) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1441 alert('Ingredieënt is al verwerkt.');
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1442 } else {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1443 yeastRow = row;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1444 yeastData = $('#yeastGrid').jqxGrid('getrowdata', yeastRow);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1445 if (yeastData.y_form == 0) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1446 $('#wy_pmpt_amount').html('Pak(ken):');
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1447 $('#wy_amount').val(yeastData.y_amount);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1448 $('#wy_amount').jqxNumberInput({ decimalDigits: 0 });
515
9d771385a8a0 Added dried yeast form. Pitch rate for Kveik initially set at 0.25. Dried Kveik cells set to 9000000000 cells/gram.
Michiel Broek <mbroek@mbse.eu>
parents: 500
diff changeset
1449 } else if (yeastData.y_form == 1 || yeastData.y_form == 6) {
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1450 $('#wy_pmpt_amount').html('Gewicht gram:');
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1451 $('#wy_amount').val(yeastData.y_amount * 1000);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1452 $('#wy_amount').jqxNumberInput({ decimalDigits: 1 });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1453 } else {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1454 $('#wy_pmpt_amount').html('Volume ml:');
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1455 $('#wy_amount').val(yeastData.y_amount * 1000);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1456 $('#wy_amount').jqxNumberInput({ decimalDigits: 0 });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1457 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1458 $('#wy_name').val(yeastData.y_name);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1459 $('#wy_laboratory').val(yeastData.y_laboratory);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1460 $('#wy_product_id').val(yeastData.y_product_id);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1461 $('#wy_use').val(yeastData.y_use);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1462 // show the popup window.
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1463 $('#popupYeast').jqxWindow('open');
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1464 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1465 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1466 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1467 ]
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1468 });
525
8bbc5730aaa8 Code cleanup and manual compress
Michiel Broek <mbroek@mbse.eu>
parents: 518
diff changeset
1469 };
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1470
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1471 // inline mash editor
525
8bbc5730aaa8 Code cleanup and manual compress
Michiel Broek <mbroek@mbse.eu>
parents: 518
diff changeset
1472 var editMash = function(data) {
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1473 var mashSource = {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1474 localdata: data.mashs,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1475 datatype: 'local',
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1476 cache: false,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1477 async: false,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1478 datafields: [
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1479 { name: 'step_name', type: 'string' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1480 { name: 'step_type', type: 'int' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1481 { name: 'step_infuse_amount', type: 'float' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1482 { name: 'step_temp', type: 'float' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1483 { name: 'step_time', type: 'float' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1484 { name: 'step_thickness', type: 'float' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1485 { name: 'ramp_time', type: 'float' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1486 { name: 'end_temp', type: 'float' }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1487 ],
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1488 addrow: function(rowid, rowdata, position, commit) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1489 console.log('mash addrow ' + rowid);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1490 commit(true);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1491 },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1492 deleterow: function(rowid, commit) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1493 console.log('mash deleterow ' + rowid);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1494 commit(true);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1495 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1496 },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1497 mashAdapter = new $.jqx.dataAdapter(mashSource, {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1498 beforeLoadComplete: function(records) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1499 mash_infuse = 0;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1500 var i, row, data = new Array();
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1501 for (i = 0; i < records.length; i++) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1502 row = records[i];
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1503 if (row.step_type == 0) // Infusion
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1504 mash_infuse += parseFloat(row.step_infuse_amount);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1505 row.step_thickness = 0; // Init this field.
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1506 data.push(row);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1507 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1508 },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1509 });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1510 $('#mashGrid').jqxGrid({
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1511 width: 1240,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1512 height: 400,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1513 source: mashAdapter,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1514 theme: theme,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1515 selectionmode: 'singlerow',
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1516 showtoolbar: true,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1517 rendertoolbar: function(toolbar) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1518 var container = $('<div style="overflow: hidden; position: relative; margin: 5px;"></div>');
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1519 toolbar.append(container);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1520 container.append('<input style="float: left; margin-left: 165px;" id="saddrowbutton" type="button" value="Nieuwe stap" />');
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1521 container.append('<input style="float: left; margin-left: 565px;" id="sdeleterowbutton" type="button" value="Verwijder stap" />');
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1522 $('#saddrowbutton').jqxButton({ template: 'primary', theme: theme, height: 27, width: 150, disabled: (dataRecord.stage > 3) });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1523 $('#saddrowbutton').on('click', function() {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1524 var row = {}, rowscount = $('#mashGrid').jqxGrid('getdatainformation').rowscount;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1525 row['step_name'] = 'Stap ' + (rowscount + 1);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1526 if (rowscount > 0) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1527 row['step_type'] = 1;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1528 } else {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1529 row['step_type'] = 0;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1530 row['step_infuse_amount'] = 15;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1531 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1532 row['step_temp'] = 62.0;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1533 row['step_time'] = 20.0;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1534 row['step_thickness'] = 0;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1535 row['ramp_time'] = 1.0;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1536 row['end_temp'] = 62.0;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1537 $('#mashGrid').jqxGrid('addrow', null, row);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1538 });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1539 // delete selected step.
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1540 $('#sdeleterowbutton').jqxButton({ template: 'danger', theme: theme, height: 27, width: 150, disabled: (dataRecord.stage > 3) });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1541 $('#sdeleterowbutton').on('click', function() {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1542 var rowscount, id, selectedrowindex = $('#mashGrid').jqxGrid('getselectedrowindex');
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1543 rowscount = $('#mashGrid').jqxGrid('getdatainformation').rowscount;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1544 if (selectedrowindex >= 0 && selectedrowindex < rowscount) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1545 id = $('#mashGrid').jqxGrid('getrowid', selectedrowindex);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1546 $('#mashGrid').jqxGrid('deleterow', id);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1547 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1548 });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1549 },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1550 ready: function() {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1551 calcInit();
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1552 calcMash();
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1553 $('#jqxLoader').jqxLoader('close');
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1554 $('#jqxTabs').jqxTabs('first');
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1555 },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1556 columns: [
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1557 { text: 'Stap naam', datafield: 'step_name' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1558 { text: 'Stap type', datafield: 'step_type', width: 175,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1559 cellsrenderer: function(index, datafield, value, defaultvalue, column, rowdata) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1560 return '<span style="margin: 4px; margin-top: 6px; float: left;">' + MashStepTypeData[value].nl + '</span>';
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1561 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1562 },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1563 { text: 'Start &deg;C', datafield: 'step_temp', width: 90, align: 'right', cellsalign: 'right', cellsformat: 'f1' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1564 { text: 'Eind &deg;C', datafield: 'end_temp', width: 90, align: 'right', cellsalign: 'right', cellsformat: 'f1' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1565 { text: 'Rust min.', datafield: 'step_time', width: 90, align: 'right', cellsalign: 'right' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1566 { text: 'Stap min.', datafield: 'ramp_time', width: 90, align: 'right', cellsalign: 'right' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1567 { text: 'Infuse L.', datafield: 'step_infuse_amount', width: 90, align: 'right', cellsalign: 'right', cellsformat: 'f1' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1568 { text: 'L/Kg.', datafield: 'step_thickness', width: 90, align: 'right', cellsalign: 'right', cellsformat: 'f2' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1569 { text: '', datafield: 'Edit', columntype: 'button', width: 100, align: 'center',
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1570 cellsrenderer: function() {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1571 return 'Wijzig';
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1572 }, buttonclick: function(row) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1573 if (dataRecord.stage > 3) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1574 alert('Het maichen is al gedaan.');
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1575 } else {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1576 mashRow = row;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1577 mashData = $('#mashGrid').jqxGrid('getrowdata', mashRow);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1578 $('#wstep_name').val(mashData.step_name);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1579 $('#wstep_type').val(mashData.step_type);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1580 $('#wstep_infuse_amount').val(mashData.step_infuse_amount);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1581 $('#wstep_temp').val(mashData.step_temp);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1582 $('#wend_temp').val(mashData.end_temp);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1583 $('#wstep_time').val(mashData.step_time);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1584 $('#wramp_time').val(mashData.ramp_time);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1585 if (mashData.step_type == 0) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1586 $('#wstep_infuse_amount').show();
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1587 $('#wstep_pmpt').show();
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1588 } else {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1589 $('#wstep_infuse_amount').hide();
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1590 $('#wstep_pmpt').hide();
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1591 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1592 // show the popup window.
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1593 $('#popupMash').jqxWindow('open');
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1594 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1595 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1596 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1597 ]
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1598 });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1599 };
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1600
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1601 /*
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1602 * Remove the top menu so that we MUST use the buttons to leave the editor.
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1603 */
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1604 $('#jqxMenu').jqxMenu('destroy');
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1605 console.log('record:' + my_record + ' return:' + my_return + ' theme:' + theme);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1606 $('#jqxLoader').jqxLoader({
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1607 width: 250,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1608 height: 150,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1609 isModal: true,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1610 text: 'Laden product ...',
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1611 theme: theme
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1612 });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1613
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1614 /*
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1615 * Generic functions
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1616 */
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1617 function calcSupplies() {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1618 if (dataRecord.inventory_reduced > 6) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1619 $('#ok_pmpt').hide();
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1620 return;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1621 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1622 if (ok_fermentables && ok_hops && ok_miscs && ok_yeasts && ok_waters)
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1623 $('#ok_supplies').html("<img src='images/dialog-ok-apply.png'>");
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1624 else
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1625 $('#ok_supplies').html("<img src='images/dialog-error.png'>");
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1626 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1627
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1628 function calcPercentages() {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1629
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1630 console.log('calcPercentages()');
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1631 var tw = 0, rowdata, percentage, rowscount = $('#fermentableGrid').jqxGrid('getdatainformation').rowscount;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1632 if (rowscount > 1) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1633 for (i = 0; i < rowscount; i++) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1634 rowdata = $('#fermentableGrid').jqxGrid('getrowdata', i);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1635 if (rowdata.f_added < 4)
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1636 tw += Round(rowdata.f_amount, 3);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1637 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1638 tw = Round(tw, 3);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1639
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1640 for (i = 0; i < rowscount; i++) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1641 rowdata = $('#fermentableGrid').jqxGrid('getrowdata', i);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1642 if (rowdata.f_added < 4) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1643 percentage = Round(rowdata.f_amount / tw * 100, 1);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1644 $('#fermentableGrid').jqxGrid('setcellvalue', i, 'f_percentage', percentage);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1645 } else {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1646 $('#fermentableGrid').jqxGrid('setcellvalue', i, 'f_percentage', 0);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1647 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1648 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1649 } else {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1650 $('#fermentableGrid').jqxGrid('setcellvalue', 0, 'f_percentage', 100);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1651 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1652 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1653
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1654 /*
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1655 * All calculations that depend on changes in the fermentables,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1656 * volumes and equipments.
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1657 */
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1658 function calcFermentables() {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1659
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1660 var sugarsf = 0, // fermentable sugars mash + boil
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1661 sugarsm = 0, // fermentable sugars in mash
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1662 vol = 0, // Volume sugars after boil
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1663 addedS = 0, // Added sugars after boil
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1664 addedmass = 0, // Added mass after boil
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1665 mvol = 0, // mash volume
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1666 colort = 0, // Colors srm * vol totals
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1667 colorh = 0, // Colors ebc * vol * kt
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1668 colorn = 0, // Colors ebc * pt * pct
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1669 my_100 = false,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1670 mashtime = 0, // Total mash time
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1671 mashtemp = 0, // Average mash temperature
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1672 bv = 0.925, // Bierverlies rendement
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1673 sr = 0.95, // Mash en spoel rendement
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1674 lintner = 0, // Total recipe lintner
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1675 i, row, rows, org, timem, aboil_volume, spoelw, ogx, topw, s = 0, d, v, x,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1676 sug, alc, pt, cw, color, scolor, fig;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1677
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1678 /* Init global variables */
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1679 psugar = 0;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1680 pcara = 0;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1681 mashkg = 0;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1682 ok_fermentables = 1; // All is in stock.
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1683 ok_yeasts = 1;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1684
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1685 if ((rows = $('#mashGrid').jqxGrid('getrows'))) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1686 for (i = 0; i < rows.length; i++) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1687 row = rows[i];
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1688 if (row.step_type == 0) // Infusion
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1689 mvol += parseFloat(row.step_infuse_amount);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1690 if (row.step_temp <= 75) { // Ignore mashout
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1691 timem = row.step_time + row.ramp_time;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1692 mashtime += timem;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1693 mashtemp += timem * row.step_temp;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1694 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1695 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1696 if (mashtime > 5)
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1697 mashtime -= 5; //Correct last ramp > 75
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1698 mashtemp = Round(mashtemp / mashtime, 2);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1699 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1700
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1701 if (!(rows = $('#fermentableGrid').jqxGrid('getrows'))) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1702 return; // grid not yet loaded.
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1703 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1704
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1705 for (i = 0; i < rows.length; i++) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1706 row = rows[i];
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1707 if (row.f_adjust_to_total_100)
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1708 my_100 = true;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1709 if (row.f_type == 1 && row.f_added < 4) // Sugar
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1710 psugar += row.f_percentage;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1711 if (row.f_graintype == 2 && row.f_added < 4) // Crystal
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1712 pcara += row.f_percentage;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1713 d = row.f_amount * (row.f_yield / 100) * (1 - row.f_moisture / 100);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1714 if (row.f_added == 0) { // Mash
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1715 if (mvol > 0) { // Only if mash already known.
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1716 mvol += row.f_amount * row.f_moisture / 100;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1717 s += d;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1718 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1719 d = parseFloat(dataRecord.efficiency) / 100 * d;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1720 sugarsm += d;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1721 mashkg += parseFloat(row.f_amount);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1722 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1723 if (row.f_added == 0 || row.f_added == 1) // Mash or Boil
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1724 sugarsf += d;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1725 if (row.f_added == 2 || row.f_added == 3) { // Fermentation or lagering
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1726 x = (row.f_yield / 100) * (1 - row.f_moisture / 100);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1727 addedS += row.f_amount * x;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1728 addedmass += row.f_amount;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1729 vol += (x * sugardensity + (1 - x) * 1) * row.f_amount;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1730 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1731 if (row.f_added < 4) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1732 colort += row.f_amount * ebc_to_srm(row.f_color);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1733 colorh += row.f_amount * row.f_color * get_kt(row.f_color);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1734 colorn += (row.f_percentage / 100) * row.f_color; // For 8.6 Pt wort.
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1735 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1736 if (fermentableInit) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1737 if (row.f_added == 4) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1738 $('#bottle_priming_total').val(row.f_amount * 1000); // Prevent clearing
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1739 $('#bottle_priming_sugar').jqxDropDownList('selectItem', row.f_name);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1740 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1741 if (row.f_added == 5) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1742 $('#keg_priming_total').val(row.f_amount * 1000);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1743 $('#keg_priming_sugar').jqxDropDownList('selectItem', row.f_name);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1744 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1745 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1746 // Check supplies.
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1747 if ((((dataRecord.inventory_reduced <= 2) && (row.f_added <= 1)) || // Mash or boil
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1748 ((dataRecord.inventory_reduced <= 3) && (row.f_added == 2)) || // Primary
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1749 ((dataRecord.inventory_reduced <= 5) && (row.f_added == 3)) || // Secondary or Tertiary
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1750 ((dataRecord.inventory_reduced <= 6) && (row.f_added == 4)) || // Bottle
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1751 ((dataRecord.inventory_reduced <= 6) && (row.f_added == 5))) && row.f_inventory < row.f_amount) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1752 ok_fermentables = 0;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1753 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1754 if (row.f_added == 0 && (row.f_type == 0 || row.f_type == 4) && row.f_color < 50) { // Mash and Grain/Adjunct and Color < 50
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1755 lintner += row.f_diastatic_power * row.f_amount;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1756 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1757 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1758 fermentableInit = 0;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1759 $('#ferm_lintner').val(Math.round(parseFloat(lintner / mashkg)));
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1760 $('#mash_kg').val(mashkg);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1761 console.log('calcFermentables() supplies:' + ok_fermentables + ' moutsuiker:' + sugarsm + '/' + sugarsf);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1762 to_100 = my_100;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1763 if (to_100) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1764 $('#wf_amount').jqxNumberInput({ width: 90, readOnly: true, spinButtons: false });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1765 } else {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1766 $('#wf_amount').jqxNumberInput({ width: 110, readOnly: false, spinButtons: true });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1767 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1768
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1769 if (mvol > 0) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1770 v = s / sugardensity + mvol;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1771 s = 1000 * s / (v * 10); //deg. Plato
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1772 est_mash_sg = Round(plato_to_sg(s), 5);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1773 $('#est_mash_sg').val(est_mash_sg);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1774 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1775
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1776 // Estimate total recipe OG.
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1777 dataRecord.est_og = estimate_sg(sugarsf + addedS, parseFloat(dataRecord.batch_size));
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1778 $('#est_og').val(dataRecord.est_og);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1779 $('#est_og2').val(dataRecord.est_og);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1780 org = dataRecord.est_og;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1781
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1782 // Estimate SG in kettle after boil
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1783 aboil_sg = estimate_sg(sugarsf, parseFloat(dataRecord.batch_size));
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1784 $('#est_og3').val(aboil_sg);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1785
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1786 // Estimate SG in kettle before boil
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1787 preboil_sg = estimate_sg(sugarsm, parseFloat(dataRecord.boil_size));
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1788 $('#est_pre_sg').val(preboil_sg);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1789
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1790 // Recalculate volumes.
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1791 aboil_volume = parseFloat(dataRecord.batch_size);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1792 if (dataRecord.brew_aboil_volume > 0)
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1793 aboil_volume = dataRecord.brew_aboil_volume / 1.04; // volume @ 20 degrees
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1794 if (dataRecord.brew_fermenter_tcloss == 0) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1795 dataRecord.brew_fermenter_tcloss = dataRecord.eq_trub_chiller_loss;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1796 $('#brew_fermenter_tcloss').val(dataRecord.brew_fermenter_tcloss);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1797 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1798 dataRecord.brew_fermenter_volume = aboil_volume - dataRecord.brew_fermenter_tcloss + dataRecord.brew_fermenter_extrawater;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1799 $('#brew_fermenter_volume').val(dataRecord.brew_fermenter_volume);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1800 // Estimated needed sparge water corrected for the temperature.
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1801 spoelw = (dataRecord.boil_size - mash_infuse + (mashkg * my_grain_absorbtion) + dataRecord.eq_lauter_deadspace) * 1.03;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1802 $('#brew_sparge_est').val(spoelw);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1803 // Calculate SG in fermenter
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1804 ogx = dataRecord.brew_aboil_sg;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1805 if (ogx < 1.002)
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1806 ogx = aboil_sg;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1807 topw = dataRecord.brew_fermenter_extrawater;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1808
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1809 if (dataRecord.brew_fermenter_volume > 0) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1810 sug = sg_to_plato(ogx) * dataRecord.brew_fermenter_volume * ogx / 100; //kg of sugar in
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1811 sug += addedS; //kg
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1812
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1813 if ((dataRecord.brew_fermenter_volume * ogx + addedmass) > 0) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1814 pt = 100 * sug / (dataRecord.brew_fermenter_volume * ogx + addedmass + topw);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1815 dataRecord.brew_fermenter_sg = Round(plato_to_sg(pt), 4);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1816 $('#brew_fermenter_sg').val(dataRecord.brew_fermenter_sg);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1817 // color
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1818 if (dataRecord.color_method == 4) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1819 dataRecord.brew_fermenter_color = Math.round(((pt / 8.6) * colorn) + (dataRecord.boil_time / 60));
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1820 } else if (dataRecord.color_method == 3) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1821 dataRecord.brew_fermenter_color = Math.round((4.46 * bv * sr) / (aboil_volume + topw) * colorh);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1822 } else {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1823 cw = colort / (aboil_volume + topw) * 8.34436;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1824 dataRecord.brew_fermenter_color = kw_to_ebc(dataRecord.color_method, cw);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1825 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1826 $('#brew_fermenter_color').val(dataRecord.brew_fermenter_color);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1827 scolor = ebc_to_color(dataRecord.brew_fermenter_color);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1828 $('#bcolorf').show();
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1829 document.getElementById('bcolorf').style.background = scolor;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1830 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1831 } else {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1832 // Negative volume
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1833 dataRecord.brew_fermenter_sg = dataRecord.brew_fermenter_color = 0;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1834 $('#brew_fermenter_sg').val(0);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1835 $('#brew_fermenter_color').val(0);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1836 $('#bcolorf').hide();
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1837 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1838
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1839 // Color of the wort
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1840 if (dataRecord.color_method == 4) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1841 color = Math.round(((sg_to_plato(dataRecord.est_og) / 8.6) * colorn) + (dataRecord.boil_time / 60));
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1842 } else if (dataRecord.color_method == 3) { // Hans Halberstadt
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1843 color = Math.round((4.46 * bv * sr) / parseFloat(dataRecord.batch_size) * colorh);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1844 } else {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1845 cw = colort / parseFloat(dataRecord.batch_size) * 8.34436;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1846 color = kw_to_ebc(dataRecord.color_method, cw);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1847 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1848 dataRecord.est_color = color;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1849 $('#est_color').val(color);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1850 $('#est_color2').val(color);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1851 scolor = ebc_to_color(color);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1852 document.getElementById('bcolor').style.background = scolor;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1853 document.getElementById('bcolor2').style.background = scolor;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1854
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1855 // Progress bars
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1856 pmalts = mashkg / dataRecord.eq_mash_max * 100;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1857 $('#perc_malts').jqxProgressBar('val', pmalts);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1858 $('#perc_sugars').jqxProgressBar('val', psugar);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1859 $('#perc_cara').jqxProgressBar('val', pcara);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1860 calcStage();
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1861
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1862 // Calculate estimated svg.
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1863 svg = 0; // default.
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1864 initcells = 0;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1865 rows = $('#yeastGrid').jqxGrid('getrows');
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1866 for (i = 0; i < rows.length; i++) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1867 row = rows[i];
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1868 if (row.y_use == 0) { // Primary
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1869 if (parseFloat(row.y_attenuation) > svg)
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1870 svg = parseFloat(row.y_attenuation); // Take the highest if multiple yeasts.
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1871 if (row.y_form == 0)
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1872 initcells += (parseFloat(row.y_cells) / 1000000000) * parseFloat(row.y_amount) * (dataRecord.starter_viability / 100);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1873 else
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1874 initcells += (parseFloat(row.y_cells) / 1000000) * parseFloat(row.y_amount);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1875 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1876 // TODO: brett in secondary ??
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1877 if ((((dataRecord.inventory_reduced <= 3) && (row.y_use == 0)) || // Primary
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1878 ((dataRecord.inventory_reduced <= 4) && (row.y_use == 1)) || // Secondary
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1879 ((dataRecord.inventory_reduced <= 5) && (row.y_use == 2)) || // Tertiary
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1880 ((dataRecord.inventory_reduced <= 6) && (row.y_use == 3))) && // Bottle
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1881 (row.y_inventory < row.y_amount)) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1882 ok_yeasts = 0;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1883 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1884 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1885 calcSupplies();
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1886 if (svg == 0)
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1887 svg = 77;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1888
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1889 if ((mashkg > 0) && (mash_infuse > 0) && (mashtime > 0) && (mashtemp > 0)) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1890 dataRecord.est_fg = estimate_fg(psugar, pcara, mash_infuse / mashkg, mashtime, mashtemp, svg, dataRecord.est_og);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1891 } else {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1892 dataRecord.est_fg = estimate_fg(psugar, pcara, 0, 0, 0, svg, dataRecord.est_og);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1893 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1894 $('#est_fg').val(dataRecord.est_fg);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1895 $('#est_fg2').val(dataRecord.est_fg);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1896 $('#est_fg3').val(dataRecord.est_fg);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1897 fig = dataRecord.est_fg;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1898
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1899 dataRecord.est_abv = abvol(dataRecord.est_og, dataRecord.est_fg);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1900 $('#est_abv').val(dataRecord.est_abv);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1901 $('#est_abv2').val(dataRecord.est_abv);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1902
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1903 // Calculate the final svg if available use the real value.
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1904 if ((dataRecord.stage >= 6) && (dataRecord.fg > 0.990) && (dataRecord.fg < dataRecord.brew_fermenter_sg)) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1905 svg = 100 * (dataRecord.brew_fermenter_sg - dataRecord.fg) / (dataRecord.brew_fermenter_sg - 1);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1906 org = dataRecord.brew_fermenter_sg;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1907 fig = dataRecord.fg;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1908 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1909
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1910 $('#yeast_cells').val(initcells);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1911 $('#need_cells').val(getNeededYeastCells());
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1912
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1913 // Calculate the calories in kcal/l (from brouwhulp)
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1914 alc = 1881.22 * fig * (org - fig) / (1.775 - org);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1915 sug = 3550 * fig * (0.1808 * org + 0.8192 * fig - 1.0004);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1916 $('#kcal').val(Math.round((alc + sug) / (12 * 0.0295735296)));
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1917 };
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1918
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1919 function calcMash() {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1920
484
2083c274b283 In the product editor mash tab, display the total mash volume and the total mash time.
Michiel Broek <mbroek@mbse.eu>
parents: 479
diff changeset
1921 var h, m, infused = 0, mashtime = 0, mashvol = 0, i, row;
2083c274b283 In the product editor mash tab, display the total mash volume and the total mash time.
Michiel Broek <mbroek@mbse.eu>
parents: 479
diff changeset
1922
2083c274b283 In the product editor mash tab, display the total mash volume and the total mash time.
Michiel Broek <mbroek@mbse.eu>
parents: 479
diff changeset
1923 if ((rows = $('#mashGrid').jqxGrid('getrows')) && (mashkg > 0)) {
2083c274b283 In the product editor mash tab, display the total mash volume and the total mash time.
Michiel Broek <mbroek@mbse.eu>
parents: 479
diff changeset
1924 for (i = 0; i < rows.length; i++) {
2083c274b283 In the product editor mash tab, display the total mash volume and the total mash time.
Michiel Broek <mbroek@mbse.eu>
parents: 479
diff changeset
1925 row = $('#mashGrid').jqxGrid('getrowdata', i);
2083c274b283 In the product editor mash tab, display the total mash volume and the total mash time.
Michiel Broek <mbroek@mbse.eu>
parents: 479
diff changeset
1926 if (row.step_type == 0) // Infusion
2083c274b283 In the product editor mash tab, display the total mash volume and the total mash time.
Michiel Broek <mbroek@mbse.eu>
parents: 479
diff changeset
1927 infused += row.step_infuse_amount;
2083c274b283 In the product editor mash tab, display the total mash volume and the total mash time.
Michiel Broek <mbroek@mbse.eu>
parents: 479
diff changeset
1928 mashtime += row.step_time + row.ramp_time;
2083c274b283 In the product editor mash tab, display the total mash volume and the total mash time.
Michiel Broek <mbroek@mbse.eu>
parents: 479
diff changeset
1929 $('#mashGrid').jqxGrid('setcellvalue', i, 'step_thickness', infused / mashkg);
2083c274b283 In the product editor mash tab, display the total mash volume and the total mash time.
Michiel Broek <mbroek@mbse.eu>
parents: 479
diff changeset
1930 }
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1931 }
484
2083c274b283 In the product editor mash tab, display the total mash volume and the total mash time.
Michiel Broek <mbroek@mbse.eu>
parents: 479
diff changeset
1932 mashvol = mashkg * MaltVolume + infused;
2083c274b283 In the product editor mash tab, display the total mash volume and the total mash time.
Michiel Broek <mbroek@mbse.eu>
parents: 479
diff changeset
1933 $('#est_mashvol').val(mashvol);
2083c274b283 In the product editor mash tab, display the total mash volume and the total mash time.
Michiel Broek <mbroek@mbse.eu>
parents: 479
diff changeset
1934 h = Math.floor(mashtime / 60);
2083c274b283 In the product editor mash tab, display the total mash volume and the total mash time.
Michiel Broek <mbroek@mbse.eu>
parents: 479
diff changeset
1935 m = Math.floor(mashtime - (h * 60));
2083c274b283 In the product editor mash tab, display the total mash volume and the total mash time.
Michiel Broek <mbroek@mbse.eu>
parents: 479
diff changeset
1936 if (h < 10)
2083c274b283 In the product editor mash tab, display the total mash volume and the total mash time.
Michiel Broek <mbroek@mbse.eu>
parents: 479
diff changeset
1937 h = '0' + h;
2083c274b283 In the product editor mash tab, display the total mash volume and the total mash time.
Michiel Broek <mbroek@mbse.eu>
parents: 479
diff changeset
1938 if (m < 10)
2083c274b283 In the product editor mash tab, display the total mash volume and the total mash time.
Michiel Broek <mbroek@mbse.eu>
parents: 479
diff changeset
1939 m = '0' + m;
2083c274b283 In the product editor mash tab, display the total mash volume and the total mash time.
Michiel Broek <mbroek@mbse.eu>
parents: 479
diff changeset
1940 $('#est_mashtime').val(h + ':' + m);
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1941 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1942
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1943 /*
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1944 * Change OG of recipe but keep the water volumes.
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1945 */
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1946 function calcFermentablesFromOG(OG) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1947
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1948 console.log('calcFermentablesFromOG(' + OG + ')');
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1949 var amount, row, d, i, sug, tot = 0, totmass = 0, rowscount, efficiency = parseFloat($('#efficiency').jqxNumberInput('decimal'));
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1950 sug = sg_to_plato(OG) * parseFloat($('#batch_size').jqxNumberInput('decimal')) * OG / 100; //total amount of sugars in kg
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1951 rowscount = $('#fermentableGrid').jqxGrid('getdatainformation').rowscount;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1952
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1953 for (i = 0; i < rowscount; i++) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1954 row = $('#fermentableGrid').jqxGrid('getrowdata', i);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1955 if (row.f_added < 4) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1956 d = row.f_percentage / 100 * (row.f_yield / 100) * (1 - row.f_moisture / 100);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1957 if (row.f_added == 0) // Mash
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1958 d = efficiency / 100 * d;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1959 tot += d;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1960 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1961 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1962 if (tot)
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1963 totmass = Round(sug / tot, 3);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1964
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1965 if (totmass) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1966 for (i = 0; i < rowscount; i++) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1967 row = $('#fermentableGrid').jqxGrid('getrowdata', i);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1968 if (row.f_added < 4) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1969 amount = Math.round(row.f_percentage * 10 * totmass) / 1000;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1970 $('#fermentableGrid').jqxGrid('setcellvalue', i, 'f_amount', amount);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1971 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1972 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1973 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1974 };
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1975
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1976 function getNeededYeastCells() {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1977
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1978 var plato, volume, sg = dataRecord.brew_fermenter_sg;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1979 if (sg <= 1.0001 && dataRecord.fg > 1.000)
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1980 sg = dataRecord.fg;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1981 else if (sg <= 1.0001)
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1982 sg = dataRecord.est_og;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1983 plato = sg_to_plato(sg);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1984
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1985 volume = dataRecord.brew_fermenter_volume;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1986 if (volume <= 0)
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1987 volume = dataRecord.batch_size - dataRecord.eq_trub_chiller_loss;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1988
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1989 return pitchrate * volume * plato;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1990 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1991
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1992 function hopFlavourContribution(bt, vol, use, amount) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1993 var result;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1994
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1995 if (use == 1) { // First wort
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1996 result = 0.15; // assume 15% flavourcontribution for fwh
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1997 } else if (bt > 50) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1998 result = 0.10; // assume 10% flavourcontribution as a minimum
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
1999 } else {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2000 result = 15.25 / (6 * Math.sqrt(2 * Math.PI)) * Math.exp(-0.5 * Math.pow((bt - 21) / 6, 2));
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2001 if (result < 0.10)
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2002 result = 0.10; // assume 10% flavourcontribution as a minimum
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2003 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2004 return (result * amount * 1000) / vol;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2005 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2006
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2007 function hopAromaContribution(bt, vol, use, amount) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2008 var result = 0;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2009
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2010 if (use == 5) { // Dry hop
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2011 result = 1.33;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2012 } else if (bt > 20) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2013 result = 0;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2014 } else if (bt > 7.5) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2015 result = 10.03 / (4 * Math.sqrt(2 * Math.PI)) * Math.exp(-0.5 * Math.pow((bt - 7.5) / 4, 2));
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2016 } else if (use == 2) { // Boil
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2017 result = 1;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2018 } else if (use == 3) { // Aroma
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2019 result = 1.2;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2020 } else if (use == 4) { // Whirlpool
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2021 result = 1.2;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2022 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2023 return (result * amount * 1000) / vol;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2024 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2025
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2026 function calcIBUs() {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2027 var total_ibus = 0, ferm_ibus = 0, rows = {}, i, row;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2028 hop_aroma = hop_flavour = 0;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2029 if (!(rows = $('#hopGrid').jqxGrid('getrows'))) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2030 return;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2031 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2032 ok_hops = 1;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2033 for (i = 0; i < rows.length; i++) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2034 row = rows[i];
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2035 total_ibus += toIBU(row.h_useat, row.h_form, preboil_sg, parseFloat(dataRecord.batch_size),
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2036 parseFloat(row.h_amount), parseFloat(row.h_time), parseFloat(row.h_alpha), dataRecord.ibu_method);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2037 ferm_ibus += toIBU(row.h_useat, row.h_form, preboil_sg,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2038 parseFloat(dataRecord.brew_fermenter_volume) + parseFloat(dataRecord.brew_fermenter_tcloss),
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2039 parseFloat(row.h_amount), parseFloat(row.h_time), parseFloat(row.h_alpha), dataRecord.ibu_method);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2040 hop_flavour += hopFlavourContribution(parseFloat(row.h_time), parseFloat(dataRecord.batch_size),
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2041 row.h_useat, parseFloat(row.h_amount));
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2042 hop_aroma += hopAromaContribution(parseFloat(row.h_time), parseFloat(dataRecord.batch_size),
469
3d532097860d Code optimisation for compressed javascript in the product editor
Michiel Broek <mbroek@mbse.eu>
parents: 464
diff changeset
2043 row.h_useat, parseFloat(row.h_amount));
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2044 if ((((dataRecord.inventory_reduced <= 2) && (row.h_useat <= 4)) || // Mash, FW, Boil, Aroma, Whirlpool
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2045 ((dataRecord.inventory_reduced <= 6) && (row.h_useat == 5))) && // Dry-hop
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2046 (row.h_inventory < row.h_amount))
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2047 ok_hops = 0;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2048 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2049 total_ibus = Math.round(total_ibus * 10) / 10;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2050 ferm_ibus = Math.round(ferm_ibus * 10) / 10;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2051 hop_flavour = Math.round(hop_flavour * 1000 / 5) / 10;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2052 hop_aroma = Math.round(hop_aroma * 1000 / 6) / 10;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2053 if (hop_flavour > 100)
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2054 hop_flavour = 100;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2055 if (hop_aroma > 100)
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2056 hop_aroma = 100;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2057 console.log('calcIBUs(): ' + total_ibus + ' flavour: ' + hop_flavour + ' aroma: ' + hop_aroma +
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2058 ' fermenter:' + ferm_ibus + ' supplies:' + ok_hops);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2059 dataRecord.est_ibu = total_ibus;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2060 $('#est_ibu').val(total_ibus);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2061 $('#est_ibu2').val(total_ibus);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2062 $('#hop_flavour').jqxProgressBar('val', hop_flavour);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2063 $('#hop_aroma').jqxProgressBar('val', hop_aroma);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2064 $('#brew_fermenter_ibu').val(ferm_ibus);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2065 calcStage();
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2066 calcSupplies();
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2067 };
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2068
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2069 /*
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2070 * http://braukaiser.com/blog/blog/2012/11/03/estimating-yeast-growth/
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2071 *
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2072 * stype: 0=stirred, 1=shaken, 2=simple
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2073 * totcells: initial cells
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2074 * egrams: gram extract
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2075 */
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2076 function getGrowthRate(stype, totcells, egrams) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2077
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2078 /* Cells per grams extract (B/g) */
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2079 var cpe = totcells / egrams;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2080
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2081 if (cpe > 3.5)
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2082 return 0; // no growth
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2083 if (stype == 2)
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2084 return 0.4; // simple starter
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2085 if (stype == 1)
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2086 return 0.62; // shaken starter
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2087 if (cpe <= 1.4) // stirred starter
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2088 return 1.4;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2089 return 2.33 - (.67 * cpe);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2090 };
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2091
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2092 function calcStep(svol, stype, start) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2093
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2094 var gperpoint = 2.72715, //number of grams of extract per point of starter gravity per liter
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2095 prate = start / svol * 1000,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2096 irate = Round(prate, 1),
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2097 egrams = (dataRecord.starter_sg - 1) * svol * gperpoint,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2098 grate = getGrowthRate(stype, start, egrams),
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2099 ncells = Round(egrams * grate, 1),
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2100 totcells = parseFloat(ncells) + start;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2101
495
fdbb6bfae569 Disabled some console.log items.
Michiel Broek <mbroek@mbse.eu>
parents: 490
diff changeset
2102 //console.log('svol:' + svol + ' start:' + start + ' irate:' + irate + ' egrams:' + egrams + ' grate:' + grate + ' ncells:' + ncells);
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2103 return {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2104 svol: svol,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2105 irate: irate,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2106 prate: Round(prate, 1),
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2107 ncells: ncells,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2108 totcells: totcells,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2109 growf: Round(ncells / start, 2)
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2110 };
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2111 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2112
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2113 /*
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2114 * Calculate all starter steps.
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2115 * stype: final starter type: 0 = stirred, 1 = shaked, 2 = simple.
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2116 * start: initial cells in billions
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2117 * needed: needed cells in billions
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2118 *
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2119 * result: all values updated.
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2120 */
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2121 function calcSteps(stype, start, needed) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2122
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2123 var uvols = [20, 40, 60, 80, 100, 150, 200, 250, 375, 500, 625, 750, 875, 1000, 1250, 1500, 2000, 2500, 3000, 4000, 5000],
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2124 mvols = uvols.length, svol = 0, lasti = 0, result = {}, i;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2125
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2126 /*
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2127 * If no values are set, auto calculate the starter.
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2128 */
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2129 if ((parseFloat($('#prop1_volume').jqxNumberInput('decimal')) + parseFloat($('#prop2_volume').jqxNumberInput('decimal')) +
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2130 parseFloat($('#prop3_volume').jqxNumberInput('decimal')) + parseFloat($('#prop4_volume').jqxNumberInput('decimal'))) == 0) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2131 // clear by default
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2132 for (i = 1; i < 5; i++) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2133 $('#prop' + i + '_type').hide();
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2134 $('#r' + i + '_pmpt').show();
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2135 $('#prop' + i + '_type').val(stype);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2136 $('#prop' + i + '_volume').hide();
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2137 $('#prop' + i + '_volume').val(0);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2138 $('#prop' + i + '_irate').hide();
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2139 $('#prop' + i + '_ncells').hide();
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2140 $('#prop' + i + '_tcells').hide();
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2141 $('#prop' + i + '_growf').hide();
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2142 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2143 if (start > needed) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2144 return; // no starter needed
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2145 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2146 $('#prop1_type').show();
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2147 $('#r1_pmpt').hide();
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2148 $('#prop1_volume').show();
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2149 $('#prop1_irate').show();
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2150 $('#prop1_ncells').show();
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2151 $('#prop1_tcells').show();
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2152 $('#prop1_growf').show();
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2153 for (i = lasti; i <= mvols; i++) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2154 lasti = i;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2155 svol = uvols[lasti];
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2156 result = calcStep(svol, stype, start);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2157 if (result.irate < 25) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2158 // inocculation rate too low, backup one step and break out.
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2159 lasti = i - 1;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2160 svol = uvols[lasti];
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2161 result = calcStep(svol, stype, start);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2162 break;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2163 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2164 if (result.totcells > needed || i == mvols) { // hit the target or loops done
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2165 break;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2166 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2167 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2168 $('#prop1_volume').val(result.svol / 1000); // to liters
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2169 $('#prop1_irate').val(result.prate);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2170 $('#prop1_ncells').val(result.ncells);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2171 $('#prop1_tcells').val(result.totcells);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2172 $('#prop1_growf').val(result.growf);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2173 if (result.totcells > needed)
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2174 return; // hit the target
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2175
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2176 // second stage
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2177 $('#r2_pmpt').hide();
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2178 $('#prop2_type').val(stype);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2179 $('#prop2_type').show();
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2180 $('#prop2_volume').show();
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2181 $('#prop2_irate').show();
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2182 $('#prop2_ncells').show();
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2183 $('#prop2_tcells').show();
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2184 $('#prop2_growf').show();
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2185 for (i = lasti; i <= mvols; i++) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2186 lasti = i;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2187 svol = uvols[lasti];
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2188 result = calcStep(svol, stype, $('#prop1_tcells').val());
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2189 if (result.irate < 25) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2190 lasti = i - 1;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2191 svol = uvols[lasti];
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2192 result = calcStep(svol, stype, $('#prop1_tcells').val());
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2193 break;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2194 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2195 if (result.totcells > needed || i == mvols) { // hit the target or loops done
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2196 break;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2197 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2198 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2199 $('#prop2_volume').val(result.svol / 1000); // to liters
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2200 $('#prop2_irate').val(result.prate);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2201 $('#prop2_ncells').val(result.ncells);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2202 $('#prop2_tcells').val(result.totcells);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2203 $('#prop2_growf').val(result.growf);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2204 if (result.totcells > needed)
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2205 return; // hit the target
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2206
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2207 // third stage
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2208 $('#r3_pmpt').hide();
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2209 $('#prop3_type').val(stype);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2210 $('#prop3_type').show();
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2211 $('#prop3_volume').show();
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2212 $('#prop3_irate').show();
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2213 $('#prop3_ncells').show();
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2214 $('#prop3_tcells').show();
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2215 $('#prop3_growf').show();
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2216 for (i = lasti; i <= mvols; i++) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2217 lasti = i;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2218 svol = uvols[lasti];
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2219 result = calcStep(svol, stype, $('#prop2_tcells').val());
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2220 if (result.irate < 25) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2221 lasti = i - 1;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2222 svol = uvols[lasti];
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2223 result = calcStep(svol, stype, $('#prop2_tcells').val());
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2224 break;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2225 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2226 if (result.totcells > needed || i == mvols) { // hit the target or loops done
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2227 break;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2228 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2229 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2230 $('#prop3_volume').val(result.svol / 1000); // to liters
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2231 $('#prop3_irate').val(result.prate);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2232 $('#prop3_ncells').val(result.ncells);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2233 $('#prop3_tcells').val(result.totcells);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2234 $('#prop3_growf').val(result.growf);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2235 if (result.totcells > needed)
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2236 return; // hit the target
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2237
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2238 // fourth stage
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2239 $('#r4_pmpt').hide();
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2240 $('#prop4_type').val(stype);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2241 $('#prop4_type').show();
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2242 $('#prop4_volume').show();
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2243 $('#prop4_irate').show();
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2244 $('#prop4_ncells').show();
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2245 $('#prop4_tcells').show();
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2246 $('#prop4_growf').show();
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2247 for (i = lasti; i <= mvols; i++) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2248 lasti = i;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2249 svol = uvols[lasti];
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2250 result = calcStep(svol, stype, $('#prop3_tcells').val());
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2251 if (result.totcells > needed || i == mvols) { // hit the target or loops done
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2252 $('#prop4_volume').val(result.svol / 1000); // to liters
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2253 $('#prop4_irate').val(result.prate);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2254 $('#prop4_ncells').val(result.ncells);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2255 $('#prop4_tcells').val(result.totcells);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2256 $('#prop4_growf').val(result.growf);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2257 return;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2258 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2259 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2260 } else {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2261 // recalculate
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2262 if (dataRecord.prop1_volume > 0) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2263 $('#r1_pmpt').hide();
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2264 $('#prop1_type').show();
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2265 $('#prop1_volume').show();
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2266 $('#prop1_irate').show();
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2267 $('#prop1_ncells').show();
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2268 $('#prop1_tcells').show();
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2269 $('#prop1_growf').show();
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2270 result = calcStep($('#prop1_volume').val() * 1000, dataRecord.prop1_type, start);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2271 $('#prop1_irate').val(result.prate);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2272 $('#prop1_ncells').val(result.ncells);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2273 $('#prop1_tcells').val(result.totcells);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2274 $('#prop1_growf').val(result.growf);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2275 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2276 if (dataRecord.prop2_volume > 0) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2277 $('#r2_pmpt').hide();
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2278 $('#prop2_type').show();
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2279 $('#prop2_volume').show();
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2280 $('#prop2_irate').show();
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2281 $('#prop2_ncells').show();
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2282 $('#prop2_tcells').show();
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2283 $('#prop2_growf').show();
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2284 result = calcStep($('#prop2_volume').val() * 1000, dataRecord.prop2_type, $('#prop1_tcells').val());
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2285 $('#prop2_irate').val(result.prate);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2286 $('#prop2_ncells').val(result.ncells);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2287 $('#prop2_tcells').val(result.totcells);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2288 $('#prop2_growf').val(result.growf);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2289 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2290 if (dataRecord.prop3_volume > 0) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2291 $('#r3_pmpt').hide();
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2292 $('#prop3_type').show();
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2293 $('#prop3_volume').show();
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2294 $('#prop3_irate').show();
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2295 $('#prop3_ncells').show();
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2296 $('#prop3_tcells').show();
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2297 $('#prop3_growf').show();
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2298 result = calcStep($('#prop3_volume').val() * 1000, dataRecord.prop3_type, $('#prop2_tcells').val());
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2299 $('#prop3_irate').val(result.prate);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2300 $('#prop3_ncells').val(result.ncells);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2301 $('#prop3_tcells').val(result.totcells);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2302 $('#prop3_growf').val(result.growf);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2303 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2304 if (dataRecord.prop4_volume > 0) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2305 $('#r4_pmpt').hide();
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2306 $('#prop4_type').show();
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2307 $('#prop4_volume').show();
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2308 $('#prop4_irate').show();
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2309 $('#prop4_ncells').show();
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2310 $('#prop4_tcells').show();
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2311 $('#prop4_growf').show();
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2312 result = calcStep($('#prop4_volume').val() * 1000, dataRecord.prop4_type, $('#prop3_tcells').val());
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2313 $('#prop4_irate').val(result.prate);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2314 $('#prop4_ncells').val(result.ncells);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2315 $('#prop4_tcells').val(result.totcells);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2316 $('#prop4_growf').val(result.growf);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2317 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2318 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2319 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2320
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2321 function calcYeast() {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2322
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2323 // Calculate needed cells.
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2324 var plato, volume, rows, rowscount, row, i, needed, use_cells, sg = dataRecord.brew_fermenter_sg;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2325 if (sg <= 1.0001 && dataRecord.fg > 1.000)
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2326 sg = dataRecord.fg;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2327 else if (sg <= 1.0001)
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2328 sg = dataRecord.est_og;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2329 plato = sg_to_plato(sg);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2330
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2331 volume = dataRecord.brew_fermenter_volume;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2332 if (volume > 0) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2333 if (dataRecord.brew_fermenter_extrawater > 0)
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2334 volume += dataRecord.brew_fermenter_extrawater;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2335 } else {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2336 volume = dataRecord.batch_size - dataRecord.eq_trub_chiller_loss;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2337 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2338
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2339 // Also in calcFermentables()
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2340 $('#yeast_cells').val(initcells);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2341
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2342 if (!(rows = $('#yeastGrid').jqxGrid('getrows'))) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2343 return; // grid not yet loaded.
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2344 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2345 rowscount = $('#yeastGrid').jqxGrid('getdatainformation').rowscount;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2346 if (rowscount == 0)
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2347 return; // no yeast in recipe
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2348
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2349 for (i = 0; i < rowscount; i++) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2350 row = $('#yeastGrid').jqxGrid('getrowdata', i);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2351 if (row.y_use == 0) { // primary
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2352 // pitchrate see https://www.brewersfriend.com/yeast-pitch-rate-and-starter-calculator/
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2353 // and http://braukaiser.com/blog/blog/2012/11/03/estimating-yeast-growth/
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2354 pitchrate = 0.75;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2355 if (dataRecord.est_og > 1.060)
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2356 pitchrate = 1.0;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2357 // if (dataRecord.est_og > 1.076)
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2358 // pitchrate = 1.25; // Wyeast labs. http://www.wyeastlab.com/hb_pitchrates.cfm
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2359 if (row.y_type == 0) // lager yeast
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2360 pitchrate *= 2;
515
9d771385a8a0 Added dried yeast form. Pitch rate for Kveik initially set at 0.25. Dried Kveik cells set to 9000000000 cells/gram.
Michiel Broek <mbroek@mbse.eu>
parents: 500
diff changeset
2361 if (row.y_type == 6) // Kveik
9d771385a8a0 Added dried yeast form. Pitch rate for Kveik initially set at 0.25. Dried Kveik cells set to 9000000000 cells/gram.
Michiel Broek <mbroek@mbse.eu>
parents: 500
diff changeset
2362 pitchrate = 0.25; // Who knows.
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2363
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2364 // if (row.y_form == 1) { // dry yeast
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2365 // } else { // possible starter needed
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2366 // }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2367 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2368 }
495
fdbb6bfae569 Disabled some console.log items.
Michiel Broek <mbroek@mbse.eu>
parents: 490
diff changeset
2369 needed = Round(pitchrate * volume * plato, 1);
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2370 console.log('calcYeast() pitchrate:' + pitchrate + ' start:' + initcells + ' needed:' + needed + ' volume:' + volume);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2371 $('#need_cells').val(needed);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2372 use_cells = initcells;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2373
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2374 if (dataRecord.starter_enable) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2375 calcSteps(dataRecord.starter_type, initcells, needed);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2376
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2377 for (i = 1; i < 5; i++) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2378 $('#r' + i + '_irate').html('');
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2379 $('#r' + i + '_growf').html('');
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2380 $('#r' + i + '_tcells').html('');
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2381 if (parseFloat($('#prop' + i + '_volume').val()) > 0) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2382 if ((parseFloat($('#prop' + i + '_irate').val()) < 25) || (parseFloat($('#prop' + i + '_irate').val()) > 100)) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2383 $('#r' + i + '_irate').html("<img src='images/dialog-error.png'>");
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2384 } else {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2385 $('#r' + i + '_irate').html("<img src='images/dialog-ok-apply.png'>");
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2386 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2387 if (parseFloat($('#prop' + i + '_growf').val()) < 1)
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2388 $('#r' + i + '_growf').html("<img src='images/dialog-error.png'>");
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2389 if (($('#prop' + i + '_type').val() > 0) && (parseFloat($('#prop' + i + '_growf').val()) > 3))
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2390 $('#r' + i + '_growf').html("<img src='images/dialog-error.png'>");
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2391 if (parseFloat($('#prop' + i + '_tcells').val()) > needed)
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2392 $('#r' + i + '_tcells').html("<img src='images/dialog-ok-apply.png'>");
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2393 use_cells = parseFloat($('#prop' + i + '_tcells').val());
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2394 } else {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2395 $('#r' + i + '_irate').html('');
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2396 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2397 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2398 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2399 $('#plato_cells').val(parseFloat(use_cells / (volume * plato)));
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2400 };
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2401
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2402 function adjustHops(factor) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2403
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2404 console.log('adjustHops(' + factor + ')');
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2405 var row, i, amount, rowscount = $('#hopGrid').jqxGrid('getdatainformation').rowscount;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2406 if (rowscount == 0)
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2407 return;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2408 for (i = 0; i < rowscount; i++) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2409 row = $('#hopGrid').jqxGrid('getrowdata', i);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2410 amount = row.h_amount * factor;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2411 $('#hopGrid').jqxGrid('setcellvalue', i, 'h_amount', amount);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2412 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2413 };
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2414
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2415 function calcMiscs() {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2416
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2417 ok_miscs = 1;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2418 var row, i, rowscount = $('#miscGrid').jqxGrid('getdatainformation').rowscount;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2419 if (rowscount == 0)
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2420 return;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2421 for (i = 0; i < rowscount; i++) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2422 row = $('#miscGrid').jqxGrid('getrowdata', i);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2423 if ((((dataRecord.inventory_reduced <= 2) && (row.m_use_use <= 2)) || // Starter, Mash, Boil
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2424 ((dataRecord.inventory_reduced <= 3) && (row.m_use_use == 3)) || // Primary
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2425 ((dataRecord.inventory_reduced <= 5) && (row.m_use_use == 4)) || // Secondary, Teriary
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2426 ((dataRecord.inventory_reduced <= 6) && (row.m_use_use == 5))) && // Bottle
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2427 (row.m_inventory < row.m_amount)) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2428 ok_miscs = 0;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2429 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2430 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2431 calcSupplies();
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2432 };
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2433
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2434 function adjustMiscs(factor) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2435
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2436 console.log('adjustMiscs(' + factor + ')');
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2437 var row, i, amount, rowscount = $('#miscGrid').jqxGrid('getdatainformation').rowscount;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2438 if (rowscount == 0)
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2439 return;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2440 for (i = 0; i < rowscount; i++) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2441 row = $('#miscGrid').jqxGrid('getrowdata', i);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2442 amount = row.m_amount * factor;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2443 $('#miscGrid').jqxGrid('setcellvalue', i, 'm_amount', amount);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2444 switch (row.m_name) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2445 case 'CaCl2':
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2446 $('#wa_cacl2').val(row.m_amount * 1000);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2447 break;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2448 case 'CaSO4':
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2449 $('#wa_caso4').val(row.m_amount * 1000);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2450 break;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2451 case 'MgSO4':
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2452 $('#wa_mgso4').val(row.m_amount * 1000);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2453 break;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2454 case 'NaCl':
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2455 $('#wa_nacl').val(row.m_amount * 1000);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2456 break;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2457 case 'Melkzuur':
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2458 case 'Zoutzuur':
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2459 case 'Fosforzuur':
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2460 case 'Zwavelzuur':
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2461 $('#wa_acid').val(row.m_amount * 1000);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2462 break;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2463 case 'NaHCO3':
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2464 case 'Na2CO3':
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2465 case 'CaCO3':
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2466 case 'Ca(OH)2':
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2467 $('#wa_base').val(row.m_amount * 1000);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2468 break;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2469 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2470 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2471 };
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2472
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2473 function adjustYeasts(factor) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2474
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2475 console.log('adjustYeasts(' + factor + ')');
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2476 var row, i, amount, rowscount = $('#yeastGrid').jqxGrid('getdatainformation').rowscount;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2477 if (rowscount == 0)
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2478 return;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2479 for (i = 0; i < rowscount; i++) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2480 row = $('#yeastGrid').jqxGrid('getrowdata', i);
515
9d771385a8a0 Added dried yeast form. Pitch rate for Kveik initially set at 0.25. Dried Kveik cells set to 9000000000 cells/gram.
Michiel Broek <mbroek@mbse.eu>
parents: 500
diff changeset
2481 if (! dataRecord.starter_enable) { // Only adjust without a starter
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2482 amount = row.y_amount * factor;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2483 $('#yeastGrid').jqxGrid('setcellvalue', i, 'y_amount', amount);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2484 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2485 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2486 calcYeast();
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2487 };
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2488
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2489 function adjustWaters(factor) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2490
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2491 console.log('adjustWaters(' + factor + ')');
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2492 var amount, row, i, rowscount = $('#mashGrid').jqxGrid('getdatainformation').rowscount;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2493 if (rowscount == 0)
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2494 return;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2495 mash_infuse = 0;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2496 for (i = 0; i < rowscount; i++) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2497 row = $('#mashGrid').jqxGrid('getrowdata', i);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2498 if (row.step_type == 0) { // Infusion
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2499 amount = Round(row.step_infuse_amount * factor, 1);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2500 $('#mashGrid').jqxGrid('setcellvalue', i, 'step_infuse_amount', amount);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2501 mash_infuse += amount;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2502 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2503 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2504 if (dataRecord.w2_amount == 0) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2505 dataRecord.w1_amount = mash_infuse;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2506 $('#w1_amount').val(mash_infuse);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2507 } else {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2508 dataRecord.w1_amount = (dataRecord.w1_amount / (dataRecord.w1_amount + dataRecord.w2_amount)) * mash_infuse;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2509 dataRecord.w2_amount = (dataRecord.w2_amount / (dataRecord.w1_amount + dataRecord.w2_amount)) * mash_infuse;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2510 $('#w1_amount').val(dataRecord.w1_amount);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2511 $('#w2_amount').val(dataRecord.w2_amount);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2512 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2513 $('#wg_amount').val(mash_infuse);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2514 };
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2515
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2516 function calcMashEfficiency() {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2517 var c, m;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2518 if (parseFloat($('#brew_mash_sg').jqxNumberInput('decimal')) < 1.002)
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2519 return;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2520 c = sg_to_plato(est_mash_sg);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2521 m = sg_to_plato(parseFloat($('#brew_mash_sg').jqxNumberInput('decimal')));
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2522 if (c > 0.5)
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2523 $('#brew_mash_efficiency').val(100 * m / c);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2524 else
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2525 $('#brew_mash_efficiency').val(0);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2526 };
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2527
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2528 function calcEfficiencyBeforeBoil() {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2529 var m = 0, rows = {}, i, row, tot, result = 0;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2530 if (!(rows = $('#fermentableGrid').jqxGrid('getrows'))) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2531 return; // grid not yet loaded.
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2532 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2533 for (i = 0; i < rows.length; i++) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2534 row = rows[i];
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2535 if (row.f_added == 0) { // Mash
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2536 m += row.f_amount * (row.f_yield / 100) * (1 - row.f_moisture / 100);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2537 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2538 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2539 tot = sg_to_plato(dataRecord.brew_preboil_sg) * (dataRecord.brew_preboil_volume / 1.04) * dataRecord.brew_preboil_sg * 10 / 1000;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2540 if (m > 0)
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2541 result = Round((tot / m * 100), 1);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2542 if (result < 0)
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2543 result = 0;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2544 $('#brew_preboil_efficiency').val(result);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2545 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2546
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2547 function calcEfficiencyAfterBoil() {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2548 var m = 0, // Sugars added at mash
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2549 b = 0, // Sugars added at boil
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2550 rows = {}, i, row, tot, result = 0;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2551 if (!(rows = $('#fermentableGrid').jqxGrid('getrows'))) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2552 return; // grid not yet loaded.
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2553 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2554 for (i = 0; i < rows.length; i++) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2555 row = rows[i];
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2556 if (row.f_added == 0) { // Mash
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2557 m += row.f_amount * (row.f_yield / 100) * (1 - row.f_moisture / 100);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2558 } else if (row.f_added == 1) { // Boil
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2559 b += row.f_amount * (row.f_yield / 100) * (1 - row.f_moisture / 100);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2560 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2561 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2562 tot = sg_to_plato(dataRecord.brew_aboil_sg) * (dataRecord.brew_aboil_volume / 1.04) * dataRecord.brew_aboil_sg * 10 / 1000;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2563 tot -= b; // total sugars in wort minus added sugars.
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2564 if (m > 0)
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2565 result = Round((tot / m * 100), 1);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2566 if (result < 0)
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2567 result = 0;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2568 dataRecord.brew_aboil_efficiency = result;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2569 $('#brew_aboil_efficiency').val(result);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2570 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2571
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2572 function GetBUGU() {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2573 var gu = (dataRecord.est_og - 1) * 1000;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2574 if (gu > 0)
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2575 return dataRecord.est_ibu / gu;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2576 else
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2577 return 0.5;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2578 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2579
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2580 function GetOptClSO4ratio() {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2581 var BUGU = GetBUGU();
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2582 return (-1.2 * BUGU + 1.4);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2583 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2584
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2585 function setWaterAgent(name, amount) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2586 var row, i, id, found = false, miscs, rows = $('#miscGrid').jqxGrid('getrows');
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2587 if (amount == 0) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2588 for (i = 0; i < rows.length; i++) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2589 row = rows[i];
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2590 if (row.m_name == name) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2591 id = $('#miscGrid').jqxGrid('getrowid', i);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2592 $('#miscGrid').jqxGrid('deleterow', id);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2593 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2594 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2595 } else {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2596 for (i = 0; i < rows.length; i++) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2597 row = rows[i];
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2598 if (row.m_name == name) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2599 found = true;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2600 $('#miscGrid').jqxGrid('setcellvalue', i, 'm_amount', amount / 1000);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2601 break;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2602 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2603 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2604 if (! found) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2605 miscs = new $.jqx.dataAdapter(miscInvSource, {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2606 loadComplete: function() {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2607 var record, i, row = {}, records = miscs.records;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2608 for (i = 0; i < records.length; i++) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2609 record = records[i];
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2610 if (record.name == name) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2611 row['m_name'] = record.name;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2612 row['m_amount'] = amount / 1000;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2613 row['m_cost'] = record.cost;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2614 row['m_type'] = record.type;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2615 row['m_use_use'] = record.use_use;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2616 row['m_time'] = 0;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2617 row['m_amount_is_weight'] = record.amount_is_weight;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2618 row['m_inventory'] = record.inventory;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2619 row['m_avail'] = 1;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2620 $('#miscGrid').jqxGrid('addrow', null, row);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2621 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2622 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2623 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2624 });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2625 miscs.dataBind();
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2626 return;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2627 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2628 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2629 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2630
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2631 function setRangeIndicator(ion, rangeCode) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2632 if ((rangeCode == 'laag') || (rangeCode == 'hoog'))
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2633 $('#wr_' + ion).html("<img src='images/dialog-error.png'><span style='vertical-align: top; font-size: 10px; font-style: italic;'>" + rangeCode + '</span>');
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2634 else
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2635 $('#wr_' + ion).html("<img src='images/dialog-ok-apply.png'>");
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2636 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2637
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2638 function mix(v1, v2, c1, c2) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2639 if ((v1 + v2) > 0) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2640 return ((v1 * c1) + (v2 * c2)) / (v1 + v2);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2641 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2642 return 0;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2643 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2644
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2645 // mg/l as CaCO3
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2646 function ResidualAlkalinity(total_alkalinity, calcium, magnesium) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2647 return total_alkalinity - (calcium / 1.4 + magnesium / 1.7);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2648 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2649
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2650 function PartCO3(pH) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2651 var H = Math.pow(10, -pH);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2652 return 100 * Ka1 * Ka2 / (H * H + H * Ka1 + Ka1 * Ka2);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2653 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2654
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2655 function PartHCO3(pH) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2656 var H = Math.pow(10, -pH);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2657 return 100 * Ka1 * H / (H * H + H * Ka1 + Ka1 * Ka2);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2658 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2659
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2660 function Charge(pH) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2661 return (-2 * PartCO3(pH) - PartHCO3(pH));
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2662 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2663
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2664 //Z alkalinity is the amount of acid (in mEq/l) needed to bring water to the target pH (Z pH)
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2665 function ZAlkalinity(pHZ) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2666 var C43 = Charge(4.3),
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2667 Cw = Charge(parseFloat($('#wg_ph').jqxNumberInput('decimal'))),
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2668 Cz = Charge(pHZ),
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2669 DeltaCNaught = -C43 + Cw,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2670 CT = parseFloat($('#wg_total_alkalinity').jqxNumberInput('decimal')) / 50 / DeltaCNaught,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2671 DeltaCZ = -Cz + Cw;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2672 return CT * DeltaCZ;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2673 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2674
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2675 //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)
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2676 function ZRA(pHZ) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2677
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2678 var Magn, Z, Calc = parseFloat($('#wg_calcium').jqxNumberInput('decimal')) / (MMCa / 2);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2679 Magn = parseFloat($('#wg_magnesium').jqxNumberInput('decimal')) / (MMMg / 2);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2680 Z = ZAlkalinity(pHZ);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2681 return Z - (Calc / 3.5 + Magn / 7);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2682 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2683
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2684 function ProtonDeficit(pHZ) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2685
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2686 var rows, i, C1, ebc, x, Result = ZRA(pHZ) * parseFloat($('#wg_amount').jqxNumberInput('decimal'));
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2687 // proton deficit for the grist
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2688 rows = $('#fermentableGrid').jqxGrid('getrows');
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2689 for (i = 0; i < rows.length; i++) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2690 row = rows[i];
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2691 if (row.f_added == 0 && row.f_graintype != 6) { // Added == Mash && graintype != No Malt
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2692 // Check if acid is required
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2693 C1 = 0;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2694 if ((row.f_di_ph != 5.7) && ((row.f_acid_to_ph_57 < - 0.1) || (row.f_acid_to_ph_57 > 0.1))) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2695 C1 = row.f_acid_to_ph_57 / (row.f_di_ph - 5.7);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2696 } else {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2697 // If the acid_to_ph_5.7 is unknown from the maltster, guess the required acid.
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2698 ebc = row.f_color;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2699 switch (row.f_graintype) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2700 case 0: // Base, Special, Kilned
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2701 case 3:
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2702 case 5: C1 = 0.014 * ebc - 34.192;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2703 break;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2704 case 2: C1 = -0.0597 * ebc - 32.457; // Crystal
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2705 break;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2706 case 1: C1 = 0.0107 * ebc - 54.768; // Roast
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2707 break;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2708 case 4: C1 = -149; // Sour malt
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2709 break;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2710 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2711 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2712 x = C1 * (pHZ - row.f_di_ph); // AcidRequired(ZpH)
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2713 Result += x * row.f_amount;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2714 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2715 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2716 return Result;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2717 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2718
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2719 function MashpH() {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2720 var n = 0, pH = 5.4, deltapH = 0.001, deltapd = 0.1, pd = ProtonDeficit(pH);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2721 while (((pd < -deltapd) || (pd > deltapd)) && (n < 2000)) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2722 n++;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2723 if (pd < -deltapd)
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2724 pH -= deltapH;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2725 else if (pd > deltapd)
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2726 pH += deltapH;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2727 pd = ProtonDeficit(pH);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2728 }
495
fdbb6bfae569 Disabled some console.log items.
Michiel Broek <mbroek@mbse.eu>
parents: 490
diff changeset
2729 pH = Round(pH, 2);
fdbb6bfae569 Disabled some console.log items.
Michiel Broek <mbroek@mbse.eu>
parents: 490
diff changeset
2730 //console.log('MashpH() n: ' + n + ' pH: ' + pH);
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2731 return pH;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2732 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2733
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2734 function GetAcidSpecs(AT) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2735 switch (AT) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2736 case 0: // Melkzuur
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2737 return { pK1: 3.86, pK2: 20, pK3: 20, MolWt: 90.08, AcidSG: 1214, AcidPrc: 0.88 };
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2738 case 1: // Zoutzuur
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2739 return { pK1: -7, pK2: 20, pK3: 20, MolWt: 36.46, AcidSG: 1142, AcidPrc: 0.28 };
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2740 case 2: // Fosforzuur
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2741 return { pK1: 2.12, pK2: 7.20, pK3: 12.44, MolWt: 98.00, AcidSG: 1170, AcidPrc: 0.25 };
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2742 case 3: // Zwavelzuur
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2743 return { pK1: -1, pK2: 1.92, pK3: 20, MolWt: 98.07, AcidSG: 1700, AcidPrc: 0.93 };
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2744 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2745 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2746
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2747 function calcWater() {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2748
495
fdbb6bfae569 Disabled some console.log items.
Michiel Broek <mbroek@mbse.eu>
parents: 490
diff changeset
2749 //console.log('calcWater()');
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2750 var liters = 0,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2751 calcium = 0,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2752 magnesium = 0,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2753 sodium = 0,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2754 total_alkalinity = 0,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2755 bicarbonate = 0,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2756 chloride = 0,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2757 sulfate = 0,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2758 ph = 0,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2759 RA = 0,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2760 frac = 0,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2761 TpH = 0,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2762 protonDeficit = 0,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2763 AT, BT, result, pK1, pK2, pK3, MolWt, AcidSG, AcidPrc,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2764 r1d, r2d, f1d, f2d, f3d,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2765 deltapH, deltapd, pd, n,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2766 piCLSO4_low, piCLSO4_high, Res,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2767 wg_calcium, wg_sodium, wg_total_alkalinity, wg_chloride, wg_sulfate, wg_bicarbonate;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2768
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2769 if (dataRecord.w1_name == '') {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2770 return;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2771 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2772
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2773 // If there is a dillute water source, mix the waters.
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2774 if (dataRecord.w2_name != '') {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2775 liters = dataRecord.w1_amount + dataRecord.w2_amount;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2776 calcium = mix(dataRecord.w1_amount, dataRecord.w2_amount, dataRecord.w1_calcium, dataRecord.w2_calcium);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2777 magnesium = mix(dataRecord.w1_amount, dataRecord.w2_amount, dataRecord.w1_magnesium, dataRecord.w2_magnesium);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2778 sodium = mix(dataRecord.w1_amount, dataRecord.w2_amount, dataRecord.w1_sodium, dataRecord.w2_sodium);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2779 chloride = mix(dataRecord.w1_amount, dataRecord.w2_amount, dataRecord.w1_chloride, dataRecord.w2_chloride);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2780 sulfate = mix(dataRecord.w1_amount, dataRecord.w2_amount, dataRecord.w1_sulfate, dataRecord.w2_sulfate);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2781 total_alkalinity = mix(dataRecord.w1_amount, dataRecord.w2_amount, dataRecord.w1_total_alkalinity, dataRecord.w2_total_alkalinity);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2782 ph = -Math.log10(((Math.pow(10, -dataRecord.w1_ph) * dataRecord.w1_amount) + (Math.pow(10, -dataRecord.w2_ph) * dataRecord.w2_amount)) / liters);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2783 } else {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2784 liters = dataRecord.w1_amount;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2785 calcium = dataRecord.w1_calcium;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2786 magnesium = dataRecord.w1_magnesium;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2787 sodium = dataRecord.w1_sodium;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2788 chloride = dataRecord.w1_chloride;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2789 sulfate = dataRecord.w1_sulfate;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2790 total_alkalinity = dataRecord.w1_total_alkalinity;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2791 ph = dataRecord.w1_ph;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2792 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2793 $('#wg_amount').val(liters);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2794 wg_calcium = calcium;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2795 $('#wg_calcium').val(Math.round(calcium * 10) / 10);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2796 //var wg_magnesium = magnesium;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2797 $('#wg_magnesium').val(Math.round(magnesium * 10) / 10);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2798 wg_sodium = sodium;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2799 $('#wg_sodium').val(Math.round(sodium * 10) / 10);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2800 wg_total_alkalinity = total_alkalinity;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2801 $('#wg_total_alkalinity').val(Math.round(total_alkalinity * 10) / 10);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2802 wg_chloride = chloride;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2803 $('#wg_chloride').val(Math.round(chloride * 10) / 10);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2804 wg_sulfate = sulfate;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2805 $('#wg_sulfate').val(Math.round(sulfate * 10) / 10);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2806 // Note: brouwhulp has the malts included here in the result.
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2807 //var wg_ph = ph;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2808 $('#wg_ph').val(Round(ph, 1));
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2809 $('#wb_ph').val(Round(MashpH(), 1));
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2810 $('#est_mash_ph').val(Round(MashpH(), 1));
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2811 bicarbonate = total_alkalinity * 1.22;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2812 wg_bicarbonate = bicarbonate;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2813
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2814 // Noot: de volgende berekeningen geven bijna gelijke resultaten in Brun'water.
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2815 // Calculate Ca
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2816 RA = parseFloat($('#wa_cacl2').jqxNumberInput('decimal')) * MMCa / MMCaCl2 +
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2817 parseFloat($('#wa_caso4').jqxNumberInput('decimal')) * MMCa / MMCaSO4;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2818 calcium += 1000 * RA / liters;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2819
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2820 // Calculate Mg
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2821 RA = parseFloat($('#wa_mgso4').jqxNumberInput('decimal')) * MMMg / MMMgSO4;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2822 magnesium += 1000 * RA / liters;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2823
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2824 // Calculate Na
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2825 RA = parseFloat($('#wa_nacl').jqxNumberInput('decimal')) * MMNa / MMNaCl +
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2826 parseFloat($('#wa_base').jqxNumberInput('decimal')) * MMNa / MMNaHCO3;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2827 sodium += 1000 * RA / liters;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2828
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2829 // Calculate SO4
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2830 RA = parseFloat($('#wa_caso4').jqxNumberInput('decimal')) * MMSO4 / MMCaSO4 +
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2831 parseFloat($('#wa_mgso4').jqxNumberInput('decimal')) * MMSO4 / MMMgSO4;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2832 sulfate += 1000 * RA / liters;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2833
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2834 // Calculate Cl
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2835 RA = 2 * parseFloat($('#wa_cacl2').jqxNumberInput('decimal')) * MMCl / MMCaCl2 +
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2836 parseFloat($('#wa_nacl').jqxNumberInput('decimal')) * MMCl / MMNaCl;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2837 chloride += 1000 * RA / liters;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2838 // Einde noot.
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2839
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2840 if ($('#wa_acid_name').val() < 0 || $('#wa_acid_name').val() > 3) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2841 $('#wa_acid_name').val(0);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2842 dataRecord.wa_acid_name = 0;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2843 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2844 if (last_acid == '')
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2845 last_acid = AcidTypeData[$('#wa_acid_name').val()].nl;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2846
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2847 if ($('#wa_base_name').val() < 0 || $('#wa_base_name').val() > 3) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2848 $('#wa_base_name').val(0);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2849 dataRecord.wa_base_name = 0;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2850 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2851 if (last_base == '')
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2852 last_base = BaseTypeData[$('#wa_base_name').val()].nl;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2853
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2854 AT = dataRecord.wa_acid_name;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2855 BT = dataRecord.wa_base_name;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2856
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2857 result = GetAcidSpecs(AT);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2858 pK1 = result.pK1;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2859 pK2 = result.pK2;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2860 pK3 = result.pK3;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2861 MolWt = result.MolWt;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2862 AcidSG = result.AcidSG;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2863 AcidPrc = result.AcidPrc;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2864
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2865 if (dataRecord.calc_acid) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2866 TpH = parseFloat(dataRecord.mash_ph);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2867 protonDeficit = ProtonDeficit(TpH);
495
fdbb6bfae569 Disabled some console.log items.
Michiel Broek <mbroek@mbse.eu>
parents: 490
diff changeset
2868 //console.log('calc_acid tgt: ' + TpH + ' protonDeficit: ' + protonDeficit);
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2869 if (protonDeficit > 0) { // Add acid
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2870 $('#wa_base').val(0);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2871 setWaterAgent(last_base, 0);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2872 frac = CalcFrac(TpH, pK1, pK2, pK3);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2873 Acid = protonDeficit / frac;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2874 Acid *= MolWt; // mg
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2875 Acidmg = Acid;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2876 Acid = Acid / AcidSG; // ml
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2877
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2878 if (parseFloat($('#wa_acid_perc').jqxNumberInput('decimal')) == 0)
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2879 $('#wa_acid_perc').val(AcidPrc);
495
fdbb6bfae569 Disabled some console.log items.
Michiel Broek <mbroek@mbse.eu>
parents: 490
diff changeset
2880 Acid = Round(Acid * AcidPrc / (parseFloat($('#wa_acid_perc').jqxNumberInput('decimal')) / 100), 2); // ml
fdbb6bfae569 Disabled some console.log items.
Michiel Broek <mbroek@mbse.eu>
parents: 490
diff changeset
2881 //console.log('Final ml: ' + Acid);
fdbb6bfae569 Disabled some console.log items.
Michiel Broek <mbroek@mbse.eu>
parents: 490
diff changeset
2882 $('#wa_acid').val(Acid);
fdbb6bfae569 Disabled some console.log items.
Michiel Broek <mbroek@mbse.eu>
parents: 490
diff changeset
2883 setWaterAgent(AcidTypeData[AT].nl, Acid);
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2884
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2885 bicarbonate = bicarbonate - protonDeficit * frac / liters;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2886 total_alkalinity = bicarbonate * 50 / 61;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2887 } else if (protonDeficit < 0) { //Add base
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2888 $('#wa_acid').val(0);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2889 setWaterAgent(last_acid, 0);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2890 r1d = Math.pow(10, (TpH - 6.38));
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2891 r2d = Math.pow(10, (TpH - 10.38));
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2892 f1d = 1 / (1 + r1d + r1d * r2d);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2893 f2d = f1d * r1d;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2894 f3d = f2d * r2d;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2895 switch (BT) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2896 case 0:
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2897 RA = -protonDeficit / (f1d - f3d); // Sodiumbicarbonate, mmol totaal
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2898 RA = RA * MMNaHCO3 / 1000; //gram
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2899 $('#wa_base').val(Round(RA, 2));
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2900 setWaterAgent('NaHCO3', Round(RA, 2));
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2901 if (liters > 0) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2902 // Na
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2903 RA = parseFloat($('#wa_nacl').jqxNumberInput('decimal')) * MMNa / MMNaCl +
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2904 parseFloat($('#wa_base').jqxNumberInput('decimal')) * MMNa / MMNaHCO3;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2905 RA = 1000 * RA / liters;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2906 sodium = wg_sodium + RA;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2907 // HCO3
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2908 RA = parseFloat($('#wa_base').jqxNumberInput('decimal')) * MMHCO3 / MMNaHCO3;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2909 RA = 1000 * RA / liters;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2910 bicarbonate = wg_bicarbonate + RA;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2911 total_alkalinity = bicarbonate * 50 / 61;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2912 RA = ResidualAlkalinity(wb_total_alkalinity, wb_calcium, wb_magnesium);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2913 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2914 break;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2915 case 1:
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2916 RA = -protonDeficit / (2 * f1d + f2d); // Sodiumcarbonate, mmol totaal
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2917 RA = RA * MMNa2CO3 / 1000; //gram
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2918 $('#wa_base').val(Round(RA, 2));
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2919 setWaterAgent('Na2CO3', Round(RA, 2));
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2920 if (liters > 0) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2921 RA = parseFloat($('#wa_nacl').jqxNumberInput('decimal')) * MMNa / MMNaCl +
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2922 parseFloat($('#wa_base').jqxNumberInput('decimal')) * 2 * MMNa / MMNa2CO3;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2923 RA = 1000 * RA / liters;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2924 sodium = wg_sodium + RA;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2925 // HCO3
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2926 RA = parseFloat($('#wa_base').jqxNumberInput('decimal')) * MMHCO3 / MMNa2CO3;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2927 RA = 1000 * RA / liters;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2928 bicarbonate = wg_bicarbonate + RA;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2929 total_alkalinity = bicarbonate * 50 / 61;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2930 RA = ResidualAlkalinity(wb_total_alkalinity, wb_calcium, wb_magnesium);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2931 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2932 break;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2933 case 2:
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2934 RA = -protonDeficit * (f1d - f3d); // Calciumcarbonate, mmol totaal
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2935 RA = RA * MMCaCO3 / 1000; //gram
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2936 //but only 1/3 is effective, so add 3 times as much
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2937 RA = 3 * RA;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2938 $('#wa_base').val(Round(RA, 2));
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2939 setWaterAgent('CaCO3', Round(RA, 2));
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2940 if (liters > 0) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2941 //Bicarbonate
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2942 RA = parseFloat($('#wa_base').jqxNumberInput('decimal')) / 3 * MMHCO3 / MMCaCO3;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2943 RA = 1000 * RA / liters;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2944 bicarbonate = wg_bicarbonate + RA;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2945 total_alkalinity = bicarbonate * 50 / 61;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2946 //Ca precipitates out as Ca10(PO4)6(OH)2
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2947 RA = parseFloat($('#wa_cacl2').jqxNumberInput('decimal')) * MMCa / MMCaCl2 +
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2948 parseFloat($('#wa_caso4').jqxNumberInput('decimal')) * MMCa / MMCaSO4 +
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2949 parseFloat($('#wa_base').jqxNumberInput('decimal')) * MMCa / MMCaCO3;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2950 RA = 1000 * RA / liters;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2951 calcium = wg_calcium + RA;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2952 RA = ResidualAlkalinity(wb_total_alkalinity, wb_calcium, wb_magnesium);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2953 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2954 break;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2955 case 3:
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2956 RA = -protonDeficit / 19.3; // Calciumhydroxide
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2957 $('#wa_base').val(Round(RA, 2));
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2958 setWaterAgent('Ca(OH)2', Round(RA, 2));
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2959 if (liters > 0) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2960 // Bicarbonate
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2961 RA = -protonDeficit / liters;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2962 total_alkalinity = wg_total_alkalinity + RA;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2963 bicarbonate = total_alkalinity * 61 / 50;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2964 // Calcium
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2965 RA = parseFloat($('#wa_cacl2').jqxNumberInput('decimal')) * MMCa / MMCaCl2 +
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2966 parseFloat($('#wa_caso4').jqxNumberInput('decimal')) * MMCa / MMCaSO4 +
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2967 parseFloat($('#wa_base').jqxNumberInput('decimal')) * MMCa / MMCaOH2;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2968 RA = 1000 * RA / liters;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2969 calcium = wg_calcium + RA;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2970 RA = ResidualAlkalinity(wb_total_alkalinity, wb_calcium, wb_magnesium);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2971 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2972 break;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2973 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2974 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2975 ph = TpH;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2976 $('#wb_ph').val(Round(ph, 1));
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2977 $('#est_mash_ph').val(Round(ph, 1));
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2978 } else { // Manual
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2979 console.log('calc_acid no');
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2980 // First add base salts
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2981 if (parseFloat($('#wa_base').jqxNumberInput('decimal')) > 0) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2982 if (liters > 0) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2983 switch (BT) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2984 case 0: // Sodiumbicarbonate, Na
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2985 RA = parseFloat($('#wa_nacl').jqxNumberInput('decimal')) * MMNa / MMNaCl +
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2986 parseFloat($('#wa_base').jqxNumberInput('decimal')) * MMNa / MMNaHCO3;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2987 RA = 1000 * RA / liters;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2988 sodium = wg_sodium + RA;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2989 // HCO3
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2990 RA = parseFloat($('#wa_base').jqxNumberInput('decimal')) * MMHCO3 / MMNaHCO3;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2991 RA = 1000 * RA / liters;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2992 bicarbonate = wg_bicarbonate + RA;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2993 total_alkalinity = bicarbonate * 50 / 61;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2994 RA = ResidualAlkalinity(wb_total_alkalinity, wb_calcium, wb_magnesium);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2995 break;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2996 case 1: // Sodiumcarbonate
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2997 RA = parseFloat($('#wa_nacl').jqxNumberInput('decimal')) * MMNa / MMNaCl +
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2998 parseFloat($('#wa_base').jqxNumberInput('decimal')) * 2 * MMNa / MMNa2CO3;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
2999 RA = 1000 * RA / liters;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3000 sodium = wg_sodium + RA;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3001 // HCO3
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3002 RA = parseFloat($('#wa_base').jqxNumberInput('decimal')) * MMHCO3 / MMNa2CO3;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3003 RA = 1000 * RA / liters;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3004 bicarbonate = wg_bicarbonate + RA;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3005 total_alkalinity = bicarbonate * 50 / 61;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3006 RA = ResidualAlkalinity(wb_total_alkalinity, wb_calcium, wb_magnesium);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3007 break;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3008 case 2: // Calciumcarbonate: Bicarbonate
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3009 RA = parseFloat($('#wa_base').jqxNumberInput('decimal')) / 3 * MMHCO3 / MMCaCO3;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3010 RA = 1000 * RA / liters;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3011 bicarbonate = wg_bicarbonate + RA;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3012 total_alkalinity = bicarbonate * 50 / 61;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3013 RA = ResidualAlkalinity(wb_total_alkalinity, wb_calcium, wb_magnesium);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3014 // Ca
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3015 RA = parseFloat($('#wa_cacl2').jqxNumberInput('decimal')) * MMCa / MMCaCl2 +
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3016 parseFloat($('#wa_caso4').jqxNumberInput('decimal')) * MMCa / MMCaSO4 +
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3017 parseFloat($('#wa_base').jqxNumberInput('decimal')) * MMCa / MMCaCO3;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3018 RA = 1000 * RA / liters;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3019 calcium = wg_calcium + RA;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3020 break;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3021 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3022 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3023 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3024
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3025 TpH = parseFloat(dataRecord.mash_ph);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3026 pHa = MashpH(); // This one is in demi water, should be in adjusted water???
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3027 // Then calculate the new pH with added acids
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3028 if (parseFloat($('#wa_acid').jqxNumberInput('decimal')) > 0) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3029 console.log('TpH: ' + TpH + ' water: ' + pHa);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3030 Acid = parseFloat($('#wa_acid').jqxNumberInput('decimal'));
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3031 if (parseFloat($('#wa_acid_perc').jqxNumberInput('decimal')) == 0)
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3032 $('#wa_acid_perc').val(AcidPrc);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3033 Acid = Acid / AcidPrc * (parseFloat($('#wa_acid_perc').jqxNumberInput('decimal')) / 100); // ml
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3034 Acid *= AcidSG; // ml
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3035 Acid /= MolWt; // mg
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3036 Acidmg = Acid;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3037
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3038 //find the pH where the protondeficit = protondeficit by the acid
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3039 frac = CalcFrac(pHa, pK1, pK2, pK3);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3040 protonDeficit = Acid * frac;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3041
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3042 deltapH = 0.001;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3043 deltapd = 0.1;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3044 pd = ProtonDeficit(pHa);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3045 n = 0;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3046 while (((pd < (protonDeficit - deltapd)) || (pd > (protonDeficit + deltapd))) && (n < 2000)) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3047 n++;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3048 if (pd < (protonDeficit - deltapd))
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3049 pHa -= deltapH;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3050 else if (pd > (protonDeficit + deltapd))
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3051 pHa += deltapH;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3052 frac = CalcFrac(pHa, pK1, pK2, pK3);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3053 protonDeficit = Acid * frac;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3054 pd = ProtonDeficit(pHa);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3055 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3056 console.log('n: ' + n + ' pd: ' + pd + ' protonDeficit: ' + protonDeficit + ' frac: ' + frac + ' pHa: ' + pHa);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3057 RA = wg_bicarbonate - protonDeficit * frac / liters;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3058 bicarbonate = RA;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3059 total_alkalinity = RA * 50 / 61;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3060 ph = pHa;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3061 $('#wb_ph').val(Round(ph, 1));
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3062 $('#est_mash_ph').val(Round(ph, 1));
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3063 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3064 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3065
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3066 if ((AT == 3) && (liters > 0)) { // Sulfuctic / Zwavelzuur
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3067 RA = parseFloat($('#wa_caso4').jqxNumberInput('decimal')) * MMSO4 / MMCaSO4 +
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3068 parseFloat($('#wa_mgso4').jqxNumberInput('decimal')) * MMSO4 / MMMgSO4 +
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3069 Acidmg / 1000 * MMSO4 / (MMSO4 + 2);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3070 RA = 1000 * RA / liters;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3071 sulfate = wg_sulfate + RA; // Not add to sulfate??
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3072 } else if ((AT == 1) && (liters > 0)) { // Hydrochloric, Zoutzuur
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3073 RA = parseFloat($('#wa_cacl2').jqxNumberInput('decimal')) * MMCl / MMCaCl2 +
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3074 parseFloat($('#wa_nacl').jqxNumberInput('decimal')) * MMCl / MMNaCl +
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3075 Acidmg / 1000 * MMCl / (MMCl + 1);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3076 RA = 1000 * RA / liters;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3077 chloride = wg_chloride + RA;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3078 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3079
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3080 // 2:1 Sulfate to Chroride IPA's, Pale Ales.
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3081 // 1:1 Sulfate to Chloride Balanced
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3082 // 1:2 Sulfate to Chloride Malty
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3083 // Note, values below are the other way, cl to so4!
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3084 // So: 0.5 is IPA's, Pale Ales.
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3085 // 1 Balanced
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3086 // 2 Malty.
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3087 $('#tgt_bu').val(Round(GetBUGU(), 2));
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3088 // From brouwhulp.
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3089 if (GetBUGU() < 0.32)
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3090 $('#wr_bu').html("<span style='vertical-align: top; font-size: 14px; font-style: italic;'>Zeer moutig en zoet</span>");
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3091 else if (GetBUGU() < 0.43)
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3092 $('#wr_bu').html("<span style='vertical-align: top; font-size: 14px; font-style: italic;'>Moutig, zoet</span>");
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3093 else if (GetBUGU() < 0.52)
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3094 $('#wr_bu').html("<span style='vertical-align: top; font-size: 14px; font-style: italic;'>Evenwichtig</span>");
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3095 else if (GetBUGU() < 0.63)
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3096 $('#wr_bu').html("<span style='vertical-align: top; font-size: 14px; font-style: italic;'>Licht hoppig, bitter</span>");
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3097 else
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3098 $('#wr_bu').html("<span style='vertical-align: top; font-size: 14px; font-style: italic;'>Extra hoppig, zeer bitter</span>");
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3099 $('#tgt_cl_so4').val(Round(GetOptClSO4ratio(), 1));
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3100 if (sulfate > 0)
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3101 RA = chloride / sulfate;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3102 else
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3103 RA = 10;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3104 $('#got_cl_so4').val(Round(RA, 1));
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3105 piCLSO4_low = 0.8 * GetOptClSO4ratio();
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3106 piCLSO4_high = 1.2 * GetOptClSO4ratio();
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3107 Res = 'normaal';
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3108 if (RA < piCLSO4_low)
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3109 Res = 'laag';
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3110 else if (RA > piCLSO4_high)
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3111 Res = 'hoog';
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3112 setRangeIndicator('cl_so4', Res);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3113
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3114 $('#wb_calcium').val(Round(calcium, 1));
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3115 $('#wb_magnesium').val(Round(magnesium, 1));
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3116 $('#wb_sodium').val(Round(sodium, 1));
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3117 $('#wb_sulfate').val(Round(sulfate, 1));
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3118 $('#wb_chloride').val(Round(chloride, 1));
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3119 $('#wb_total_alkalinity').val(Round(total_alkalinity, 1));
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3120
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3121 if (calcium < 40) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3122 setRangeIndicator('calcium', 'laag');
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3123 } else if (calcium > 150) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3124 setRangeIndicator('calcium', 'hoog');
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3125 } else {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3126 setRangeIndicator('calcium', 'normaal');
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3127 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3128 if (magnesium >= 0 && magnesium <= 30) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3129 setRangeIndicator('magnesium', 'normaal');
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3130 } else {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3131 setRangeIndicator('magnesium', 'hoog');
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3132 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3133 if (sodium <= 150) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3134 setRangeIndicator('sodium', 'normaal');
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3135 } else {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3136 setRangeIndicator('sodium', 'hoog');
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3137 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3138 // Both chloride and sulfate should be above 50 according to
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3139 // John Palmer. So the Cl/SO4 ratio calculation will work.
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3140 if (chloride <= 50) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3141 setRangeIndicator('chloride', 'laag');
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3142 } else if (chloride <= 100) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3143 setRangeIndicator('chloride', 'normaal');
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3144 } else {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3145 setRangeIndicator('chloride', 'hoog');
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3146 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3147 if (sulfate <= 50) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3148 setRangeIndicator('sulfate', 'laag');
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3149 } else if (sulfate <= 350) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3150 setRangeIndicator('sulfate', 'normaal');
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3151 } else {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3152 setRangeIndicator('sulfate', 'hoog');
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3153 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3154 if (ph < 5.2) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3155 setRangeIndicator('ph', 'laag');
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3156 } else if (ph > 5.6) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3157 setRangeIndicator('ph', 'hoog');
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3158 } else {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3159 setRangeIndicator('ph', 'normaal');
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3160 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3161 calcSparge();
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3162 calcMiscs();
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3163 calcSupplies();
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3164 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3165
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3166 function calcSparge() {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3167
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3168 var TargetpH, Source_pH, Source_alkalinity, r1, r2, d, f1, f3, r143, r243, d43, f143, f343,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3169 alkalinity, Ct, r1g, r2g, dg, f1g, f3g, Acid, AT, result, pK1, pK2, pK3, MolWt, AcidSG, AcidPrc, fract;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3170
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3171 // Code from BrewBuddy/Brouwhulp, who got it from http://www.brewery.org/brewery/library/Acidi0,00fWaterAJD0497.html
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3172 TargetpH = dataRecord.sparge_ph;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3173 Source_pH = dataRecord.w1_ph;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3174 Source_alkalinity = dataRecord.w1_total_alkalinity;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3175 // Select watersource or fallback to the first source.
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3176 if (dataRecord.sparge_source == 1) { // Source 2
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3177 if (dataRecord.w2_ph > 0.0) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3178 Source_pH = dataRecord.w2_ph;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3179 Source_alkalinity = dataRecord.w2_total_alkalinity;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3180 } else {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3181 dataRecord.sparge_source = 0; // Source 1
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3182 $('#sparge_source').val(0);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3183 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3184 } else if (dataRecord.sparge_source == 2) { // Mixed
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3185 if (dataRecord.w2_ph > 0.0) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3186 Source_pH = parseFloat($('#wg_ph').jqxNumberInput('decimal'));
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3187 Source_alkalinity = parseFloat($('#wg_total_alkalinity').jqxNumberInput('decimal'));
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3188 } else {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3189 dataRecord.sparge_source = 0;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3190 $('#sparge_source').val(0);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3191 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3192 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3193
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3194 // Step 1: Compute the mole fractions of carbonic (f1o), bicarbonate (f2o) and carbonate(f3o) at the water pH
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3195 r1 = Math.pow(10, Source_pH - 6.38);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3196 r2 = Math.pow(10, Source_pH - 10.373);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3197 d = 1 + r1 + r1 * r2;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3198 f1 = 1 / d;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3199 f3 = r1 * r2 / d;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3200
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3201 //Step 2. Compute the mole fractions at pH = 4.3 (the pH which defines alkalinity)
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3202 r143 = Math.pow(10, 4.3 - 6.38);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3203 r243 = Math.pow(10, 4.3 - 10.373);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3204 d43 = 1 + r143 + r143 * r243;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3205 f143 = 1 / d43;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3206 f343 = r143 * r243 / d43;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3207
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3208 //Step 3. Convert the water alkalinity to milliequivalents/L
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3209 alkalinity = Source_alkalinity / 50;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3210
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3211 //Step 4. Solve
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3212 Ct = (alkalinity - 1000 * (Math.pow(10, -4.3) - Math.pow(10, -Source_pH))) / ((f143 - f1) + (f3 - f343));
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3213
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3214 //Step 5. Compute mole fractions at desired pH
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3215 r1g = Math.pow(10, TargetpH - 6.38);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3216 r2g = Math.pow(10, TargetpH - 10.373);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3217 dg = 1 + r1g + r1g * r2g;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3218 f1g = 1 / dg;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3219 f3g = r1g * r2g / dg;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3220
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3221 //Step 6. Use these to compute the milliequivalents acid required per liter (mEq/L)
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3222 Acid = Ct * ((f1g - f1) + (f3 - f3g)) + Math.pow(10, -TargetpH) - Math.pow(10, -Source_pH); //mEq/l
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3223 Acid += 0.01; // Add acid that would be required for distilled water.
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3224 if (dataRecord.sparge_acid_type < 0 || dataRecord.sparge_acid_type > 3) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3225 dataRecord.sparge_acid_type = 0;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3226 $('#sparge_acid_type').val(0);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3227 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3228
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3229 //Step 8. Get the acid data.
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3230 AT = dataRecord.sparge_acid_type;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3231 result = GetAcidSpecs(AT);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3232 pK1 = result.pK1;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3233 pK2 = result.pK2;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3234 pK3 = result.pK3;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3235 MolWt = result.MolWt;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3236 AcidSG = result.AcidSG;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3237 AcidPrc = result.AcidPrc;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3238 fract = CalcFrac(TargetpH, pK1, pK2, pK3);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3239
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3240 //Step 9. Now divide the mEq required by the "fraction". This is the required number of moles of acid.
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3241 Acid /= fract;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3242
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3243 //Step 10. Multiply by molecular weight of the acid
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3244 Acid *= MolWt; //mg
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3245
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3246 Acid = Acid / AcidSG; //ml ; 88% lactic solution
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3247 f1 = dataRecord.sparge_acid_perc;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3248 if (f1 <= 0.1)
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3249 f1 = AcidPrc;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3250 Acid = Acid * AcidPrc / (f1 / 100);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3251
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3252 Acid *= dataRecord.sparge_volume; //ml lactic acid total
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3253 Acid = Round(Acid, 2);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3254 dataRecord.sparge_acid_amount = Acid / 1000;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3255 $('#sparge_acid_amount').val(Acid);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3256 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3257
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3258 function calcFermentation() {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3259 var primary_svg, secondary_svg, final_svg, ABV;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3260 if (dataRecord.brew_fermenter_sg < 1.020)
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3261 return;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3262 if ((dataRecord.primary_end_sg > 0.990) && (dataRecord.primary_end_sg < dataRecord.brew_fermenter_sg)) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3263 primary_svg = Round(100 * (dataRecord.brew_fermenter_sg - dataRecord.primary_end_sg) / (dataRecord.brew_fermenter_sg - 1), 1);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3264 $('#primary_svg').val(primary_svg);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3265 if ((dataRecord.secondary_end_sg > 0.990) && (dataRecord.secondary_end_sg < dataRecord.brew_fermenter_sg)) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3266 secondary_svg = Round(100 * (dataRecord.brew_fermenter_sg - dataRecord.secondary_end_sg) / (dataRecord.brew_fermenter_sg - 1), 1);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3267 $('#secondary_svg').val(secondary_svg);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3268 if ((dataRecord.fg > 0.990) && (dataRecord.fg < dataRecord.brew_fermenter_sg)) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3269 final_svg = Round(100 * (dataRecord.brew_fermenter_sg - dataRecord.fg) / (dataRecord.brew_fermenter_sg - 1), 1);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3270 $('#final_svg').val(final_svg);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3271 ABV = Round(abvol(dataRecord.brew_fermenter_sg, dataRecord.fg), 2);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3272 $('#final_abv').val(ABV);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3273 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3274 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3275 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3276 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3277
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3278 function ResCO2(CO2, T) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3279 var F = T * 1.8 + 32;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3280 return 3.0378 - 0.050062 * F + 0.00026555 * F * F;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3281 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3282
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3283 function CarbCO2toS(CO2, T, SFactor) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3284 var sugar = SFactor * (CO2 - ResCO2(CO2, T)) / 0.286;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3285 if (sugar < 0)
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3286 sugar = 0;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3287 return Round(sugar, 3);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3288 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3289
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3290 function GetPressure(CO2, T1, T2) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3291 var P, V = CO2 - ResCO2(CO2, T1);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3292 if (V < 0)
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3293 return 0;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3294 P = -1.09145427669121 + 0.00800006989646477 * T2 + 0.000260276315484684 * T2 * T2 + 0.0215142075945119 * T2 * V +
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3295 0.674996600795854 * V + -0.00471757220150754 * V * V;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3296 //console.log("CO2: "+CO2+" "+V+" Temp: "+T1+" "+T2+" Pressure: "+P);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3297 if (P < 0)
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3298 P = 0;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3299 P = P * 1.01325; // atm to bar
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3300 return Round(P, 1);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3301 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3302
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3303 function CarbCO2ToPressure(CO2, T) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3304 return (CO2 - (-0.000005594056 * Math.pow(T, 4) + 0.000144357886 * Math.pow(T, 3) +
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3305 0.000362999168 * T * T - 0.064872987645 * T + 1.641145175049)) /
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3306 (0.00000498031 * Math.pow(T, 4) - 0.00024358267 * Math.pow(T, 3) + 0.00385867329 * T * T - 0.05671206825 * T + 1.53801423376);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3307 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3308
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3309 function calcCarbonation() {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3310
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3311 var TSec, ABV, bvol, balc, babv, mvol, malc, tvol, talc, i, row, SFactor, pvol, pabv, Pressure, kabv;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3312
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3313 TSec = dataRecord.secondary_temp;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3314 if (TSec < 1)
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3315 TSec = dataRecord.primary_end_temp;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3316 if (TSec < 1)
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3317 TSec = 18;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3318
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3319 if (dataRecord.fg == 0.000)
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3320 ABV = abvol(dataRecord.brew_fermenter_sg, parseFloat($('#est_fg').jqxNumberInput('decimal')));
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3321 else
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3322 ABV = abvol(dataRecord.brew_fermenter_sg, dataRecord.fg);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3323
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3324 /* Calculate new volume and alcohol. */
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3325 bvol = dataRecord.package_volume - (ABV * dataRecord.package_volume) / 100;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3326 balc = dataRecord.package_volume - bvol;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3327 mvol = dataRecord.package_infuse_amount - (dataRecord.package_infuse_abv * dataRecord.package_infuse_amount) / 100;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3328 malc = dataRecord.package_infuse_amount - mvol;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3329 talc = balc + malc;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3330 tvol = bvol + mvol;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3331 ABV = Round(talc / (tvol + talc) * 100, 2);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3332 dataRecord.package_abv = ABV;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3333 $('#package_abv').val(ABV);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3334
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3335 //console.log("calcCarbonation() TSec:"+TSec+" ABV:"+ABV);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3336 if (!(rows = $('#fermentableGrid').jqxGrid('getrows'))) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3337 return;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3338 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3339
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3340 // Bottles
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3341 dataRecord.bottle_priming_amount = 0;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3342 dataRecord.bottle_priming_total = 0;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3343 for (i = 0; i < rows.length; i++) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3344 row = rows[i];
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3345 if (row.f_added == 4) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3346 SFactor = 1 / ((row.f_yield / 100) * (1 - row.f_moisture / 100));
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3347 dataRecord.bottle_priming_amount = CarbCO2toS(dataRecord.bottle_carbonation, TSec, SFactor);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3348 dataRecord.bottle_priming_total = Round(dataRecord.bottle_amount * dataRecord.bottle_priming_amount, 2);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3349 $('#fermentableGrid').jqxGrid('setcellvalue', i, 'f_amount', dataRecord.bottle_priming_total / 1000);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3350 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3351 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3352 $('#bottle_priming_amount').val(Round(dataRecord.bottle_priming_amount, 1));
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3353 $('#bottle_priming_total').val(dataRecord.bottle_priming_total);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3354 pabv = ABV + dataRecord.bottle_priming_amount * 0.47 / 7.907;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3355 pvol = dataRecord.bottle_amount - (pabv * dataRecord.bottle_amount) / 100;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3356 talc = dataRecord.bottle_amount - pvol;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3357 tvol = pvol + dataRecord.bottle_priming_water;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3358 babv = Round(talc / (tvol + talc) * 100, 2);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3359 //console.log("bottle pabv:"+pabv+" pvol:"+pvol+" wvol:"+dataRecord.bottle_priming_water+" tvol:"+tvol+" talc:"+talc+" abv:"+babv);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3360 $('#bottle_abv').val(babv);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3361 $('#bottle_pressure').val(GetPressure(dataRecord.bottle_carbonation, TSec, dataRecord.bottle_carbonation_temp));
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3362
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3363 // Kegs
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3364 Pressure = CarbCO2ToPressure(dataRecord.keg_carbonation, dataRecord.keg_carbonation_temp);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3365 if (Pressure < 0)
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3366 Pressure = 0;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3367 dataRecord.keg_pressure = Pressure;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3368 $('#keg_pressure').val(Round(Pressure, 1));
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3369
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3370 dataRecord.keg_priming_amount = 0;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3371 dataRecord.keg_priming_total = 0;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3372 if (!dataRecord.keg_forced_carb) {
469
3d532097860d Code optimisation for compressed javascript in the product editor
Michiel Broek <mbroek@mbse.eu>
parents: 464
diff changeset
3373 for (i = 0; i < rows.length; i++) {
3d532097860d Code optimisation for compressed javascript in the product editor
Michiel Broek <mbroek@mbse.eu>
parents: 464
diff changeset
3374 row = rows[i];
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3375 if (row.f_added == 5) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3376 SFactor = 1 / ((row.f_yield / 100) * (1 - row.f_moisture / 100));
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3377 dataRecord.keg_priming_amount = CarbCO2toS(dataRecord.keg_carbonation, TSec, SFactor);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3378 dataRecord.keg_priming_total = Round(dataRecord.keg_amount * dataRecord.keg_priming_amount, 2);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3379 $('#fermentableGrid').jqxGrid('setcellvalue', i, 'f_amount', dataRecord.keg_priming_total / 1000);
469
3d532097860d Code optimisation for compressed javascript in the product editor
Michiel Broek <mbroek@mbse.eu>
parents: 464
diff changeset
3380 }
3d532097860d Code optimisation for compressed javascript in the product editor
Michiel Broek <mbroek@mbse.eu>
parents: 464
diff changeset
3381 }
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3382 $('#keg_priming_amount').val(Round(dataRecord.keg_priming_amount, 1));
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3383 $('#keg_priming_total').val(dataRecord.keg_priming_total);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3384 pabv = ABV + dataRecord.keg_priming_amount * 0.47 / 7.907;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3385 pvol = dataRecord.keg_amount - (pabv * dataRecord.keg_amount) / 100;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3386 talc = dataRecord.keg_amount - pvol;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3387 tvol = pvol + dataRecord.keg_priming_water;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3388 kabv = Round(talc / (tvol + talc) * 100, 2);
469
3d532097860d Code optimisation for compressed javascript in the product editor
Michiel Broek <mbroek@mbse.eu>
parents: 464
diff changeset
3389 //console.log("kegs pabv:"+pabv+" pvol:"+pvol+" wvol:"+dataRecord.keg_priming_water+" tvol:"+tvol+" talc:"+talc+" abv:"+kabv);
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3390 $('#keg_abv').val(kabv);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3391 } else {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3392 $('#keg_priming_amount').val(0);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3393 $('#keg_priming_total').val(0);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3394 $('#keg_abv').val(ABV);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3395 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3396 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3397
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3398 function calcStage() {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3399
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3400 var newstage = dataRecord.stage, d, date1, date2, date1_unixtime, date2_unixtime, timeDifference, timeDifferenceInDays;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3401
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3402 if (newstage == 0 && dataRecord.est_og > 1.005 && dataRecord.est_color > 3 && dataRecord.est_ibu > 3)
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3403 newstage = 1;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3404 if (newstage == 1 && parseFloat($('#brew_date_start').val()) > 2000)
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3405 newstage = 2; // Brewday
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3406 if (newstage == 2 && ($('#brew_date_start').val() == ''))
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3407 newstage = 1; // No brewday
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3408 if (newstage == 2 && parseFloat($('#brew_date_end').val()) > 2000)
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3409 newstage = 3; // Primary
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3410 if (newstage == 3 && parseFloat($('#primary_end_date').val()) > 2000)
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3411 newstage = 4; // Secondary
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3412 if (newstage == 4 && parseFloat($('#secondary_end_date').val()) > 2000)
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3413 newstage = 5; // Tertiary
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3414 if (newstage == 5 && parseFloat($('#package_date').val()) > 2000)
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3415 newstage = 6; // Package
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3416 if (newstage >= 6 && newstage < 9) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3417 d = new Date();
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3418 date2 = $('#package_date').val();
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3419 date2 = date2.split('-');
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3420 // Now we convert the array to a Date object
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3421 date1 = new Date(d.getFullYear(), d.getMonth(), d.getDate());
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3422 date2 = new Date(date2[0], date2[1] - 1, date2[2]);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3423 // We use the getTime() method and get the unixtime
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3424 date1_unixtime = parseInt(date1.getTime() / 1000);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3425 date2_unixtime = parseInt(date2.getTime() / 1000);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3426 // This is the calculated difference in seconds
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3427 timeDifference = date1_unixtime - date2_unixtime;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3428 timeDifferenceInDays = timeDifference / 60 / 60 / 24;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3429 if (timeDifferenceInDays > 0) { // At least one day
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3430 if (timeDifferenceInDays >= 42) // 6 weeks
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3431 newstage = 9; // Ready to taste
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3432 else if (timeDifferenceInDays >= 14) // 14 days
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3433 newstage = 8; // Mature
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3434 else
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3435 newstage = 7; // Carbonation
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3436 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3437 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3438 if (newstage == 9 && parseFloat($('#taste_date').val()) > 2000)
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3439 newstage = 10; // Ready
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3440
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3441 if (newstage != dataRecord.stage) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3442 console.log('calcStage() old: ' + dataRecord.stage + ' new: ' + newstage);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3443 dataRecord.stage = newstage;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3444 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3445
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3446 /*
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3447 * Set stage and enable or disable parts of the screens.
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3448 */
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3449 $('#stage').val(StageData[dataRecord.stage].nl);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3450 if (dataRecord.stage >= 10) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3451 $('#locked').jqxCheckBox({ disabled: false });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3452 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3453
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3454 /*
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3455 * When the brew is in progress or done, block equipment select and delete.
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3456 */
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3457 if (dataRecord.stage > 1) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3458 $('#equipmentSelect').jqxDropDownList({ disabled: true });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3459 $('#Delete').jqxButton({ disabled: true });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3460 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3461
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3462 if (dataRecord.stage < 1) // Planning, no ingredients
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3463 $('#jqxTabs').jqxTabs('disableAt', 8); // Brewday tab
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3464 else
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3465 $('#jqxTabs').jqxTabs('enableAt', 8);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3466
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3467 if (dataRecord.stage < 3) { // Primary
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3468 $('#jqxTabs').jqxTabs('disableAt', 9); // Fermentation tab
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3469 } else {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3470 $('#jqxTabs').jqxTabs('enableAt', 9);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3471 $('#name').jqxInput({ disabled: true });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3472 $('#code').jqxInput({ disabled: true });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3473 $('#batch_size').jqxNumberInput({ spinButtons: false, readOnly: true, width: 90 });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3474 $('#boil_size').jqxNumberInput({ spinButtons: false, readOnly: true, width: 90 });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3475 $('#boil_time').jqxNumberInput({ spinButtons: false, readOnly: true, width: 90 });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3476 $('#efficiency').jqxNumberInput({ spinButtons: false, readOnly: true, width: 90 });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3477 $('#est_og').jqxNumberInput({ spinButtons: false, readOnly: true, width: 90 });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3478 $('#type').jqxDropDownList({ disabled: true });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3479 $('#styleSelect').jqxDropDownList({ disabled: true });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3480 $('#color_method').jqxDropDownList({ disabled: true });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3481 $('#ibu_method').jqxDropDownList({ disabled: true });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3482 $('#mash_select').jqxDropDownList({ disabled: true });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3483 $('#w1_name').jqxDropDownList({ disabled: true });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3484 $('#w2_name').jqxDropDownList({ disabled: true });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3485 $('#w2_amount').jqxNumberInput({ readOnly: true });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3486 $('#pr_name').jqxDropDownList({ disabled: true });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3487 $('#wa_cacl2').jqxNumberInput({ spinButtons: false, readOnly: true, width: 90 });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3488 $('#wa_caso4').jqxNumberInput({ spinButtons: false, readOnly: true, width: 90 });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3489 $('#wa_mgso4').jqxNumberInput({ spinButtons: false, readOnly: true, width: 90 });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3490 $('#wa_nacl').jqxNumberInput({ spinButtons: false, readOnly: true, width: 90 });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3491 $('#mash_ph').jqxNumberInput({ spinButtons: false, readOnly: true, width: 90 });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3492 $('#calc_acid').jqxCheckBox({ disabled: true });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3493 $('#wa_base_name').jqxDropDownList({ disabled: true });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3494 $('#wa_base').jqxNumberInput({ spinButtons: false, readOnly: true, width: 90 });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3495 $('#wa_acid_name').jqxDropDownList({ disabled: true });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3496 $('#wa_acid').jqxNumberInput({ spinButtons: false, readOnly: true, width: 90 });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3497 $('#wa_acid_perc').jqxNumberInput({ spinButtons: false, readOnly: true, width: 70 });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3498 $('#sparge_temp').jqxNumberInput({ spinButtons: false, readOnly: true, width: 90 });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3499 $('#sparge_volume').jqxNumberInput({ spinButtons: false, readOnly: true, width: 90 });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3500 $('#sparge_ph').jqxNumberInput({ spinButtons: false, readOnly: true, width: 90 });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3501 $('#sparge_source').jqxDropDownList({ disabled: true });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3502 $('#sparge_acid_type').jqxDropDownList({ disabled: true });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3503 $('#sparge_acid_perc').jqxNumberInput({ spinButtons: false, readOnly: true, width: false });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3504 $('#starter_enable').jqxCheckBox({ disabled: true });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3505 $('#starter_type').jqxDropDownList({ disabled: true });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3506 $('#starter_try').jqxButton({ disabled: true });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3507 $('#starter_sg').jqxNumberInput({ spinButtons: false, readOnly: true, width: 90 });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3508 $('#starter_viability').jqxNumberInput({ spinButtons: false, readOnly: true, width: 90 });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3509 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3510 if (dataRecord.stage > 3) { // Primary fermentation done
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3511 $('#brew_date_start').jqxDateTimeInput({ disabled: true });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3512 $('#brew_date_end').jqxDateTimeInput({ disabled: true });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3513 $('#brew_mash_ph').jqxNumberInput({ spinButtons: false, readOnly: true, width: 90 });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3514 $('#brew_preboil_ph').jqxNumberInput({ spinButtons: false, readOnly: true, width: 90 });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3515 $('#brew_aboil_ph').jqxNumberInput({ spinButtons: false, readOnly: true, width: 90 });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3516 $('#brew_mash_sg').jqxNumberInput({ spinButtons: false, readOnly: true, width: 90 });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3517 $('#brew_preboil_sg').jqxNumberInput({ spinButtons: false, readOnly: true, width: 90 });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3518 $('#brew_aboil_sg').jqxNumberInput({ spinButtons: false, readOnly: true, width: 90 });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3519 $('#brew_preboil_volume').jqxNumberInput({ spinButtons: false, readOnly: true, width: 90 });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3520 $('#brew_aboil_volume').jqxNumberInput({ spinButtons: false, readOnly: true, width: 90 });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3521 $('#brew_whirlpool9').jqxNumberInput({ spinButtons: false, readOnly: true, width: 90 });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3522 $('#brew_cooling_to').jqxNumberInput({ spinButtons: false, readOnly: true, width: 90 });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3523 $('#brew_whirlpool7').jqxNumberInput({ spinButtons: false, readOnly: true, width: 90 });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3524 $('#brew_cooling_method').jqxDropDownList({ disabled: true });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3525 $('#brew_whirlpool6').jqxNumberInput({ spinButtons: false, readOnly: true, width: 90 });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3526 $('#brew_cooling_time').jqxNumberInput({ spinButtons: false, readOnly: true, width: 90 });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3527 $('#brew_sparge_ph').jqxNumberInput({ spinButtons: false, readOnly: true, width: 90 });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3528 $('#brew_whirlpool2').jqxNumberInput({ spinButtons: false, readOnly: true, width: 90 });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3529 $('#brew_aeration_type').jqxDropDownList({ disabled: true });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3530 $('#brew_fermenter_tcloss').jqxNumberInput({ spinButtons: false, readOnly: true, width: 90 });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3531 $('#brew_aeration_time').jqxNumberInput({ spinButtons: false, readOnly: true, width: 90 });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3532 $('#brew_fermenter_extrawater').jqxNumberInput({ spinButtons: false, readOnly: true, width: 90 });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3533 $('#brew_aeration_speed').jqxNumberInput({ spinButtons: false, readOnly: true, width: 90 });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3534 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3535 if (dataRecord.stage == 5) // Lagering, allow packaging
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3536 $('#package_date').jqxDateTimeInput({ disabled: false });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3537 else
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3538 $('#package_date').jqxDateTimeInput({ disabled: true });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3539 if (dataRecord.stage >= 5) { // At least secondary
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3540 $('#primary_start_temp').jqxNumberInput({ spinButtons: false, readOnly: true, width: 90 });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3541 $('#primary_max_temp').jqxNumberInput({ spinButtons: false, readOnly: true, width: 90 });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3542 $('#primary_end_temp').jqxNumberInput({ spinButtons: false, readOnly: true, width: 90 });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3543 $('#primary_end_sg').jqxNumberInput({ spinButtons: false, readOnly: true, width: 90 });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3544 $('#primary_end_brix').jqxNumberInput({ spinButtons: false, readOnly: true, width: 90 });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3545 $('#primary_end_date').jqxDateTimeInput({ disabled: true });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3546 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3547 if (dataRecord.stage >= 6) { // Packaged
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3548 $('#secondary_temp').jqxNumberInput({ spinButtons: false, readOnly: true, width: 90 });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3549 $('#secondary_end_sg').jqxNumberInput({ spinButtons: false, readOnly: true, width: 90 });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3550 $('#secondary_end_date').jqxDateTimeInput({ disabled: true });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3551 $('#tertiary_temp').jqxNumberInput({ spinButtons: false, readOnly: true, width: 90 });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3552 $('#fg').jqxNumberInput({ spinButtons: false, readOnly: true, width: 90 });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3553 $('#final_brix').jqxNumberInput({ spinButtons: false, readOnly: true, width: 90 });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3554 $('#package_date').jqxDateTimeInput({ disabled: true });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3555 $('#package_volume').jqxNumberInput({ spinButtons: false, readOnly: true, width: 90 });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3556 $('#package_infuse_amount').jqxNumberInput({ spinButtons: false, readOnly: true, width: 90 });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3557 $('#package_infuse_abv').jqxNumberInput({ spinButtons: false, readOnly: true, width: 90 });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3558 $('#package_infuse_notes').jqxInput({ disabled: true });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3559 $('#package_ph').jqxNumberInput({ spinButtons: false, readOnly: true, width: 90 });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3560 $('#bottle_amount').jqxNumberInput({ spinButtons: false, readOnly: true, width: 90 });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3561 $('#bottle_priming_water').jqxNumberInput({ spinButtons: false, readOnly: true, width: 90 });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3562 $('#keg_priming_water').jqxNumberInput({ spinButtons: false, readOnly: true, width: 90 });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3563 $('#keg_amount').jqxNumberInput({ spinButtons: false, readOnly: true, width: 90 });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3564 $('#bottle_carbonation').jqxNumberInput({ spinButtons: false, readOnly: true, width: 90 });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3565 $('#keg_carbonation').jqxNumberInput({ spinButtons: false, readOnly: true, width: 90 });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3566 $('#bottle_priming_sugar').jqxDropDownList({ disabled: true });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3567 $('#keg_priming_sugar').jqxDropDownList({ disabled: true });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3568 $('#keg_forced_carb').jqxCheckBox({ disabled: true });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3569 $('#bottle_carbonation_temp').jqxNumberInput({ spinButtons: false, readOnly: true, width: 90 });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3570 $('#keg_carbonation_temp').jqxNumberInput({ spinButtons: false, readOnly: true, width: 90 });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3571 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3572 if (dataRecord.stage < 8) { // Taste when at least Mature.
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3573 $('#jqxTabs').jqxTabs('disableAt', 11); // Tasting tab
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3574 } else {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3575 $('#jqxTabs').jqxTabs('enableAt', 11);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3576 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3577
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3578 if (dataRecord.stage == 11) { // Locked
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3579 $('#taste_date').jqxDateTimeInput({ disabled: true });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3580 $('#taste_rate').jqxNumberInput({ spinButtons: false, readOnly: true, width: 90 });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3581 $('#taste_color').jqxInput({ disabled: true });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3582 $('#taste_transparency').jqxInput({ disabled: true });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3583 $('#taste_head').jqxInput({ disabled: true });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3584 $('#taste_aroma').jqxInput({ disabled: true });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3585 $('#taste_taste').jqxInput({ disabled: true });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3586 $('#taste_aftertaste').jqxInput({ disabled: true });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3587 $('#taste_mouthfeel').jqxInput({ disabled: true });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3588 $('#taste_notes').jqxInput({ disabled: true });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3589 $('#notes').jqxInput({ disabled: true });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3590 } else {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3591 $('#notes').jqxInput({ disabled: false });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3592 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3593 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3594
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3595 function showStarter() {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3596
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3597 if (dataRecord.starter_enable) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3598 $('#propagator').show();
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3599 $('#starter_type').jqxDropDownList({ disabled: false });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3600 $('#starter_try').jqxButton({ disabled: false });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3601 $('#starter_sg').jqxNumberInput({ spinButtons: true, readOnly: false, width: 110 });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3602 $('#starter_viability').jqxNumberInput({ spinButtons: true, readOnly: false, width: 110 });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3603 } else {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3604 $('#propagator').hide();
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3605 $('#starter_type').jqxDropDownList({ disabled: true });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3606 $('#starter_try').jqxButton({ disabled: true });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3607 $('#starter_sg').jqxNumberInput({ spinButtons: false, readOnly: true, width: 90 });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3608 $('#starter_viability').jqxNumberInput({ spinButtons: false, readOnly: true, width: 90 });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3609 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3610 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3611
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3612 function calcInit() {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3613 console.log('calcInit()');
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3614
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3615 calcMashEfficiency();
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3616 calcEfficiencyBeforeBoil();
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3617 calcEfficiencyAfterBoil();
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3618
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3619 $('#starter_enable').on('checked', function(event) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3620 dataRecord.starter_enable = 1;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3621 showStarter();
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3622 calcYeast();
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3623 });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3624 $('#starter_enable').on('unchecked', function(event) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3625 dataRecord.starter_enable = 0;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3626 showStarter();
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3627 calcYeast();
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3628 });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3629 $('#starter_try').click(function() {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3630 $('#prop1_volume').val(0);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3631 $('#prop2_volume').val(0);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3632 $('#prop3_volume').val(0);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3633 $('#prop4_volume').val(0);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3634 calcYeast();
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3635 });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3636 $('#starter_type').on('change', function(event) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3637 if (event.args) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3638 dataRecord.starter_type = event.args.index;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3639 calcYeast();
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3640 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3641 });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3642 $('#starter_sg').on('change', function(event) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3643 if (event.args) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3644 dataRecord.starter_sg = event.args.value;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3645 calcYeast();
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3646 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3647 });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3648 $('#starter_viability').on('change', function(event) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3649 if (event.args) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3650 dataRecord.starter_viability = event.args.value;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3651 calcFermentables();
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3652 calcYeast();
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3653 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3654 });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3655 $('#prop1_type').on('change', function(event) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3656 if (event.args) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3657 dataRecord.prop1_type = event.args.index;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3658 calcYeast();
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3659 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3660 });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3661 $('#prop1_volume').on('change', function(event) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3662 if (event.args) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3663 dataRecord.prop1_volume = event.args.value;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3664 calcYeast();
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3665 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3666 });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3667 $('#prop2_type').on('change', function(event) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3668 if (event.args) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3669 dataRecord.prop2_type = event.args.index;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3670 calcYeast();
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3671 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3672 });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3673 $('#prop2_volume').on('change', function(event) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3674 if (event.args) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3675 dataRecord.prop2_volume = event.args.value;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3676 calcYeast();
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3677 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3678 });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3679 $('#prop3_type').on('change', function(event) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3680 if (event.args) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3681 dataRecord.prop3_type = event.args.index;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3682 calcYeast();
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3683 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3684 });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3685 $('#prop3_volume').on('change', function(event) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3686 if (event.args) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3687 dataRecord.prop3_volume = event.args.value;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3688 calcYeast();
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3689 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3690 });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3691 $('#prop4_type').on('change', function(event) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3692 if (event.args) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3693 dataRecord.prop4_type = event.args.index;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3694 calcYeast();
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3695 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3696 });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3697 $('#prop4_volume').on('change', function(event) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3698 if (event.args) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3699 dataRecord.prop4_volume = event.args.value;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3700 calcYeast();
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3701 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3702 });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3703
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3704 $('#calc_acid').on('checked', function(event) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3705 dataRecord.calc_acid = 1;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3706 calcWater();
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3707 });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3708 $('#calc_acid').on('unchecked', function(event) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3709 dataRecord.calc_acid = 0;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3710 calcWater();
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3711 });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3712 $('#w1_name').jqxDropDownList('selectItem', dataRecord.w1_name);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3713 $('#w2_name').jqxDropDownList('selectItem', dataRecord.w2_name);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3714 // Fix tap water if zero using mash infuse amount.
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3715 if (parseFloat($('#w1_amount').jqxNumberInput('decimal')) == 0 && mash_infuse > 0) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3716 $('#w1_amount').val(mash_infuse);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3717 dataRecord.w1_amount = mash_infuse;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3718 $('#wg_amount').val(mash_infuse);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3719 $('#w2_amount').val(0);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3720 dataRecord.w2_amount = 0;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3721 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3722 calcWater();
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3723 $('#w2_amount').on('change', function(event) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3724 var newval = parseFloat(event.args.value);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3725
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3726 if (newval > mash_infuse) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3727 $('#w2_amount').val(dataRecord.w2_amount);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3728 return;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3729 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3730 dataRecord.w1_amount = parseFloat($('#wg_amount').jqxNumberInput('decimal')) - newval;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3731 $('#w1_amount').val(dataRecord.w1_amount);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3732 dataRecord.w2_amount = newval;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3733 console.log('new: ' + event.args.value + ' w1: ' + dataRecord.w1_amount + ' w2: ' + dataRecord.w2_amount);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3734 calcWater();
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3735 });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3736 $('#wa_cacl2').on('change', function(event) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3737 if (event.args) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3738 setWaterAgent('CaCl2', 0); // This can prevent double entries.
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3739 setWaterAgent('CaCl2', event.args.value);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3740 calcWater();
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3741 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3742 });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3743 $('#wa_caso4').on('change', function(event) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3744 if (event.args) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3745 setWaterAgent('CaSO4', 0);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3746 setWaterAgent('CaSO4', event.args.value);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3747 calcWater();
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3748 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3749 });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3750 $('#wa_mgso4').on('change', function(event) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3751 if (event.args) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3752 setWaterAgent('MgSO4', 0);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3753 setWaterAgent('MgSO4', event.args.value);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3754 calcWater();
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3755 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3756 });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3757 $('#wa_nacl').on('change', function(event) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3758 if (event.args) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3759 setWaterAgent('NaCl', 0);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3760 setWaterAgent('NaCl', event.args.value);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3761 calcWater();
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3762 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3763 });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3764 $('#wa_base_name').on('change', function(event) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3765 if (event.args) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3766 var index = event.args.index;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3767 console.log('wa_base_name ' + index);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3768 setWaterAgent(last_base, 0);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3769 last_base = BaseTypeData[index].nl;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3770 setWaterAgent(last_base, parseFloat($('#wa_base').jqxNumberInput('decimal')));
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3771 dataRecord.wa_base_name = index;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3772 calcWater();
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3773 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3774 });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3775 $('#wa_base').on('change', function(event) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3776 var name = BaseTypeData[$('#wa_base_name').val()].nl;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3777 setWaterAgent(name, parseFloat(event.args.value));
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3778 calcWater();
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3779 });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3780 $('#wa_acid_name').on('change', function(event) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3781 if (event.args) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3782 var index = event.args.index;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3783 console.log('wa_acid_name ' + index);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3784 setWaterAgent(last_acid, 0);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3785 last_acid = AcidTypeData[index].nl;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3786 setWaterAgent(last_acid, parseFloat($('#wa_acid').jqxNumberInput('decimal')));
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3787 dataRecord.wa_acid_name = index;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3788 calcWater();
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3789 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3790 });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3791 $('#wa_acid').on('change', function(event) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3792 var name = AcidTypeData[$('#wa_acid_name').val()].nl;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3793 setWaterAgent(name, parseFloat(event.args.value));
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3794 calcWater();
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3795 });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3796 $('#wa_acid_perc').on('change', function(event) { calcWater(); });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3797
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3798 $('#color_method').on('change', function(event) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3799 dataRecord.color_method = event.args.index;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3800 calcFermentables();
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3801 });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3802 $('#ibu_method').on('change', function(event) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3803 dataRecord.ibu_method = event.args.index;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3804 calcFermentables();
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3805 calcIBUs();
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3806 });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3807
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3808 $('#batch_size').on('change', function(event) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3809 console.log('batch_size change:' + event.args.value + ' old:' + dataRecord.batch_size);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3810 $('#est_a_vol').val(event.args.value * 1.04);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3811 var factor, new_boil = parseFloat(event.args.value) + dataRecord.boil_size - dataRecord.batch_size;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3812 factor = parseFloat(event.args.value) / dataRecord.batch_size;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3813 dataRecord.boil_size = new_boil;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3814 $('#boil_size').val(Round(new_boil, 2));
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3815 $('#est_pre_vol').val(Round(new_boil * 1.04, 2));
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3816 dataRecord.sparge_volume *= factor;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3817 $('#sparge_volume').val(dataRecord.sparge_volume);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3818 $('#brew_sparge_volume').val(dataRecord.sparge_volume);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3819 dataRecord.batch_size = parseFloat(event.args.value);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3820 calcFermentablesFromOG(parseFloat($('#est_og').jqxNumberInput('decimal'))); // Keep the OG
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3821 adjustWaters(factor);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3822 calcFermentables();
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3823 adjustHops(factor);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3824 adjustMiscs(factor);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3825 adjustYeasts(factor);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3826 calcIBUs();
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3827 calcWater();
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3828 calcSparge();
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3829 calcMash();
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3830 });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3831 $('#boil_time').on('change', function(event) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3832 console.log('boil_time change:' + parseFloat(event.args.value) + ' old:' + dataRecord.boil_time);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3833 var new_boil, new_evap, old_evap = parseFloat(dataRecord.boil_size) - parseFloat(dataRecord.batch_size);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3834 new_evap = old_evap * (parseFloat(event.args.value) / dataRecord.boil_time);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3835 new_boil = parseFloat(dataRecord.batch_size) + new_evap;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3836 dataRecord.boil_time = parseFloat(event.args.value);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3837 dataRecord.boil_size = new_boil;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3838 $('#est_pre_vol').val(Round(new_boil * 1.04, 2));
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3839 $('#boil_size').val(Round(new_boil, 2));
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3840 calcFermentables();
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3841 calcIBUs();
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3842 calcYeast();
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3843 });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3844 $('#efficiency').on('change', function(event) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3845 var estog = parseFloat($('#est_og').jqxNumberInput('decimal'));
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3846 dataRecord.efficiency = parseFloat(event.args.value);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3847 console.log('efficiency change:' + dataRecord.efficiency + ' est_og:' + estog);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3848 calcFermentablesFromOG(estog); // Keep the OG
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3849 calcFermentables();
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3850 calcIBUs();
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3851 calcYeast();
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3852 });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3853 $('#est_og').on('change', function(event) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3854 dataRecord.est_og = parseFloat(event.args.value);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3855 console.log('est_og change:' + dataRecord.est_og);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3856 $('#est_og2').val(dataRecord.est_og);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3857 calcFermentablesFromOG(dataRecord.est_og); // Adjust fermentables amounts
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3858 calcFermentables(); // Update the recipe details
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3859 calcIBUs(); // and the IBU's.
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3860 calcMash();
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3861 calcYeast();
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3862 });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3863 $('#mash_ph').on('change', function(event) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3864 dataRecord.mash_ph = parseFloat(event.args.value);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3865 calcWater();
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3866 });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3867
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3868 $('#sparge_ph').on('change', function(event) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3869 dataRecord.sparge_ph = parseFloat(event.args.value);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3870 calcSparge();
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3871 });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3872 $('#sparge_volume').on('change', function(event) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3873 dataRecord.sparge_volume = parseFloat(event.args.value);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3874 $('#brew_sparge_volume').val(dataRecord.sparge_volume);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3875 calcSparge();
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3876 });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3877 $('#sparge_temp').on('change', function(event) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3878 dataRecord.sparge_temp = parseFloat(event.args.value);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3879 $('#brew_sparge_temperature').val(dataRecord.sparge_temp);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3880 });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3881 $('#sparge_source').on('change', function(event) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3882 if (event.args) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3883 dataRecord.sparge_source = event.args.index;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3884 calcSparge();
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3885 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3886 });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3887 $('#sparge_acid_type').on('change', function(event) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3888 if (event.args) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3889 dataRecord.sparge_acid_type = event.args.index;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3890 console.log('new sparge_acid_type: ' + dataRecord.sparge_acid_type);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3891 calcSparge();
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3892 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3893 });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3894 $('#sparge_acid_perc').on('change', function(event) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3895 dataRecord.sparge_acid_perc = parseFloat(event.args.value);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3896 calcSparge();
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3897 });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3898
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3899 calcFermentation();
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3900 calcCarbonation();
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3901 $('#package_volume').on('change', function(event) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3902 var diff, tnew, told = dataRecord.package_volume + dataRecord.package_infuse_amount;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3903 dataRecord.package_volume = parseFloat(event.args.value);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3904 if (dataRecord.package_volume > dataRecord.brew_fermenter_volume) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3905 dataRecord.package_volume = dataRecord.brew_fermenter_volume;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3906 $('#package_volume').val(dataRecord.package_volume);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3907 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3908 tnew = dataRecord.package_volume + dataRecord.package_infuse_amount;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3909 diff = tnew - told;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3910 if (told > 0) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3911 dataRecord.bottle_amount += (dataRecord.bottle_amount / told) * diff;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3912 dataRecord.keg_amount += (dataRecord.keg_amount / told) * diff;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3913 } else {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3914 dataRecord.bottle_amount = tnew;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3915 dataRecord.keg_amount = 0;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3916 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3917 console.log('diff:' + diff + ' old:' + told + ' bottle:' + dataRecord.bottle_amount + ' keg:' + dataRecord.keg_amount);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3918 $('#bottle_amount').val(parseFloat(dataRecord.bottle_amount * 1000) / 1000);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3919 $('#keg_amount').val(parseFloat(dataRecord.keg_amount * 1000) / 1000);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3920 calcCarbonation();
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3921 });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3922 $('#package_infuse_amount').on('change', function(event) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3923 var diff, tnew, told = dataRecord.package_volume + dataRecord.package_infuse_amount;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3924 dataRecord.package_infuse_amount = parseFloat(event.args.value);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3925 tnew = dataRecord.package_volume + dataRecord.package_infuse_amount;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3926 diff = tnew - told;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3927 if (told > 0) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3928 dataRecord.bottle_amount += (dataRecord.bottle_amount / told) * diff;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3929 dataRecord.keg_amount += (dataRecord.keg_amount / told) * diff;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3930 } else {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3931 dataRecord.bottle_amount = tnew;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3932 dataRecord.keg_amount = 0;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3933 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3934 console.log('diff:' + diff + ' old:' + told + ' bottle:' + dataRecord.bottle_amount + ' keg:' + dataRecord.keg_amount);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3935 $('#bottle_amount').val(parseFloat(dataRecord.bottle_amount * 1000) / 1000);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3936 $('#keg_amount').val(parseFloat(dataRecord.keg_amount * 1000) / 1000);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3937 calcCarbonation();
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3938 });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3939 $('#package_infuse_abv').on('change', function(event) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3940 dataRecord.package_infuse_abv = parseFloat(event.args.value);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3941 calcCarbonation();
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3942 });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3943 $('#bottle_amount').on('change', function(event) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3944 var vtot, diff, vnew = parseFloat(event.args.value);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3945 vtot = dataRecord.package_volume + dataRecord.package_infuse_amount;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3946 if (vnew > vtot)
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3947 vnew = vtot;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3948 diff = dataRecord.bottle_amount - vnew;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3949 dataRecord.bottle_amount = Math.round((dataRecord.bottle_amount - diff) * 1000) / 1000;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3950 dataRecord.keg_amount = Math.round((dataRecord.keg_amount + diff) * 1000) / 1000;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3951 $('#bottle_amount').val(parseFloat(dataRecord.bottle_amount));
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3952 $('#keg_amount').val(parseFloat(dataRecord.keg_amount));
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3953 calcCarbonation();
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3954 });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3955 $('#bottle_priming_water').on('change', function(event) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3956 dataRecord.bottle_priming_water = parseFloat(event.args.value);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3957 calcCarbonation();
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3958 });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3959 $('#keg_amount').on('change', function(event) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3960 var diff, vtot, vnew = parseFloat(event.args.value);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3961 vtot = dataRecord.package_volume + dataRecord.package_infuse_amount;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3962 if (vnew > vtot)
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3963 vnew = vtot;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3964 diff = dataRecord.keg_amount - vnew;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3965 dataRecord.bottle_amount = Math.round((dataRecord.bottle_amount + diff) * 1000) / 1000;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3966 dataRecord.keg_amount = Math.round((dataRecord.keg_amount - diff) * 1000) / 1000;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3967 $('#bottle_amount').val(parseFloat(dataRecord.bottle_amount));
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3968 $('#keg_amount').val(parseFloat(dataRecord.keg_amount));
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3969 calcCarbonation();
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3970 });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3971 $('#keg_priming_water').on('change', function(event) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3972 dataRecord.keg_priming_water = parseFloat(event.args.value);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3973 calcCarbonation();
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3974 });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3975 $('#bottle_carbonation').on('change', function(event) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3976 dataRecord.bottle_carbonation = parseFloat(event.args.value);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3977 calcCarbonation();
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3978 });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3979 $('#bottle_carbonation_temp').on('change', function(event) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3980 dataRecord.bottle_carbonation_temp = parseFloat(event.args.value);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3981 calcCarbonation();
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3982 });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3983 $('#keg_carbonation').on('change', function(event) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3984 dataRecord.keg_carbonation = parseFloat(event.args.value);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3985 calcCarbonation();
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3986 });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3987 $('#keg_forced_carb').on('checked', function(event) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3988 dataRecord.keg_forced_carb = 1;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3989 calcCarbonation();
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3990 });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3991 $('#keg_forced_carb').on('unchecked', function(event) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3992 dataRecord.keg_forced_carb = 0;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3993 calcCarbonation();
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3994 });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3995 $('#keg_carbonation_temp').on('change', function(event) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3996 dataRecord.keg_carbonation_temp = parseFloat(event.args.value);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3997 calcCarbonation();
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3998 });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
3999
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4000 $('#brew_fermenter_extrawater').on('change', function(event) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4001 dataRecord.brew_fermenter_extrawater = parseFloat(event.args.value);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4002 calcFermentables();
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4003 calcIBUs();
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4004 calcYeast();
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4005 });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4006 $('#brew_fermenter_tcloss').on('change', function(event) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4007 dataRecord.brew_fermenter_tcloss = parseFloat(event.args.value);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4008 calcFermentables();
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4009 calcIBUs();
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4010 calcYeast();
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4011 });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4012 $('#primary_end_sg').on('change', function(event) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4013 dataRecord.primary_end_sg = parseFloat(event.args.value);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4014 calcFermentation();
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4015 });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4016 $('#primary_end_brix').on('change', function(event) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4017 var OBrix, FBrix, FG;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4018 if (dataRecord.brew_fermenter_sg >= 1.020) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4019 OBrix = sg_to_brix(dataRecord.brew_fermenter_sg);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4020 FBrix = parseFloat(event.args.value);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4021 FG = Round(1.0031 - 0.002318474 * OBrix - 0.000007775 * (OBrix * OBrix) - 0.000000034 * Math.pow(OBrix, 3) +
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4022 0.00574 * (FBrix) + 0.00003344 * (FBrix * FBrix) + 0.000000086 * Math.pow(FBrix, 3), 4);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4023 //console.log("OBrix:"+OBrix+" FBrix:"+FBrix+" FG:"+FG);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4024 if (FBrix > 0.05) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4025 $('#primary_end_sg').val(FG);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4026 dataRecord.primary_end_sg = FG;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4027 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4028 calcFermentation();
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4029 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4030 });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4031 $('#secondary_end_sg').on('change', function(event) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4032 dataRecord.secondary_end_sg = parseFloat(event.args.value);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4033 calcFermentation();
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4034 });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4035 $('#secondary_end_brix').on('change', function(event) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4036 var OBrix, FBrix, FG;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4037 if (dataRecord.brew_fermenter_sg >= 1.020) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4038 OBrix = sg_to_brix(dataRecord.brew_fermenter_sg);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4039 FBrix = parseFloat(event.args.value);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4040 FG = Round(1.0031 - 0.002318474 * OBrix - 0.000007775 * (OBrix * OBrix) - 0.000000034 * Math.pow(OBrix, 3) +
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4041 0.00574 * (FBrix) + 0.00003344 * (FBrix * FBrix) + 0.000000086 * Math.pow(FBrix, 3), 4);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4042 //console.log("OBrix:"+OBrix+" FBrix:"+FBrix+" FG:"+FG);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4043 if (FBrix > 0.05) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4044 $('#secondary_end_sg').val(FG);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4045 dataRecord.secondary_end_sg = FG;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4046 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4047 calcFermentation();
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4048 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4049 });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4050 $('#final_brix').on('change', function(event) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4051 var OBrix, FBrix, FG;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4052 if (dataRecord.brew_fermenter_sg >= 1.020) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4053 OBrix = sg_to_brix(dataRecord.brew_fermenter_sg);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4054 FBrix = parseFloat(event.args.value);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4055 FG = Round(1.0031 - 0.002318474 * OBrix - 0.000007775 * (OBrix * OBrix) - 0.000000034 * Math.pow(OBrix, 3) +
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4056 0.00574 * (FBrix) + 0.00003344 * (FBrix * FBrix) + 0.000000086 * Math.pow(FBrix, 3), 4);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4057 //console.log("OBrix:"+OBrix+" FBrix:"+FBrix+" FG:"+FG);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4058 if (FBrix > 0.05) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4059 $('#fg').val(FG);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4060 dataRecord.fg = FG;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4061 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4062 calcFermentation();
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4063 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4064 });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4065 $('#fg').on('change', function(event) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4066 dataRecord.fg = parseFloat(event.args.value);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4067 calcFermentation();
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4068 });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4069 $('#BLog').jqxButton({ disabled: (dataRecord.log_brew) ? false : true});
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4070 $('#FLog').jqxButton({ disabled: (dataRecord.log_fermentation) ? false : true});
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4071 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4072
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4073 $('#styleSelect').jqxDropDownList({
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4074 placeHolder: 'Kies bierstijl:',
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4075 theme: theme,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4076 source: styleslist,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4077 displayMember: 'name',
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4078 width: 180,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4079 height: 23,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4080 dropDownVerticalAlignment: 'top',
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4081 dropDownWidth: 500,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4082 dropDownHeight: 380,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4083 renderer: function(index, label, value) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4084 var datarecord = styleslist.records[index];
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4085 return datarecord.style_guide + ' ' + datarecord.style_letter + ' ' + datarecord.name;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4086 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4087 });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4088 $('#styleSelect').on('select', function(event) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4089 if (event.args) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4090 var datarecord, index = event.args.index;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4091 datarecord = styleslist.records[index];
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4092 $('#st_name').val(datarecord.name);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4093 $('#st_category').val(datarecord.category);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4094 $('#st_category_number').val(datarecord.category_number);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4095 $('#st_letter').val(datarecord.style_letter);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4096 $('#st_guide').val(datarecord.style_guide);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4097 $('#st_type').val(StyleTypeData[datarecord.type].nl);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4098 $('#st_og_min').val(datarecord.og_min);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4099 $('#st_og_max').val(datarecord.og_max);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4100 $('#st_fg_min').val(datarecord.fg_min);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4101 $('#st_fg_max').val(datarecord.fg_max);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4102 $('#st_ibu_min').val(datarecord.ibu_min);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4103 $('#st_ibu_max').val(datarecord.ibu_max);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4104 $('#st_color_min').val(datarecord.color_min);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4105 $('#st_color_max').val(datarecord.color_max);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4106 $('#st_carb_min').val(datarecord.carb_min);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4107 $('#st_carb_min2').val(datarecord.carb_min);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4108 $('#st_carb_max').val(datarecord.carb_max);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4109 $('#st_carb_max2').val(datarecord.carb_max);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4110 $('#st_abv_min').val(datarecord.abv_min);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4111 $('#st_abv_max').val(datarecord.abv_max);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4112 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4113 });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4114
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4115 // Equipemnt dropdown list
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4116 $('#equipmentSelect').jqxDropDownList({
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4117 placeHolder: 'Kies apparatuur:',
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4118 theme: theme,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4119 source: equipmentlist,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4120 displayMember: 'name',
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4121 width: 170,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4122 height: 23,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4123 dropDownWidth: 300,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4124 renderer: function(index, label, value) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4125 var datarecord = equipmentlist.records[index];
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4126 return datarecord.batch_size + ' liter ' + datarecord.name;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4127 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4128 });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4129 $('#equipmentSelect').on('select', function(event) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4130 if (event.args) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4131 var datarecord, factor, index = event.args.index;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4132 datarecord = equipmentlist.records[index];
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4133 factor = datarecord.batch_size / dataRecord.batch_size;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4134 $('#eq_name').val(datarecord.name);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4135 $('#eq_boil_size').val(datarecord.boil_size);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4136 dataRecord.boil_size = datarecord.boil_size;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4137 $('#boil_size').val(datarecord.boil_size);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4138 $('#eq_batch_size').val(datarecord.batch_size);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4139 dataRecord.batch_size = datarecord.batch_size;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4140 $('#batch_size').val(datarecord.batch_size);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4141 $('#est_a_vol').val(datarecord.batch_size * 1.04);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4142 $('#eq_tun_volume').val(datarecord.tun_volume);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4143 dataRecord.eq_tun_weight = datarecord.tun_weight;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4144 dataRecord.eq_tun_specific_heat = datarecord.tun_specific_heat;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4145 dataRecord.eq_tun_material = datarecord.tun_material;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4146 dataRecord.eq_tun_height = datarecord.tun_height / 100.0;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4147 $('#eq_top_up_water').val(datarecord.top_up_water);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4148 dataRecord.eq_trub_chiller_loss = datarecord.trub_chiller_loss;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4149 $('#eq_trub_chiller_loss').val(datarecord.trub_chiller_loss);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4150 $('#eq_evap_rate').val(datarecord.evap_rate);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4151 $('#eq_boil_time').val(datarecord.boil_time);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4152 dataRecord.eq_calc_boil_volume = datarecord.calc_boil_volume;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4153 $('#eq_top_up_kettle').val(datarecord.top_up_kettle);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4154 $('#eq_hop_utilization').val(datarecord.hop_utilization);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4155 $('#eq_notes').val(datarecord.notes);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4156 $('#eq_lauter_volume').val(datarecord.lauter_volume);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4157 dataRecord.eq_lauter_height = datarecord.lauter_height / 100.0;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4158 $('#eq_lauter_deadspace').val(datarecord.lauter_deadspace);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4159 $('#eq_kettle_volume').val(datarecord.kettle_volume);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4160 dataRecord.eq_kettle_height = datarecord.kettle_height / 100.0;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4161 $('#eq_mash_volume').val(datarecord.mash_volume);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4162 $('#eq_mash_max').val(datarecord.mash_max);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4163 dataRecord.eq_mash_max = datarecord.mash_max;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4164 $('#mash_max').val(datarecord.mash_max);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4165 $('#eq_efficiency').val(datarecord.efficiency);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4166 dataRecord.efficiency = datarecord.efficiency;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4167 $('#efficiency').val(datarecord.efficiency);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4168
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4169 dataRecord.sparge_volume = Math.round(datarecord.boil_size * 5) / 10;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4170 $('#sparge_volume').val(dataRecord.sparge_volume);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4171 $('#brew_sparge_volume').val(dataRecord.sparge_volume);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4172 $('#est_pre_vol').val(datarecord.boil_size * 1.04);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4173 calcFermentablesFromOG(parseFloat($('#est_og').jqxNumberInput('decimal'))); // Keep the OG
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4174 adjustWaters(factor);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4175 calcFermentables();
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4176 adjustHops(factor);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4177 adjustMiscs(factor);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4178 adjustYeasts(factor);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4179 calcIBUs();
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4180 calcWater();
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4181 calcSparge();
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4182 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4183 });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4184
489
18e5cfe5d126 Load new url in database write callback
Michiel Broek <mbroek@mbse.eu>
parents: 484
diff changeset
4185 function saveRecord(goback) {
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4186 var row = {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4187 record: my_record,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4188 uuid: dataRecord.uuid,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4189 name: $('#name').val(),
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4190 code: $('#code').val(),
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4191 birth: $('#birth').val(),
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4192 stage: dataRecord.stage,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4193 notes: $('#notes').val(),
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4194 log_brew: dataRecord.log_brew,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4195 log_fermentation: dataRecord.log_fermentation,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4196 inventory_reduced: dataRecord.inventory_reduced,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4197 locked: dataRecord.locked,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4198 eq_name: $('#eq_name').val(),
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4199 eq_boil_size: parseFloat($('#eq_boil_size').jqxNumberInput('decimal')),
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4200 eq_batch_size: parseFloat($('#eq_batch_size').jqxNumberInput('decimal')),
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4201 eq_tun_volume: parseFloat($('#eq_tun_volume').jqxNumberInput('decimal')),
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4202 eq_tun_weight: dataRecord.eq_tun_weight,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4203 eq_tun_specific_heat: dataRecord.eq_tun_specific_heat,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4204 eq_tun_material: dataRecord.eq_tun_material,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4205 eq_tun_height: dataRecord.eq_tun_height,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4206 eq_top_up_water: parseFloat($('#eq_top_up_water').jqxNumberInput('decimal')),
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4207 eq_trub_chiller_loss: parseFloat($('#eq_trub_chiller_loss').jqxNumberInput('decimal')),
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4208 eq_evap_rate: parseFloat($('#eq_evap_rate').jqxNumberInput('decimal')),
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4209 eq_boil_time: parseFloat($('#eq_boil_time').jqxNumberInput('decimal')),
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4210 eq_calc_boil_volume: dataRecord.eq_calc_boil_volume,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4211 eq_top_up_kettle: parseFloat($('#eq_top_up_kettle').jqxNumberInput('decimal')),
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4212 eq_hop_utilization: parseFloat($('#eq_hop_utilization').jqxNumberInput('decimal')),
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4213 eq_notes: $('#eq_notes').val(),
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4214 eq_lauter_volume: parseFloat($('#eq_lauter_volume').jqxNumberInput('decimal')),
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4215 eq_lauter_height: dataRecord.eq_lauter_height,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4216 eq_lauter_deadspace: parseFloat($('#eq_lauter_deadspace').jqxNumberInput('decimal')),
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4217 eq_kettle_volume: parseFloat($('#eq_kettle_volume').jqxNumberInput('decimal')),
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4218 eq_kettle_height: dataRecord.eq_kettle_height,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4219 eq_mash_volume: parseFloat($('#eq_mash_volume').jqxNumberInput('decimal')),
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4220 eq_mash_max: parseFloat($('#eq_mash_max').jqxNumberInput('decimal')),
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4221 eq_efficiency: parseFloat($('#eq_efficiency').jqxNumberInput('decimal')),
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4222 brew_date_start: $('#brew_date_start').val(),
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4223 brew_mash_ph: parseFloat($('#brew_mash_ph').jqxNumberInput('decimal')),
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4224 brew_mash_sg: parseFloat($('#brew_mash_sg').jqxNumberInput('decimal')),
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4225 brew_mash_efficiency: parseFloat($('#brew_mash_efficiency').jqxNumberInput('decimal')),
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4226 brew_sparge_est: parseFloat($('#brew_sparge_est').jqxNumberInput('decimal')),
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4227 brew_sparge_ph: parseFloat($('#brew_sparge_ph').jqxNumberInput('decimal')),
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4228 brew_preboil_volume: parseFloat($('#brew_preboil_volume').jqxNumberInput('decimal')),
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4229 brew_preboil_sg: parseFloat($('#brew_preboil_sg').jqxNumberInput('decimal')),
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4230 brew_preboil_ph: parseFloat($('#brew_preboil_ph').jqxNumberInput('decimal')),
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4231 brew_preboil_efficiency: parseFloat($('#brew_preboil_efficiency').jqxNumberInput('decimal')),
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4232 brew_aboil_volume: parseFloat($('#brew_aboil_volume').jqxNumberInput('decimal')),
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4233 brew_aboil_sg: parseFloat($('#brew_aboil_sg').jqxNumberInput('decimal')),
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4234 brew_aboil_ph: parseFloat($('#brew_aboil_ph').jqxNumberInput('decimal')),
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4235 brew_aboil_efficiency: parseFloat($('#brew_aboil_efficiency').jqxNumberInput('decimal')),
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4236 brew_cooling_method: $('#brew_cooling_method').val(),
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4237 brew_cooling_time: parseFloat($('#brew_cooling_time').jqxNumberInput('decimal')),
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4238 brew_cooling_to: parseFloat($('#brew_cooling_to').jqxNumberInput('decimal')),
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4239 brew_whirlpool9: parseFloat($('#brew_whirlpool9').jqxNumberInput('decimal')),
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4240 brew_whirlpool7: parseFloat($('#brew_whirlpool7').jqxNumberInput('decimal')),
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4241 brew_whirlpool6: parseFloat($('#brew_whirlpool6').jqxNumberInput('decimal')),
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4242 brew_whirlpool2: parseFloat($('#brew_whirlpool2').jqxNumberInput('decimal')),
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4243 brew_fermenter_volume: parseFloat($('#brew_fermenter_volume').jqxNumberInput('decimal')),
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4244 brew_fermenter_extrawater: parseFloat($('#brew_fermenter_extrawater').jqxNumberInput('decimal')),
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4245 brew_fermenter_tcloss: parseFloat($('#brew_fermenter_tcloss').jqxNumberInput('decimal')),
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4246 brew_aeration_time: parseFloat($('#brew_aeration_time').jqxNumberInput('decimal')),
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4247 brew_aeration_speed: parseFloat($('#brew_aeration_speed').jqxNumberInput('decimal')),
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4248 brew_aeration_type: $('#brew_aeration_type').val(),
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4249 brew_fermenter_sg: parseFloat($('#brew_fermenter_sg').jqxNumberInput('decimal')),
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4250 brew_fermenter_ibu: parseFloat($('#brew_fermenter_ibu').jqxNumberInput('decimal')),
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4251 brew_fermenter_color: parseFloat($('#brew_fermenter_color').jqxNumberInput('decimal')),
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4252 brew_date_end: $('#brew_date_end').val(),
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4253 og: dataRecord.og,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4254 fg: parseFloat($('#fg').jqxNumberInput('decimal')),
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4255 primary_start_temp: parseFloat($('#primary_start_temp').jqxNumberInput('decimal')),
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4256 primary_max_temp: parseFloat($('#primary_max_temp').jqxNumberInput('decimal')),
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4257 primary_end_temp: parseFloat($('#primary_end_temp').jqxNumberInput('decimal')),
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4258 primary_end_sg: parseFloat($('#primary_end_sg').jqxNumberInput('decimal')),
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4259 primary_end_date: $('#primary_end_date').val(),
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4260 secondary_temp: parseFloat($('#secondary_temp').jqxNumberInput('decimal')),
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4261 secondary_end_sg: parseFloat($('#secondary_end_sg').jqxNumberInput('decimal')),
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4262 secondary_end_date: $('#secondary_end_date').val(),
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4263 tertiary_temp: parseFloat($('#tertiary_temp').jqxNumberInput('decimal')),
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4264 package_date: $('#package_date').val(),
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4265 package_volume: parseFloat($('#package_volume').jqxNumberInput('decimal')),
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4266 package_infuse_amount: parseFloat($('#package_infuse_amount').jqxNumberInput('decimal')),
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4267 package_infuse_abv: parseFloat($('#package_infuse_abv').jqxNumberInput('decimal')),
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4268 package_infuse_notes: $('#package_infuse_notes').val(),
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4269 package_abv: parseFloat($('#package_abv').jqxNumberInput('decimal')),
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4270 package_ph: parseFloat($('#package_ph').jqxNumberInput('decimal')),
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4271 bottle_amount: parseFloat($('#bottle_amount').jqxNumberInput('decimal')),
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4272 bottle_carbonation: parseFloat($('#bottle_carbonation').jqxNumberInput('decimal')),
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4273 bottle_priming_water: parseFloat($('#bottle_priming_water').jqxNumberInput('decimal')),
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4274 bottle_priming_amount: parseFloat($('#bottle_priming_amount').jqxNumberInput('decimal')),
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4275 bottle_carbonation_temp: parseFloat($('#bottle_carbonation_temp').jqxNumberInput('decimal')),
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4276 keg_amount: parseFloat($('#keg_amount').jqxNumberInput('decimal')),
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4277 keg_carbonation: parseFloat($('#keg_carbonation').jqxNumberInput('decimal')),
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4278 keg_priming_water: parseFloat($('#keg_priming_water').jqxNumberInput('decimal')),
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4279 keg_priming_amount: parseFloat($('#keg_priming_amount').jqxNumberInput('decimal')),
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4280 keg_carbonation_temp: parseFloat($('#keg_carbonation_temp').jqxNumberInput('decimal')),
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4281 keg_forced_carb: dataRecord.keg_forced_carb,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4282 keg_pressure: parseFloat($('#keg_pressure').jqxNumberInput('decimal')),
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4283 taste_notes: $('#taste_notes').val(),
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4284 taste_rate: parseFloat($('#taste_rate').jqxNumberInput('decimal')),
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4285 taste_date: $('#taste_date').val(),
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4286 taste_color: $('#taste_color').val(),
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4287 taste_transparency: $('#taste_transparency').val(),
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4288 taste_head: $('#taste_head').val(),
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4289 taste_aroma: $('#taste_aroma').val(),
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4290 taste_taste: $('#taste_taste').val(),
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4291 taste_mouthfeel: $('#taste_mouthfeel').val(),
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4292 taste_aftertaste: $('#taste_aftertaste').val(),
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4293 st_name: $('#st_name').val(),
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4294 st_letter: $('#st_letter').val(),
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4295 st_guide: $('#st_guide').val(),
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4296 st_type: dataRecord.st_type,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4297 st_category: $('#st_category').val(),
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4298 st_category_number: parseFloat($('#st_category_number').jqxNumberInput('decimal')),
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4299 st_og_min: parseFloat($('#st_og_min').jqxNumberInput('decimal')),
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4300 st_og_max: parseFloat($('#st_og_max').jqxNumberInput('decimal')),
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4301 st_fg_min: parseFloat($('#st_fg_min').jqxNumberInput('decimal')),
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4302 st_fg_max: parseFloat($('#st_fg_max').jqxNumberInput('decimal')),
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4303 st_ibu_min: parseFloat($('#st_ibu_min').jqxNumberInput('decimal')),
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4304 st_ibu_max: parseFloat($('#st_ibu_max').jqxNumberInput('decimal')),
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4305 st_color_min: parseFloat($('#st_color_min').jqxNumberInput('decimal')),
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4306 st_color_max: parseFloat($('#st_color_max').jqxNumberInput('decimal')),
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4307 st_carb_min: parseFloat($('#st_carb_min').jqxNumberInput('decimal')),
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4308 st_carb_max: parseFloat($('#st_carb_max').jqxNumberInput('decimal')),
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4309 st_abv_min: parseFloat($('#st_abv_min').jqxNumberInput('decimal')),
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4310 st_abv_max: parseFloat($('#st_abv_max').jqxNumberInput('decimal')),
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4311 type: $('#type').val(),
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4312 batch_size: parseFloat($('#batch_size').jqxNumberInput('decimal')),
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4313 boil_size: parseFloat($('#boil_size').jqxNumberInput('decimal')),
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4314 boil_time: parseFloat($('#boil_time').jqxNumberInput('decimal')),
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4315 efficiency: parseFloat($('#efficiency').jqxNumberInput('decimal')),
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4316 est_og: parseFloat($('#est_og').jqxNumberInput('decimal')),
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4317 est_fg: parseFloat($('#est_fg').jqxNumberInput('decimal')),
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4318 est_abv: parseFloat($('#est_abv').jqxNumberInput('decimal')),
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4319 est_color: parseFloat($('#est_color').jqxNumberInput('decimal')),
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4320 color_method: $('#color_method').val(),
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4321 est_ibu: parseFloat($('#est_ibu').jqxNumberInput('decimal')),
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4322 ibu_method: $('#ibu_method').val(),
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4323 est_carb: parseFloat($('#est_carb').jqxNumberInput('decimal')),
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4324 mash_name: $('#mash_name').val(),
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4325 mash_ph: parseFloat($('#mash_ph').jqxNumberInput('decimal')),
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4326 sparge_temp: parseFloat($('#sparge_temp').jqxNumberInput('decimal')),
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4327 sparge_ph: parseFloat($('#sparge_ph').jqxNumberInput('decimal')),
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4328 sparge_volume: parseFloat($('#sparge_volume').jqxNumberInput('decimal')),
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4329 sparge_source: $('#sparge_source').val(),
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4330 sparge_acid_type: $('#sparge_acid_type').val(),
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4331 sparge_acid_perc: parseFloat($('#sparge_acid_perc').jqxNumberInput('decimal')),
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4332 sparge_acid_amount: dataRecord.sparge_acid_amount,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4333 calc_acid: dataRecord.calc_acid,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4334 w1_name: $('#w1_name').val(),
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4335 w1_amount: parseFloat($('#w1_amount').jqxNumberInput('decimal')),
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4336 w1_calcium: parseFloat($('#w1_calcium').jqxNumberInput('decimal')),
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4337 w1_sulfate: parseFloat($('#w1_sulfate').jqxNumberInput('decimal')),
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4338 w1_chloride: parseFloat($('#w1_chloride').jqxNumberInput('decimal')),
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4339 w1_sodium: parseFloat($('#w1_sodium').jqxNumberInput('decimal')),
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4340 w1_magnesium: parseFloat($('#w1_magnesium').jqxNumberInput('decimal')),
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4341 w1_total_alkalinity: parseFloat($('#w1_total_alkalinity').jqxNumberInput('decimal')),
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4342 w1_ph: parseFloat($('#w1_ph').jqxNumberInput('decimal')),
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4343 w1_cost: dataRecord.w1_cost,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4344 w2_name: $('#w2_name').val(),
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4345 w2_amount: parseFloat($('#w2_amount').jqxNumberInput('decimal')),
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4346 w2_calcium: parseFloat($('#w2_calcium').jqxNumberInput('decimal')),
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4347 w2_sulfate: parseFloat($('#w2_sulfate').jqxNumberInput('decimal')),
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4348 w2_chloride: parseFloat($('#w2_chloride').jqxNumberInput('decimal')),
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4349 w2_sodium: parseFloat($('#w2_sodium').jqxNumberInput('decimal')),
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4350 w2_magnesium: parseFloat($('#w2_magnesium').jqxNumberInput('decimal')),
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4351 w2_total_alkalinity: parseFloat($('#w2_total_alkalinity').jqxNumberInput('decimal')),
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4352 w2_ph: parseFloat($('#w2_ph').jqxNumberInput('decimal')),
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4353 w2_cost: dataRecord.w2_cost,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4354 wg_amount: parseFloat($('#wg_amount').jqxNumberInput('decimal')),
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4355 wg_calcium: parseFloat($('#wg_calcium').jqxNumberInput('decimal')),
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4356 wg_sulfate: parseFloat($('#wg_sulfate').jqxNumberInput('decimal')),
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4357 wg_chloride: parseFloat($('#wg_chloride').jqxNumberInput('decimal')),
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4358 wg_sodium: parseFloat($('#wg_sodium').jqxNumberInput('decimal')),
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4359 wg_magnesium: parseFloat($('#wg_magnesium').jqxNumberInput('decimal')),
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4360 wg_total_alkalinity: parseFloat($('#wg_total_alkalinity').jqxNumberInput('decimal')),
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4361 wg_ph: parseFloat($('#wg_ph').jqxNumberInput('decimal')),
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4362 wb_calcium: parseFloat($('#wb_calcium').jqxNumberInput('decimal')),
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4363 wb_sulfate: parseFloat($('#wb_sulfate').jqxNumberInput('decimal')),
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4364 wb_chloride: parseFloat($('#wb_chloride').jqxNumberInput('decimal')),
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4365 wb_sodium: parseFloat($('#wb_sodium').jqxNumberInput('decimal')),
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4366 wb_magnesium: parseFloat($('#wb_magnesium').jqxNumberInput('decimal')),
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4367 wb_total_alkalinity: parseFloat($('#wb_total_alkalinity').jqxNumberInput('decimal')),
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4368 wb_ph: parseFloat($('#wb_ph').jqxNumberInput('decimal')),
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4369 wa_acid_name: $('#wa_acid_name').val(),
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4370 wa_acid_perc: parseFloat($('#wa_acid_perc').jqxNumberInput('decimal')),
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4371 wa_base_name: $('#wa_base_name').val(),
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4372 starter_enable: dataRecord.starter_enable,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4373 starter_type: $('#starter_type').val(),
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4374 starter_sg: parseFloat($('#starter_sg').jqxNumberInput('decimal')),
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4375 starter_viability: parseFloat($('#starter_viability').jqxNumberInput('decimal')),
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4376 prop1_type: $('#prop1_type').val(),
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4377 prop1_volume: parseFloat($('#prop1_volume').jqxNumberInput('decimal')),
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4378 prop2_type: $('#prop2_type').val(),
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4379 prop2_volume: parseFloat($('#prop2_volume').jqxNumberInput('decimal')),
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4380 prop3_type: $('#prop3_type').val(),
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4381 prop3_volume: parseFloat($('#prop3_volume').jqxNumberInput('decimal')),
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4382 prop4_type: $('#prop4_type').val(),
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4383 prop4_volume: parseFloat($('#prop4_volume').jqxNumberInput('decimal')),
497
0fe366d953ab Prepare screens for product divide batch.
Michiel Broek <mbroek@mbse.eu>
parents: 495
diff changeset
4384 divide_type: dataRecord.divide_type,
0fe366d953ab Prepare screens for product divide batch.
Michiel Broek <mbroek@mbse.eu>
parents: 495
diff changeset
4385 divide_size: dataRecord.divide_size,
533
be8691b7d634 Added the product divide scripts. All parts have all the volumes and weights divided, including the master record. Splitted batches have their own records with the product code formatted as code-n. From this design, we can rebuild the print and checklist.
Michiel Broek <mbroek@mbse.eu>
parents: 525
diff changeset
4386 divide_factor: dataRecord.divide_factor,
497
0fe366d953ab Prepare screens for product divide batch.
Michiel Broek <mbroek@mbse.eu>
parents: 495
diff changeset
4387 divide_parts: dataRecord.divide_parts,
533
be8691b7d634 Added the product divide scripts. All parts have all the volumes and weights divided, including the master record. Splitted batches have their own records with the product code formatted as code-n. From this design, we can rebuild the print and checklist.
Michiel Broek <mbroek@mbse.eu>
parents: 525
diff changeset
4388 divide_part: dataRecord.divide_part,
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4389 fermentables: $('#fermentableGrid').jqxGrid('getrows'),
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4390 hops: $('#hopGrid').jqxGrid('getrows'),
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4391 miscs: $('#miscGrid').jqxGrid('getrows'),
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4392 yeasts: $('#yeastGrid').jqxGrid('getrows'),
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4393 mashs: $('#mashGrid').jqxGrid('getrows')
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4394 },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4395 data = 'update=true&' + $.param(row);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4396 $.ajax({
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4397 dataType: 'json',
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4398 url: url,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4399 cache: false,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4400 data: data,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4401 async: false,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4402 type: 'POST',
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4403 success: function(data, status, xhr) {
489
18e5cfe5d126 Load new url in database write callback
Michiel Broek <mbroek@mbse.eu>
parents: 484
diff changeset
4404 console.log('saveRecord(' + goback + ') success');
18e5cfe5d126 Load new url in database write callback
Michiel Broek <mbroek@mbse.eu>
parents: 484
diff changeset
4405 if (goback)
18e5cfe5d126 Load new url in database write callback
Michiel Broek <mbroek@mbse.eu>
parents: 484
diff changeset
4406 window.location.href = my_return;
18e5cfe5d126 Load new url in database write callback
Michiel Broek <mbroek@mbse.eu>
parents: 484
diff changeset
4407 else
18e5cfe5d126 Load new url in database write callback
Michiel Broek <mbroek@mbse.eu>
parents: 484
diff changeset
4408 window.location.href =
497
0fe366d953ab Prepare screens for product divide batch.
Michiel Broek <mbroek@mbse.eu>
parents: 495
diff changeset
4409 'prod_export.php?record=' + my_record + '&return=' + my_return + '&select=' + my_select + '&code=' + dataRecord.code + '&name=' + dataRecord.name +
0fe366d953ab Prepare screens for product divide batch.
Michiel Broek <mbroek@mbse.eu>
parents: 495
diff changeset
4410 '&stage=' + dataRecord.stage + '&split=' + dataRecord.divide_type;
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4411 },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4412 error: function(jqXHR, textStatus, errorThrown) {
489
18e5cfe5d126 Load new url in database write callback
Michiel Broek <mbroek@mbse.eu>
parents: 484
diff changeset
4413 console.log('saveRecord() ' + textStatus);
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4414 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4415 });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4416 };
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4417
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4418 dataAdapter.dataBind();
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4419
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4420 // initialize the input fields.
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4421 // Tab 1, Algemeen
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4422 $('#name').jqxTooltip({ content: 'De naam voor dit product.' });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4423 $('#name').jqxInput({ theme: theme, width: 640, height: 23 });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4424 $('#code').jqxTooltip({ content: 'Product code nummer.' });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4425 $('#code').jqxInput({ theme: theme, width: 100, height: 23 });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4426 $('#birth').jqxTooltip({ content: 'De ontwerp datum van dit product.' });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4427 $('#birth').jqxInput({ theme: theme, width: 120, height: 23 });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4428 $('#stage').jqxTooltip({ content: 'De productie fase van dit product.' });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4429 $('#stage').jqxInput({ theme: theme, width: 100, height: 23 });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4430 $('#locked').jqxCheckBox({ theme: theme, width: 120, height: 23, disabled: true });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4431 $('#locked').on('checked', function(event) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4432 if (dataRecord.stage >= 10) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4433 dataRecord.locked = 1;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4434 dataRecord.stage = 11;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4435 calcStage();
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4436 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4437 });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4438 $('#locked').on('unchecked', function(event) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4439 if (dataRecord.stage >= 10) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4440 dataRecord.locked = 0;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4441 dataRecord.stage = 10;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4442 calcStage();
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4443 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4444 });
533
be8691b7d634 Added the product divide scripts. All parts have all the volumes and weights divided, including the master record. Splitted batches have their own records with the product code formatted as code-n. From this design, we can rebuild the print and checklist.
Michiel Broek <mbroek@mbse.eu>
parents: 525
diff changeset
4445 $('#divide_parts').jqxTooltip({ content: 'Het aantal extra gesplitste brouw producten.' });
500
8d53ad389204 Reworked the splitted batches, the data is now in a separate table and there is only one product record.
Michiel Broek <mbroek@mbse.eu>
parents: 497
diff changeset
4446 $('#divide_parts').jqxNumberInput(Show0dec);
8d53ad389204 Reworked the splitted batches, the data is now in a separate table and there is only one product record.
Michiel Broek <mbroek@mbse.eu>
parents: 497
diff changeset
4447 $('#divide_type').jqxTooltip({ content: 'Het splitsing moment in het productie proces.' });
8d53ad389204 Reworked the splitted batches, the data is now in a separate table and there is only one product record.
Michiel Broek <mbroek@mbse.eu>
parents: 497
diff changeset
4448 $('#divide_type').jqxInput({ theme: theme, width: 120, height: 23 });
8d53ad389204 Reworked the splitted batches, the data is now in a separate table and there is only one product record.
Michiel Broek <mbroek@mbse.eu>
parents: 497
diff changeset
4449
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4450 $('#notes').jqxTooltip({ content: 'De uitgebreide opmerkingen over dit product.' });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4451 $('#notes').jqxInput({ theme: theme, width: 960, height: 100 });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4452 $('#type').jqxTooltip({ content: 'Het brouw type van dit recept.' });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4453 $('#type').jqxDropDownList({
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4454 theme: theme,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4455 source: RecipeTypeAdapter,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4456 valueMember: 'id',
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4457 displayMember: 'nl',
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4458 width: 180,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4459 height: 23,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4460 autoDropDownHeight: true
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4461 });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4462 $('#efficiency').jqxTooltip({ content: 'Het rendement van maischen en koken.' });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4463 $('#efficiency').jqxNumberInput(Perc1dec);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4464 $('#batch_size').jqxTooltip({ content: 'Het volume van het gekoelde wort na het koken.' });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4465 $('#batch_size').jqxNumberInput(Spin1dec);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4466 $('#batch_size').jqxNumberInput({ min: 4 });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4467 $('#boil_time').jqxTooltip({ content: 'De kooktijd in minuten.' });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4468 $('#boil_time').jqxNumberInput(PosInt);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4469 $('#boil_time').jqxNumberInput({ min: 4, max: 360 });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4470 $('#boil_size').jqxTooltip({ content: 'Het volume van het wort voor het koken.' });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4471 $('#boil_size').jqxNumberInput({ inputMode: 'simple', theme: theme, width: 90, height: 23, decimalDigits: 2, readOnly: true });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4472
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4473 $('#st_guide').jqxTooltip({ content: 'De bierstijl gids voor dit recept.'});
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4474 $('#st_guide').jqxInput({ theme: theme, width: 250, height: 23 });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4475 $('#st_name').jqxTooltip({ content: 'De bierstijl naam voor dit recept.'});
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4476 $('#st_name').jqxInput({ theme: theme, width: 250, height: 23 });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4477 $('#st_letter').jqxTooltip({ content: 'De bierstijl letter voor dit recept.'});
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4478 $('#st_letter').jqxInput({ theme: theme, width: 90, height: 23 });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4479 $('#st_type').jqxTooltip({ content: 'Het bierstijl type.'});
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4480 $('#st_type').jqxInput({ theme: theme, width: 250, height: 23 });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4481 $('#st_category').jqxTooltip({ content: 'De Amerikaanse bierstijl categorie.'});
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4482 $('#st_category').jqxInput({ theme: theme, width: 250, height: 23 });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4483 $('#st_category_number').jqxTooltip({ content: 'De Amerikaanse bierstijl categorie sub nummer.'});
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4484 $('#st_category_number').jqxNumberInput(Smal0dec);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4485
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4486 $('#est_og').jqxTooltip({ content: 'Het begin SG wat je wilt bereiken. De moutstort wordt automatisch herberekend.' });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4487 $('#est_og').jqxNumberInput(SGopts);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4488 $('#st_og_min').jqxTooltip({ content: 'Het minimum begin SG voor deze bierstijl.'});
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4489 $('#st_og_min').jqxNumberInput({ inputMode: 'simple', theme: theme, width: 50, height: 23, decimalDigits: 3, readOnly: true });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4490 $('#st_og_max').jqxTooltip({ content: 'Het maximum begin SG voor deze bierstijl.'});
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4491 $('#st_og_max').jqxNumberInput({ inputMode: 'simple', theme: theme, width: 50, height: 23, decimalDigits: 3, readOnly: true });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4492
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4493 $('#est_fg').jqxTooltip({ content: 'Het verwachte eind SG. Dit wordt automatisch berekend.' });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4494 $('#est_fg').jqxNumberInput(Show3dec);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4495 $('#st_fg_min').jqxTooltip({ content: 'Het minimum eind SG voor deze bierstijl.'});
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4496 $('#st_fg_min').jqxNumberInput({ inputMode: 'simple', theme: theme, width: 50, height: 23, decimalDigits: 3, readOnly: true });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4497 $('#st_fg_max').jqxTooltip({ content: 'Het maximum eind SG voor deze bierstijl.'});
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4498 $('#st_fg_max').jqxNumberInput({ inputMode: 'simple', theme: theme, width: 50, height: 23, decimalDigits: 3, readOnly: true });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4499
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4500 $('#est_abv').jqxTooltip({ content: 'Alcohol volume %. Dit wordt automatisch berekend.' });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4501 $('#est_abv').jqxNumberInput(Smal1dec);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4502 $('#st_abv_min').jqxTooltip({ content: 'Het minimum alcohol volume % voor deze bierstijl.'});
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4503 $('#st_abv_min').jqxNumberInput(Smal1dec);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4504 $('#st_abv_max').jqxTooltip({ content: 'Het maximum alcohol volume % voor deze bierstijl.'});
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4505 $('#st_abv_max').jqxNumberInput(Smal1dec);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4506
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4507 $('#est_color').jqxTooltip({ content: 'De kleur in EBC. Dit wordt automatisch berekend.' });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4508 $('#est_color').jqxNumberInput(Show0dec);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4509 $('#st_color_min').jqxTooltip({ content: 'De minimum kleur voor deze bierstijl.'});
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4510 $('#st_color_min').jqxNumberInput(Smal0dec);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4511 $('#st_color_max').jqxTooltip({ content: 'De maximum kleur voor deze bierstijl.'});
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4512 $('#st_color_max').jqxNumberInput(Smal0dec);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4513 $('#color_method').jqxDropDownList({
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4514 theme: theme,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4515 source: ColorMethodAdapter,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4516 valueMember: 'id',
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4517 displayMember: 'nl',
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4518 width: 180,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4519 height: 23,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4520 autoDropDownHeight: true
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4521 });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4522 $('#est_ibu').jqxTooltip({ content: 'De bitterheid in IBU. Dit wordt automatisch berekend.' });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4523 $('#est_ibu').jqxNumberInput(Show0dec);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4524 $('#st_ibu_min').jqxTooltip({ content: 'De minimum bitterheid voor deze bierstijl.'});
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4525 $('#st_ibu_min').jqxNumberInput(Smal0dec);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4526 $('#st_ibu_max').jqxTooltip({ content: 'De maximum bitterheid voor deze bierstijl.'});
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4527 $('#st_ibu_max').jqxNumberInput(Smal0dec);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4528 $('#ibu_method').jqxDropDownList({
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4529 theme: theme,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4530 source: IBUmethodAdapter,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4531 valueMember: 'id',
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4532 displayMember: 'nl',
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4533 width: 180,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4534 height: 23,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4535 autoDropDownHeight: true,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4536 dropDownVerticalAlignment: 'top'
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4537 });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4538 $('#kcal').jqxTooltip({ content: 'Energie-inhoud in kcal/liter.' });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4539 $('#kcal').jqxNumberInput(Smal0dec);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4540 $('#est_carb').jqxTooltip({ content: 'Koolzuur volume. Dit wordt automatisch berekend.' });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4541 $('#est_carb').jqxNumberInput(Smal1dec);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4542 $('#st_carb_min').jqxTooltip({ content: 'Het minimum koolzuur volume voor deze bierstijl.'});
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4543 $('#st_carb_min').jqxNumberInput(Smal1dec);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4544 $('#st_carb_max').jqxTooltip({ content: 'Het maximum koolzuur volume voor deze bierstijl.'});
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4545 $('#st_carb_max').jqxNumberInput(Smal1dec);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4546
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4547 // Tab 2, Equipment
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4548 $('#eq_name').jqxTooltip({ content: 'De naam van deze brouw apparatuur.' });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4549 $('#eq_name').jqxInput({ theme: theme, width: 250, height: 23 });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4550 $('#eq_boil_size').jqxTooltip({ content: 'Normaal kook volume in liters' });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4551 $('#eq_boil_size').jqxNumberInput(Show1dec);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4552 $('#eq_batch_size').jqxTooltip({ content: 'Berekende batch grootte in liters aan het eind van de kook.' });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4553 $('#eq_batch_size').jqxNumberInput(Show1dec);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4554 $('#eq_tun_volume').jqxTooltip({ content: 'Maisch ketel volume.' });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4555 $('#eq_tun_volume').jqxNumberInput(Show1dec);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4556 $('#eq_top_up_water').jqxTooltip({ content: 'Extra water in het gistvat.' });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4557 $('#eq_top_up_water').jqxNumberInput(Show1dec);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4558 $('#eq_trub_chiller_loss').jqxTooltip({ content: 'Standaard verlies bij het overbrengen naar het gistvat.' });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4559 $('#eq_trub_chiller_loss').jqxNumberInput(Show1dec);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4560 $('#eq_evap_rate').jqxTooltip({ content: 'Verdamping in liters per uur.' });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4561 $('#eq_evap_rate').jqxNumberInput(Show2dec);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4562 $('#eq_boil_time').jqxTooltip({ content: 'Normale kooktijd in minuten.' });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4563 $('#eq_boil_time').jqxNumberInput(Show0dec);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4564 $('#eq_top_up_kettle').jqxTooltip({ content: 'Extra water toevoegen tijdens de kook.' });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4565 $('#eq_top_up_kettle').jqxNumberInput(Show1dec);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4566 $('#eq_hop_utilization').jqxTooltip({ content: '100% voor kleine installaties, hoger voor grote brouwerijen.' });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4567 $('#eq_hop_utilization').jqxNumberInput(Show0dec);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4568 $('#eq_notes').jqxTooltip({ content: 'Opmerkingen over deze apparatuur.' });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4569 $('#eq_notes').jqxInput({ theme: theme, width: 960, height: 200 });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4570 $('#eq_lauter_volume').jqxTooltip({ content: 'Filterkuip volume.' });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4571 $('#eq_lauter_volume').jqxNumberInput(Show1dec);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4572 $('#eq_lauter_deadspace').jqxTooltip({ content: 'Filterkuip verlies in liters.' });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4573 $('#eq_lauter_deadspace').jqxNumberInput(Show1dec);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4574 $('#eq_kettle_volume').jqxTooltip({ content: 'Kook ketel volume in liters.' });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4575 $('#eq_kettle_volume').jqxNumberInput(Show1dec);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4576 $('#eq_mash_volume').jqxTooltip({ content: 'Maisch water voor de eerste stap.' });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4577 $('#eq_mash_volume').jqxNumberInput(Show1dec);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4578 $('#eq_mash_max').jqxTooltip({ content: 'De maximale moutstort in Kg.' });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4579 $('#eq_mash_max').jqxNumberInput(Show1dec);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4580 $('#eq_efficiency').jqxTooltip({ content: 'Gemiddeld brouwzaal rendement.' });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4581 $('#eq_efficiency').jqxNumberInput(Show1dec);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4582
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4583 // Tab 3, Fermentables
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4584 $('#est_color2').jqxTooltip({ content: 'De kleur in EBC. Dit wordt automatisch berekend.' });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4585 $('#est_color2').jqxNumberInput(Show0dec);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4586 $('#est_og2').jqxTooltip({ content: 'Het geschatte begin SG van dit product.' });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4587 $('#est_og2').jqxNumberInput(Show3dec);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4588 $('#mash_kg').jqxTooltip({ content: 'Het gewicht van alle mouten in de maisch.' });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4589 $('#mash_kg').jqxNumberInput(Show3dec);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4590 $('#perc_malts').jqxProgressBar({
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4591 width: 300,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4592 height: 23,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4593 theme: theme,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4594 showText: true,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4595 max: 120,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4596 animationDuration: 0,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4597 colorRanges: [
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4598 { stop: 90, color: '#008C00' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4599 { stop: 100, color: '#EB7331' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4600 { stop: 120, color: '#FF0000' }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4601 ],
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4602 renderText: function(text) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4603 return (Math.round(parseInt(text) * 1.2)) + '%';
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4604 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4605 });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4606 $('#perc_sugars').jqxProgressBar({
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4607 width: 300,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4608 height: 23,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4609 theme: theme,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4610 showText: true,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4611 max: 50,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4612 animationDuration: 0,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4613 colorRanges: [
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4614 { stop: 20, color: '#008C00' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4615 { stop: 50, color: '#FF0000' }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4616 ],
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4617 renderText: function(text) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4618 return (Math.round(parseInt(text) * 5) / 10) + '%';
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4619 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4620 });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4621 $('#perc_cara').jqxProgressBar({
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4622 width: 300,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4623 height: 23,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4624 theme: theme,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4625 showText: true,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4626 max: 50,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4627 animationDuration: 0,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4628 colorRanges: [
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4629 { stop: 25, color: '#008C00' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4630 { stop: 50, color: '#FF0000' }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4631 ],
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4632 renderText: function(text) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4633 return (Math.round(parseInt(text) * 5) / 10) + '%';
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4634 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4635 });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4636 $('#ferm_lintner').jqxProgressBar({
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4637 width: 300,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4638 height: 23,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4639 theme: theme,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4640 showText: true,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4641 max: 200,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4642 animationDuration: 0,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4643 colorRanges: [
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4644 { stop: 30, color: '#FF0000' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4645 { stop: 40, color: '#EB7331' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4646 { stop: 200, color: '#008C00' }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4647 ],
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4648 renderText: function(text) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4649 return (parseInt(text) * 2) + ' lintner';
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4650 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4651 });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4652 $('#popupFermentable').jqxWindow({
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4653 width: 800,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4654 height: 300,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4655 position: { x: 230, y: 100 },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4656 resizable: false,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4657 theme: theme,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4658 isModal: true,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4659 autoOpen: false,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4660 cancelButton: $('#FermentableReady'),
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4661 modalOpacity: 0.40
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4662 });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4663 $('#FermentableReady').jqxButton({ template: 'success', width: '90px', theme: theme });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4664 $('#FermentableReady').click(function() {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4665 var row, rowID = $('#fermentableGrid').jqxGrid('getrowid', fermentableRow);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4666 console.log('FermentableReady row:' + fermentableRow + ' ID:' + rowID);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4667 row = {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4668 f_name: fermentableData.f_name,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4669 f_origin: fermentableData.f_origin,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4670 f_supplier: fermentableData.f_supplier,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4671 f_amount: fermentableData.f_amount,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4672 f_cost: fermentableData.f_cost,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4673 f_type: fermentableData.f_type,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4674 f_yield: fermentableData.f_yield,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4675 f_color: fermentableData.f_color,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4676 f_coarse_fine_diff: fermentableData.f_coarse_fine_diff,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4677 f_moisture: fermentableData.f_moisture,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4678 f_diastatic_power: fermentableData.f_diastatic_power,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4679 f_protein: fermentableData.f_protein,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4680 f_max_in_batch: fermentableData.f_max_in_batch,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4681 f_graintype: fermentableData.f_graintype,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4682 f_added: fermentableData.f_added,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4683 f_dissolved_protein: fermentableData.f_dissolved_protein,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4684 f_recommend_mash: fermentableData.f_recommend_mash,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4685 f_add_after_boil: fermentableData.f_add_after_boil,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4686 f_adjust_to_total_100: fermentableData.f_adjust_to_total_100,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4687 f_percentage: fermentableData.f_percentage,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4688 f_di_ph: fermentableData.f_di_ph,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4689 f_acid_to_ph_57: fermentableData.f_acid_to_ph_57,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4690 f_inventory: fermentableData.f_inventory,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4691 f_avail: fermentableData.f_avail
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4692 };
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4693 $('#fermentableGrid').jqxGrid('updaterow', rowID, row);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4694 calcPercentages();
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4695 calcFermentables();
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4696 calcIBUs();
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4697 calcMash();
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4698 // Waters: yes there is impact.
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4699 });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4700 $('#wf_name').jqxInput({ theme: theme, width: 320, height: 23 });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4701 $('#wf_instock').jqxCheckBox({ theme: theme, height: 23 });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4702 $('#wf_instock').on('change', function(event) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4703 fermentableinstock = event.args.checked;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4704 fermentablelist.dataBind();
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4705 });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4706 $('#wf_select').jqxDropDownList({
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4707 placeHolder: 'Kies mout:',
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4708 theme: theme,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4709 source: fermentablelist,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4710 displayMember: 'name',
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4711 width: 150,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4712 height: 23,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4713 dropDownWidth: 500,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4714 dropDownHeight: 500,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4715 renderer: function(index, label, value) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4716 var datarecord = fermentablelist.records[index];
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4717 return datarecord.supplier + ' / ' + datarecord.name + ' (' + datarecord.color + ' EBC)';
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4718 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4719 });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4720 $('#wf_select').on('select', function(event) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4721 if (event.args) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4722 var datarecord, index = event.args.index;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4723 datarecord = fermentablelist.records[index];
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4724 $('#wf_name').val(datarecord.name);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4725 fermentableData.f_name = datarecord.name;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4726 fermentableData.f_origin = datarecord.origin;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4727 fermentableData.f_supplier = datarecord.supplier;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4728 fermentableData.f_type = datarecord.type;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4729 fermentableData.f_cost = datarecord.cost;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4730 fermentableData.f_yield = datarecord.yield;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4731 fermentableData.f_color = datarecord.color;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4732 fermentableData.f_coarse_fine_diff = datarecord.coarse_fine_diff;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4733 fermentableData.f_moisture = datarecord.moisture;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4734 fermentableData.f_diastatic_power = datarecord.diastatic_power;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4735 fermentableData.f_protein = datarecord.protein;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4736 fermentableData.f_max_in_batch = datarecord.max_in_batch;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4737 fermentableData.f_graintype = datarecord.graintype;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4738 fermentableData.f_dissolved_protein = datarecord.dissolved_protein;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4739 fermentableData.f_recommend_mash = datarecord.recommend_mash;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4740 fermentableData.f_add_after_boil = datarecord.add_after_boil;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4741 fermentableData.f_di_ph = datarecord.di_ph;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4742 fermentableData.f_acid_to_ph_57 = datarecord.acid_to_ph_57;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4743 fermentableData.f_inventory = datarecord.inventory;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4744 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4745 });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4746 $('#wf_amount').jqxNumberInput(Spin3dec);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4747 $('#wf_amount').on('change', function(event) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4748 console.log('amount changed: ' + event.args.value);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4749 $('#fermentableGrid').jqxGrid('setcellvalue', fermentableRow, 'f_amount', event.args.value);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4750 fermentableData.f_amount = event.args.value;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4751 if (! to_100) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4752 calcPercentages();
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4753 calcFermentables();
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4754 calcIBUs();
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4755 calcMash();
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4756 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4757 });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4758 $('#wf_percentage').jqxNumberInput(Perc1dec);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4759 $('#wf_percentage').on('change', function(event) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4760 var newvalue, rowscount, rowdata, diff, tw, damount, namount, nw, newperc,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4761 oldvalue = Math.round(fermentableData.f_percentage * 10) / 10.0;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4762 newvalue = event.args.value;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4763 console.log('percentage changed: ' + newvalue + ' old: ' + oldvalue);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4764 fermentableData.f_percent = newvalue;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4765 rowscount = $('#fermentableGrid').jqxGrid('getdatainformation').rowscount;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4766 if ((oldvalue != newvalue) && (rowscount > 1)) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4767 rowdata = $('#fermentableGrid').jqxGrid('getrowdata', fermentableRow);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4768 if (rowdata.f_adjust_to_total_100) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4769 $('#wf_percentage').val(oldvalue);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4770 } else {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4771 diff = newvalue - oldvalue;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4772 tw = 0; // total weight
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4773 for (i = 0; i < rowscount; i++) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4774 rowdata = $('#fermentableGrid').jqxGrid('getrowdata', i);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4775 if (rowdata.f_added < 4)
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4776 tw += Math.round(rowdata.f_amount * 1000) / 1000;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4777 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4778 tw = Math.round(tw * 1000) / 1000;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4779 if (to_100) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4780 // Adjust this row and the 100% row.
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4781 damount = Math.round(tw * diff * 10) / 1000;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4782 rowdata = $('#fermentableGrid').jqxGrid('getrowdata', fermentableRow);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4783 namount = Round(rowdata.f_amount + damount, 3);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4784 $('#fermentableGrid').jqxGrid('setcellvalue', fermentableRow, 'f_amount', namount);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4785 $('#wf_amount').val(namount);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4786 $('#fermentableGrid').jqxGrid('setcellvalue', fermentableRow, 'f_percentage', rowdata.f_percentage + diff);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4787 for (i = 0; i < rowscount; i++) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4788 rowdata = $('#fermentableGrid').jqxGrid('getrowdata', i);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4789 if (rowdata.f_adjust_to_total_100) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4790 namount = rowdata.f_amount - damount;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4791 $('#fermentableGrid').jqxGrid('setcellvalue', i, 'f_percentage', rowdata.f_percentage - diff);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4792 $('#fermentableGrid').jqxGrid('setcellvalue', i, 'f_amount', namount);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4793 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4794 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4795 calcFermentables();
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4796 calcIBUs();
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4797 calcMash();
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4798 } else {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4799 // Adjust all the rows.
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4800 nw = tw * diff / 100;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4801 for (i = 0; i < rowscount; i++) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4802 rowdata = $('#fermentableGrid').jqxGrid('getrowdata', i);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4803 if (rowdata.f_added < 4) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4804 if (i == fermentableRow) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4805 namount = Math.round((rowdata.f_amount + nw) * 1000) / 1000;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4806 $('#fermentableGrid').jqxGrid('setcellvalue', i, 'f_amount', namount);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4807 // $('#wf_amount').val(namount); // Will crash the script.
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4808 $('#fermentableGrid').jqxGrid('setcellvalue', i, 'f_percentage', newvalue);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4809 } else {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4810 namount = Math.round((rowdata.f_amount - (nw / (rowscount - 1))) * 1000) / 1000;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4811 newperc = Math.round((namount / tw) * 1000) / 10.0;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4812 $('#fermentableGrid').jqxGrid('setcellvalue', i, 'f_amount', namount);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4813 $('#fermentableGrid').jqxGrid('setcellvalue', i, 'f_percentage', newperc);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4814 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4815 } else {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4816 $('#fermentableGrid').jqxGrid('setcellvalue', i, 'f_percentage', 0);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4817 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4818 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4819 calcFermentables();
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4820 calcIBUs();
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4821 calcMash();
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4822 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4823 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4824 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4825 });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4826 $('#wf_max_in_batch').jqxNumberInput(Show1dec);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4827 $('#wf_adjust_to_total_100').jqxCheckBox({ theme: theme, width: 120, height: 23 });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4828 $('#wf_adjust_to_total_100').on('checked', function(event) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4829 if (fermentableData.f_adjust_to_total_100 == 0) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4830 if (to_100) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4831 // Reset other flag first.
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4832 var i, rowscount = $('#fermentableGrid').jqxGrid('getdatainformation').rowscount;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4833 for (i = 0; i < rowscount; i++) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4834 if (i != fermentableRow) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4835 $('#fermentableGrid').jqxGrid('setcellvalue', i, 'f_adjust_to_total_100', 0);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4836 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4837 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4838 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4839 $('#fermentableGrid').jqxGrid('setcellvalue', fermentableRow, 'f_adjust_to_total_100', 1);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4840 calcFermentables();
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4841 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4842 });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4843 $('#wf_adjust_to_total_100').on('unchecked', function(event) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4844 if (fermentableData.f_adjust_to_total_100 != 0) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4845 $('#fermentableGrid').jqxGrid('setcellvalue', fermentableRow, 'f_adjust_to_total_100', 0);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4846 calcFermentables();
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4847 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4848 });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4849 $('#wf_added').jqxDropDownList({
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4850 theme: theme,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4851 source: AddedAdapter,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4852 valueMember: 'id',
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4853 displayMember: 'nl',
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4854 width: 180,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4855 height: 23,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4856 autoDropDownHeight: true,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4857 dropDownVerticalAlignment: 'top'
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4858 });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4859 $('#wf_added').on('select', function(event) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4860 if (event.args) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4861 var index = event.args.index;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4862 $('#fermentableGrid').jqxGrid('setcellvalue', fermentableRow, 'f_added', index);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4863 calcFermentables();
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4864 calcIBUs();
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4865 calcMash();
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4866 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4867 });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4868
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4869 // Tab 4, Hops
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4870 $('#est_ibu2').jqxTooltip({ content: 'De bitterheid in IBU. Dit wordt automatisch berekend.' });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4871 $('#est_ibu2').jqxNumberInput(Smal0dec);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4872 $('#hop_flavour').jqxProgressBar({
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4873 width: 300,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4874 height: 23,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4875 theme: theme,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4876 showText: true,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4877 animationDuration: 0,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4878 colorRanges: [
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4879 { stop: 20, color: '#004D00' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4880 { stop: 40, color: '#008C00' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4881 { stop: 60, color: '#00BF00' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4882 { stop: 80, color: '#00FF00' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4883 { stop: 100, color: '#80FF80' }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4884 ],
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4885 renderText: function(text) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4886 var val = parseInt(text);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4887 if (val < 20)
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4888 return 'Weinig';
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4889 else if (val < 40)
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4890 return 'Matig';
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4891 else if (val < 60)
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4892 return 'Redelijk';
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4893 else if (val < 80)
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4894 return 'Veel';
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4895 else
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4896 return 'Zeer veel';
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4897 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4898 });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4899 $('#hop_aroma').jqxProgressBar({
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4900 width: 300, height: 23, theme: theme, showText: true,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4901 animationDuration: 0,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4902 colorRanges: [
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4903 { stop: 20, color: '#004D00' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4904 { stop: 40, color: '#008C00' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4905 { stop: 60, color: '#00BF00' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4906 { stop: 80, color: '#00FF00' },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4907 { stop: 100, color: '#80FF80' }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4908 ],
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4909 renderText: function(text) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4910 var val = parseInt(text);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4911 if (val < 20)
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4912 return 'Weinig';
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4913 else if (val < 40)
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4914 return 'Matig';
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4915 else if (val < 60)
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4916 return 'Redelijk';
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4917 else if (val < 80)
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4918 return 'Veel';
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4919 else
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4920 return 'Zeer veel';
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4921 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4922 });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4923 $('#popupHop').jqxWindow({
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4924 width: 800,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4925 height: 300,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4926 position: { x: 230, y: 100 },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4927 resizable: false,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4928 theme: theme,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4929 isModal: true,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4930 autoOpen: false,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4931 cancelButton: $('#HopReady'),
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4932 modalOpacity: 0.40
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4933 });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4934 $('#HopReady').jqxButton({ template: 'success', width: '90px', theme: theme });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4935 $('#HopReady').click(function() {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4936 var row, rowID = $('#hopGrid').jqxGrid('getrowid', hopRow);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4937 row = {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4938 h_name: $('#wh_name').val(),
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4939 h_origin: hopData.h_origin,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4940 h_amount: parseFloat($('#wh_amount').jqxNumberInput('decimal')) / 1000,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4941 h_cost: hopData.h_cost,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4942 h_type: hopData.h_type,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4943 h_form: hopData.h_form,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4944 h_useat: $('#wh_useat').val(),
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4945 h_time: hopData.h_time,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4946 h_alpha: hopData.h_alpha,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4947 h_beta: hopData.h_beta,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4948 h_hsi: hopData.h_hsi,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4949 h_humulene: hopData.h_humulene,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4950 h_caryophyllene: hopData.h_caryophyllene,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4951 h_cohumulone: hopData.h_cohumulone,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4952 h_myrcene: hopData.h_myrcene,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4953 h_total_oil: hopData.h_total_oil,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4954 h_inventory: hopData.h_inventory,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4955 h_avail: hopData.h_avail
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4956 };
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4957 $('#hopGrid').jqxGrid('updaterow', rowID, row);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4958 calcIBUs();
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4959 });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4960 $('#wh_name').jqxInput({ theme: theme, width: 320, height: 23 });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4961 $('#wh_instock').jqxCheckBox({ theme: theme, height: 23 });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4962 $('#wh_instock').on('change', function(event) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4963 hopinstock = event.args.checked;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4964 hoplist.dataBind();
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4965 });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4966 $('#wh_select').jqxDropDownList({
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4967 placeHolder: 'Kies hop:',
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4968 theme: theme,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4969 source: hoplist,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4970 displayMember: 'name',
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4971 width: 150,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4972 height: 23,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4973 dropDownWidth: 500,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4974 dropDownHeight: 500,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4975 renderer: function(index, label, value) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4976 var datarecord = hoplist.records[index];
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4977 return datarecord.origin + ' - ' + datarecord.name + ' / ' + HopFormData[datarecord.form].nl + ' (' + datarecord.alpha + ' % &alpha;)';
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4978 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4979 });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4980 $('#wh_select').on('select', function(event) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4981 if (event.args) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4982 var datarecord, index = event.args.index;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4983 datarecord = hoplist.records[index];
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4984 $('#wh_name').val(datarecord.name);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4985 hopData.h_name = datarecord.name;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4986 hopData.h_origin = datarecord.origin;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4987 hopData.h_cost = datarecord.cost;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4988 hopData.h_type = datarecord.type;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4989 hopData.h_form = datarecord.form;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4990 hopData.h_alpha = datarecord.alpha;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4991 hopData.h_beta = datarecord.beta;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4992 hopData.h_hsi = datarecord.hsi;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4993 hopData.h_humulene = datarecord.humulene;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4994 hopData.h_caryophyllene = datarecord.caryophyllene;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4995 hopData.h_cohumulone = datarecord.cohumulone;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4996 hopData.h_myrcene = datarecord.myrcene;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4997 hopData.h_total_oil = datarecord.total_oil;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4998 hopData.h_inventory = datarecord.inventory;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
4999 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5000 });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5001 $('#wh_amount').jqxNumberInput(Spin1dec);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5002 $('#wh_amount').on('change', function(event) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5003 console.log('amount changed: ' + event.args.value + ' time:' + hopData.h_time + ' alpha:' + hopData.h_alpha);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5004 var ibu, amount = parseFloat(event.args.value) / 1000;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5005 ibu = toIBU(hopData.h_useat, hopData.h_form, preboil_sg, parseFloat($('#batch_size').jqxNumberInput('decimal')),
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5006 amount, parseFloat(hopData.h_time), parseFloat(hopData.h_alpha), $('#ibu_method').val()
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5007 );
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5008 hopData.h_amount = amount;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5009 $('#wh_ibu').val(ibu);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5010 });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5011 $('#wh_ibu').jqxNumberInput(Show1dec);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5012 $('#wh_time').jqxNumberInput(PosInt);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5013 $('#wh_time').on('change', function(event) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5014 var ibu, newtime = parseFloat(event.args.value);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5015 // Check limits and correct
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5016 if (hopData.h_useat == 2) { // Boil
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5017 if (newtime > parseFloat($('#boil_time').jqxNumberInput('decimal'))) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5018 newtime = parseFloat($('#boil_time').jqxNumberInput('decimal'));
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5019 $('#wh_time').val(newtime);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5020 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5021 hopData.h_time = newtime;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5022 } else if (hopData.h_useat == 4) { // Whirlpool
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5023 if (newtime > 120) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5024 newtime = 120;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5025 $('#wh_time').val(newtime);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5026 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5027 hopData.h_time = newtime;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5028 } else if (hopData.h_useat == 5) { // Dry hop
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5029 if (newtime > 21) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5030 newtime = 21;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5031 $('#wh_time').val(newtime);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5032 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5033 hopData.h_time = newtime * 1440;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5034 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5035 ibu = toIBU(hopData.h_useat, hopData.h_form, preboil_sg, parseFloat($('#batch_size').jqxNumberInput('decimal')),
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5036 parseFloat(hopData.h_amount), parseFloat(hopData.h_time), parseFloat(hopData.h_alpha), $('#ibu_method').val());
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5037 // console.log("time changed: "+newtime+" final:"+hopData.h_time+" ibu:"+ibu);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5038 $('#wh_ibu').val(ibu);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5039 });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5040 $('#wh_useat').jqxDropDownList({
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5041 theme: theme,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5042 source: HopUseAdapter,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5043 valueMember: 'id',
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5044 displayMember: 'nl',
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5045 width: 180,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5046 height: 23,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5047 autoDropDownHeight: true,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5048 dropDownVerticalAlignment: 'top'
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5049 });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5050 $('#wh_useat').on('select', function(event) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5051 if (event.args) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5052 var index = event.args.index;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5053 hopData.h_useat = index;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5054 if ((index == 0) || (index == 1)) { // Mashhop or First wort hop
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5055 hopData.h_time = parseFloat(dataRecord.boil_time);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5056 $('#wh_time').jqxNumberInput({ spinButtons: false, readOnly: true, width: 90 });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5057 $('#wh_time').val(hopData.h_time);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5058 } else if (index == 3) { // Aroma
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5059 hopData.h_time = 0;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5060 $('#wh_time').jqxNumberInput({ spinButtons: false, readOnly: true, width: 90 });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5061 $('#wh_time').val(0);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5062 } else { // Boil, Whirlpool or Dry hop
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5063 $('#wh_time').jqxNumberInput({ spinButtons: true, readOnly: false, width: 110 });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5064 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5065 if (index == 5) // Dry hop
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5066 $('#wh_pmpt_time').html('Tijd in dagen');
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5067 else
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5068 $('#wh_pmpt_time').html('Tijd in minuten');
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5069 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5070 });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5071
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5072 // Tab 5, Miscs
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5073 $('#popupMisc').jqxWindow({
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5074 width: 800,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5075 height: 275,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5076 position: { x: 230, y: 100 },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5077 resizable: false,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5078 theme: theme,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5079 isModal: true,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5080 autoOpen: false,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5081 cancelButton: $('#MiscReady'),
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5082 modalOpacity: 0.40
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5083 });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5084 $('#MiscReady').jqxButton({ template: 'success', width: '90px', theme: theme });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5085 $('#MiscReady').click(function() {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5086 var row, rowID = $('#miscGrid').jqxGrid('getrowid', miscRow);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5087 console.log('MiscReady row:' + miscRow + ' ID:' + rowID);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5088 row = {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5089 m_name: miscData.m_name,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5090 m_amount: miscData.m_amount,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5091 m_cost: miscData.m_cost,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5092 m_type: miscData.m_type,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5093 m_use_use: miscData.m_use_use,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5094 m_time: miscData.m_time,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5095 m_amount_is_weight: miscData.m_amount_is_weight,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5096 m_inventory: miscData.m_inventory,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5097 m_avail: miscData.m_avail
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5098 };
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5099 $('#miscGrid').jqxGrid('updaterow', rowID, row);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5100 calcMiscs();
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5101 });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5102 $('#wm_name').jqxInput({ theme: theme, width: 320, height: 23 });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5103 $('#wm_instock').jqxCheckBox({ theme: theme, height: 23 });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5104 $('#wm_instock').on('change', function(event) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5105 miscinstock = event.args.checked;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5106 misclist.dataBind();
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5107 });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5108 $('#wm_select').jqxDropDownList({
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5109 placeHolder: 'Kies ingredi&euml;nt:',
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5110 theme: theme,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5111 source: misclist,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5112 displayMember: 'name',
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5113 width: 150,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5114 height: 23,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5115 dropDownWidth: 500,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5116 dropDownHeight: 500
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5117 });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5118 $('#wm_select').on('select', function(event) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5119 if (event.args) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5120 var datarecord, index = event.args.index;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5121 datarecord = misclist.records[index];
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5122 $('#wm_name').val(datarecord.name);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5123 miscData.m_name = datarecord.name;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5124 miscData.m_cost = datarecord.cost;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5125 miscData.m_type = datarecord.type;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5126 miscData.m_use_use = datarecord.use_use;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5127 miscData.m_amount_is_weight = datarecord.amount_is_weight;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5128 miscData.m_inventory = datarecord.inventory;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5129 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5130 });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5131 $('#wm_amount').jqxNumberInput(Spin2dec);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5132 $('#wm_amount').on('change', function(event) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5133 console.log('amount changed: ' + event.args.value);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5134 miscData.m_amount = parseFloat(event.args.value) / 1000;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5135 });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5136 $('#wm_time').jqxNumberInput(PosInt);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5137 $('#wm_time').on('change', function(event) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5138 var newtime = parseFloat(event.args.value);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5139
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5140 if (miscData.m_use_use == 2) { // Boil
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5141 if (newtime > parseFloat($('#boil_time').jqxNumberInput('decimal'))) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5142 newtime = parseFloat($('#boil_time').jqxNumberInput('decimal'));
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5143 $('#wm_time').val(newtime);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5144 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5145 miscData.m_time = newtime;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5146 } else if ((miscData.m_use_use == 3) || (miscData.m_use_use == 4)) { // Primary or Secondary
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5147 if (newtime > 21) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5148 newtime = 21;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5149 $('#wm_time').val(newtime);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5150 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5151 miscData.m_time = newtime * 1440;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5152 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5153 });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5154 $('#wm_use_use').jqxDropDownList({
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5155 theme: theme,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5156 source: MiscUseAdapter,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5157 valueMember: 'id',
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5158 displayMember: 'nl',
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5159 width: 180,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5160 height: 23,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5161 autoDropDownHeight: true,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5162 dropDownVerticalAlignment: 'top'
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5163 });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5164 $('#wm_use_use').on('select', function(event) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5165 if (event.args) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5166 var index = event.args.index;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5167 miscData.m_use_use = index;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5168 if ((index == 2) || (index == 3) || (index == 4)) { // Boil, Primary or Secondary
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5169 $('#wm_time').jqxNumberInput({ spinButtons: true, readOnly: false, width: 110 });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5170 } else {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5171 $('#wm_time').jqxNumberInput({ spinButtons: false, readOnly: true, width: 90 });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5172 $('#wm_time').val(0);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5173 miscData.m_time = 0;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5174 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5175 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5176 });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5177
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5178 // Tab 6, Yeasts
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5179 $('#est_fg2').jqxTooltip({ content: 'Het verwachte eind SG. Dit wordt automatisch berekend.' });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5180 $('#est_fg2').jqxNumberInput(Show3dec);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5181 $('#est_abv2').jqxTooltip({ content: 'Alcohol volume %. Dit wordt automatisch berekend.' });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5182 $('#est_abv2').jqxNumberInput(Smal1dec);
518
00e110567fee The default starter SG changed to 1.037. Added several tooltips on the yeast tab.
Michiel Broek <mbroek@mbse.eu>
parents: 515
diff changeset
5183 $('#yeast_cells').jqxTooltip({ content: 'Het aantal beschikbare gistcellen zonder eventuele starter.' });
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5184 $('#yeast_cells').jqxNumberInput(Show1dec);
518
00e110567fee The default starter SG changed to 1.037. Added several tooltips on the yeast tab.
Michiel Broek <mbroek@mbse.eu>
parents: 515
diff changeset
5185 $('#need_cells').jqxTooltip({ content: 'Het aantal nodige cellen is afhankelijk van het biertype.' });
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5186 $('#need_cells').jqxNumberInput(Show1dec);
518
00e110567fee The default starter SG changed to 1.037. Added several tooltips on the yeast tab.
Michiel Broek <mbroek@mbse.eu>
parents: 515
diff changeset
5187 $('#plato_cells').jqxTooltip({ content: 'De berekende hoeveelheid gistcellen in miljard per ml per graad Plato. Dit is de zogenaamde pitchrate.' });
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5188 $('#plato_cells').jqxNumberInput(Show2dec);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5189 $('#popupYeast').jqxWindow({
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5190 width: 800,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5191 height: 300,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5192 position: { x: 230, y: 100 },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5193 resizable: false,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5194 theme: theme,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5195 isModal: true,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5196 autoOpen: false,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5197 cancelButton: $('#YeastReady'),
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5198 modalOpacity: 0.40
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5199 });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5200 $('#YeastReady').jqxButton({ template: 'success', width: '90px', theme: theme });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5201 $('#YeastReady').click(function() {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5202 var row, rowID = $('#yeastGrid').jqxGrid('getrowid', yeastRow);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5203 console.log('YeastReady row:' + yeastRow + ' ID:' + rowID);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5204 row = {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5205 y_name: yeastData.y_name,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5206 y_laboratory: yeastData.y_laboratory,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5207 y_product_id: yeastData.y_product_id,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5208 y_amount: yeastData.y_amount,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5209 y_cost: yeastData.y_cost,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5210 y_type: yeastData.y_type,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5211 y_form: yeastData.y_form,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5212 y_flocculation: yeastData.y_flocculation,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5213 y_min_temperature: yeastData.y_min_temperature,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5214 y_max_temperature: yeastData.y_max_temperature,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5215 y_attenuation: yeastData.y_attenuation,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5216 y_use: yeastData.y_use,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5217 y_cells: yeastData.y_cells,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5218 y_tolerance: yeastData.y_tolerance,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5219 y_inventory: yeastData.y_inventory,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5220 y_avail: yeastData.y_avail
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5221 };
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5222 $('#yeastGrid').jqxGrid('updaterow', rowID, row);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5223 calcFermentables();
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5224 calcYeast();
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5225 });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5226 $('#wy_name').jqxInput({ theme: theme, width: 320, height: 23 });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5227 $('#wy_laboratory').jqxInput({ theme: theme, width: 320, height: 23 });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5228 $('#wy_product_id').jqxInput({ theme: theme, width: 320, height: 23 });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5229 $('#wy_instock').jqxCheckBox({ theme: theme, height: 23 });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5230 $('#wy_instock').on('change', function(event) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5231 yeastinstock = event.args.checked;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5232 yeastlist.dataBind();
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5233 });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5234 $('#wy_select').jqxDropDownList({
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5235 placeHolder: 'Kies gist:',
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5236 theme: theme,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5237 source: yeastlist,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5238 displayMember: 'name',
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5239 width: 150,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5240 height: 23,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5241 dropDownWidth: 500,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5242 dropDownHeight: 500,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5243 renderer: function(index, label, value) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5244 var datarecord = yeastlist.records[index];
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5245 return datarecord.laboratory + ' ' + datarecord.product_id + ' ' + datarecord.name;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5246 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5247 });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5248 $('#wy_select').on('select', function(event) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5249 if (event.args) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5250 var datarecord, index = event.args.index;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5251 datarecord = yeastlist.records[index];
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5252 $('#wy_name').val(datarecord.name);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5253 $('#wy_laboratory').val(datarecord.laboratory);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5254 $('#wy_product_id').val(datarecord.product_id);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5255 yeastData.y_name = datarecord.name;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5256 yeastData.y_cost = datarecord.cost;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5257 yeastData.y_type = datarecord.type;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5258 yeastData.y_form = datarecord.form;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5259 yeastData.y_laboratory = datarecord.laboratory;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5260 yeastData.y_product_id = datarecord.product_id;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5261 yeastData.y_min_temperature = datarecord.min_temperature;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5262 yeastData.y_max_temperature = datarecord.max_temperature;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5263 yeastData.y_flocculation = datarecord.flocculation;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5264 yeastData.y_attenuation = datarecord.attenuation;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5265 yeastData.y_cells = datarecord.cells;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5266 yeastData.y_inventory = datarecord.inventory;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5267 if (yeastData.y_form == 0) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5268 $('#wy_pmpt_amount').html('Pak(ken):');
515
9d771385a8a0 Added dried yeast form. Pitch rate for Kveik initially set at 0.25. Dried Kveik cells set to 9000000000 cells/gram.
Michiel Broek <mbroek@mbse.eu>
parents: 500
diff changeset
5269 } else if (yeastData.y_form == 1 || yeastData.y_form == 6) {
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5270 $('#wy_pmpt_amount').html('Gewicht gram:');
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5271 } else {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5272 $('#wy_pmpt_amount').html('Volume ml:');
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5273 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5274 calcFermentables();
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5275 calcYeast();
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5276 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5277 });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5278 $('#wy_amount').jqxNumberInput(Spin1dec);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5279 $('#wy_amount').on('change', function(event) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5280 var amount = parseFloat(event.args.value);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5281 if (yeastData.y_form != 0) // not Liquid
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5282 amount = parseFloat(event.args.value) / 1000;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5283 yeastData.y_amount = amount;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5284 calcFermentables();
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5285 calcYeast();
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5286 });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5287 $('#wy_use').jqxDropDownList({
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5288 theme: theme,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5289 source: YeastUseAdapter,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5290 valueMember: 'id',
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5291 displayMember: 'nl',
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5292 width: 180,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5293 height: 23,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5294 autoDropDownHeight: true,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5295 dropDownVerticalAlignment: 'top'
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5296 });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5297 $('#wy_use').on('select', function(event) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5298 if (event.args) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5299 var index = event.args.index;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5300 yeastData.y_use = index;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5301 calcFermentables();
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5302 calcYeast();
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5303 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5304 });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5305 for (i = 1; i < 5; i++) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5306 $('#prop' + i + '_type').jqxDropDownList({
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5307 theme: theme,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5308 source: StarterTypeAdapter,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5309 valueMember: 'id',
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5310 displayMember: 'nl',
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5311 width: 120,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5312 height: 23,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5313 autoDropDownHeight: true
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5314 });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5315 $('#prop' + i + '_type').hide();
518
00e110567fee The default starter SG changed to 1.037. Added several tooltips on the yeast tab.
Michiel Broek <mbroek@mbse.eu>
parents: 515
diff changeset
5316 $('#prop' + i + '_volume').jqxTooltip({ content: 'Het volume van deze starter stap.' });
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5317 $('#prop' + i + '_volume').jqxNumberInput(Spin3dec);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5318 $('#prop' + i + '_volume').hide();
518
00e110567fee The default starter SG changed to 1.037. Added several tooltips on the yeast tab.
Michiel Broek <mbroek@mbse.eu>
parents: 515
diff changeset
5319 $('#prop' + i + '_irate').jqxTooltip({ content: 'Voor de beste gistgroei, houd de injectie factor tussen de 25 en 100 miljoen cellen per ml.' });
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5320 $('#prop' + i + '_irate').jqxNumberInput(Show1dec);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5321 $('#prop' + i + '_irate').hide();
518
00e110567fee The default starter SG changed to 1.037. Added several tooltips on the yeast tab.
Michiel Broek <mbroek@mbse.eu>
parents: 515
diff changeset
5322 $('#prop' + i + '_ncells').jqxTooltip({ content: 'Het aantal miljard nieuwe gistcellen in deze stap.' });
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5323 $('#prop' + i + '_ncells').jqxNumberInput(Show1dec);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5324 $('#prop' + i + '_ncells').hide();
518
00e110567fee The default starter SG changed to 1.037. Added several tooltips on the yeast tab.
Michiel Broek <mbroek@mbse.eu>
parents: 515
diff changeset
5325 $('#prop' + i + '_tcells').jqxTooltip({ content: 'Het totaal aantal miljard gistcellen na deze stap.' });
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5326 $('#prop' + i + '_tcells').jqxNumberInput(Show1dec);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5327 $('#prop' + i + '_tcells').hide();
518
00e110567fee The default starter SG changed to 1.037. Added several tooltips on the yeast tab.
Michiel Broek <mbroek@mbse.eu>
parents: 515
diff changeset
5328 $('#prop' + i + '_growf').jqxTooltip({ content: 'De groeifactor, minstens 1. Ongeroerde starters komen meestal niet boven de 3.' });
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5329 $('#prop' + i + '_growf').jqxNumberInput(Show2dec);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5330 $('#prop' + i + '_growf').hide();
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5331 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5332 $('#starter_enable').jqxCheckBox({ theme: theme, height: 23 });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5333 $('#starter_type').jqxDropDownList({
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5334 theme: theme,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5335 source: StarterTypeAdapter,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5336 valueMember: 'id',
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5337 displayMember: 'nl',
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5338 width: 120,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5339 height: 23,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5340 autoDropDownHeight: true
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5341 });
518
00e110567fee The default starter SG changed to 1.037. Added several tooltips on the yeast tab.
Michiel Broek <mbroek@mbse.eu>
parents: 515
diff changeset
5342 $('#starter_sg').jqxTooltip({ content: 'Het ideale starter SG moet tussen de 1.030 en 1.040 zijn. Optimaal is 1.037.' });
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5343 $('#starter_sg').jqxNumberInput(SGopts);
525
8bbc5730aaa8 Code cleanup and manual compress
Michiel Broek <mbroek@mbse.eu>
parents: 518
diff changeset
5344 $('#starter_viability').jqxTooltip({
8bbc5730aaa8 Code cleanup and manual compress
Michiel Broek <mbroek@mbse.eu>
parents: 518
diff changeset
5345 content: 'De gist conditie te berekenen vanaf de productie datum. Vloeibare gist verlist iedere maand ongeveer 20% active cellen.'
8bbc5730aaa8 Code cleanup and manual compress
Michiel Broek <mbroek@mbse.eu>
parents: 518
diff changeset
5346 });
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5347 $('#starter_viability').jqxNumberInput(Perc0);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5348 $('#starter_try').jqxButton({ template: 'primary', width: '100px', height: 23, theme: theme });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5349
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5350 // Tab 7, Mashing
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5351 $('#mash_name').jqxTooltip({ content: 'De omschrijving van dit maisch profiel.' });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5352 $('#mash_name').jqxInput({ theme: theme, width: 320, height: 23 });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5353 $('#mash_select').jqxDropDownList({
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5354 placeHolder: 'Kies schema:',
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5355 theme: theme,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5356 source: mashlist,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5357 displayMember: 'name',
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5358 width: 250,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5359 height: 23,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5360 dropDownWidth: 500,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5361 dropDownHeight: 500,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5362 dropDownHorizontalAlignment: 'right'
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5363 });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5364 $('#mash_select').on('select', function(event) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5365 if (event.args) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5366 var data, datarecord, rowIDs, rows, i, row, index = event.args.index;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5367 // First delete all current steps
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5368 rowIDs = new Array();
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5369 rows = $('#mashGrid').jqxGrid('getdisplayrows');
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5370 for (i = 0; i < rows.length; i++) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5371 row = rows[i];
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5372 rowIDs.push(row.uid);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5373 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5374 $('#mashGrid').jqxGrid('deleterow', rowIDs);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5375 // Then add the new steps
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5376 datarecord = mashlist.records[index];
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5377 $('#mash_name').val(datarecord.name);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5378 for (i = 0; i < datarecord.steps.length; i++) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5379 data = datarecord.steps[i];
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5380 row = {};
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5381 row['step_name'] = data.step_name;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5382 row['step_type'] = data.step_type;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5383 // For now, but this must be smarter.
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5384 if (mash_infuse == 0 && dataRecord.w1_amount > 0)
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5385 mash_infuse = dataRecord.w1_amount;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5386 if (i == 0)
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5387 row['step_infuse_amount'] = mash_infuse;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5388 else
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5389 row['step_infuse_amount'] = 0;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5390 if (mashkg > 0)
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5391 row['step_thickness'] = parseFloat(mash_infuse / mashkg);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5392 else
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5393 row['step_thickness'] = 0;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5394 row['step_temp'] = data.step_temp;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5395 row['end_temp'] = data.end_temp;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5396 row['step_time'] = data.step_time;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5397 row['ramp_time'] = data.ramp_time;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5398 $('#mashGrid').jqxGrid('addrow', null, row);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5399 }
490
6c9ad1317f0a Recalculate mash after changing mash parameters.
Michiel Broek <mbroek@mbse.eu>
parents: 489
diff changeset
5400 calcMash();
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5401 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5402 });
484
2083c274b283 In the product editor mash tab, display the total mash volume and the total mash time.
Michiel Broek <mbroek@mbse.eu>
parents: 479
diff changeset
5403 $('#est_mashvol').jqxTooltip({ content: 'Het totale volume van het maishwater en de mout in de maish pan.' });
2083c274b283 In the product editor mash tab, display the total mash volume and the total mash time.
Michiel Broek <mbroek@mbse.eu>
parents: 479
diff changeset
5404 $('#est_mashvol').jqxNumberInput(Show1dec);
2083c274b283 In the product editor mash tab, display the total mash volume and the total mash time.
Michiel Broek <mbroek@mbse.eu>
parents: 479
diff changeset
5405 $('#est_mashtime').jqxTooltip({ content: 'De totale tijdsduur van het maischen.' });
2083c274b283 In the product editor mash tab, display the total mash volume and the total mash time.
Michiel Broek <mbroek@mbse.eu>
parents: 479
diff changeset
5406 $('#est_mashtime').jqxInput({ theme: theme, width: 70, height: 23 });
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5407 $('#popupMash').jqxWindow({
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5408 width: 800,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5409 height: 350,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5410 position: { x: 230, y: 100 },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5411 resizable: false,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5412 theme: theme,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5413 isModal: true,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5414 autoOpen: false,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5415 cancelButton: $('#MashReady'),
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5416 modalOpacity: 0.40
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5417 });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5418 $('#MashReady').jqxButton({ template: 'success', width: '90px', theme: theme });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5419 $('#MashReady').click(function() {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5420 calcMash();
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5421 });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5422 $('#wstep_name').jqxInput({ theme: theme, width: 320, height: 23 });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5423 $('#wstep_name').on('change', function(event) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5424 var rowdata = $('#mashGrid').jqxGrid('getrowdata', mashRow);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5425 rowdata.step_name = event.args.value;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5426 });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5427 $('#wstep_type').jqxDropDownList({
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5428 theme: theme,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5429 source: MashStepTypeAdapter,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5430 valueMember: 'id',
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5431 displayMember: 'nl',
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5432 width: 180,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5433 height: 23,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5434 autoDropDownHeight: true
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5435 });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5436 $('#wstep_type').on('select', function(event) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5437 if (event.args) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5438 var rowdata, i, rows, row, index = event.args.index;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5439 rowdata = $('#mashGrid').jqxGrid('getrowdata', mashRow);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5440 rowdata.step_type = index;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5441 if (index == 0) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5442 $('#wstep_infuse_amount').show();
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5443 $('#wstep_pmpt').show();
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5444 } else {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5445 rowdata.step_infuse_amount = 0;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5446 $('#wstep_infuse_amount').hide();
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5447 $('#wstep_pmpt').hide();
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5448 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5449 mash_infuse = 0;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5450 rows = $('#mashGrid').jqxGrid('getrows');
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5451 for (i = 0; i < rows.length; i++) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5452 row = rows[i];
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5453 if (row.step_type == 0) // Infusion
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5454 mash_infuse += parseFloat(row.step_infuse_amount);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5455 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5456 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5457 });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5458 $('#wstep_temp').jqxNumberInput(Spin1dec);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5459 $('#wstep_temp').on('change', function(event) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5460 var rowdata = $('#mashGrid').jqxGrid('getrowdata', mashRow);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5461 rowdata.step_temp = parseFloat(event.args.value);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5462 });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5463 $('#wend_temp').jqxNumberInput(Spin1dec);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5464 $('#wend_temp').on('change', function(event) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5465 var rowdata = $('#mashGrid').jqxGrid('getrowdata', mashRow);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5466 rowdata.end_temp = parseFloat(event.args.value);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5467 });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5468 $('#wstep_time').jqxNumberInput(PosInt);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5469 $('#wstep_time').on('change', function(event) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5470 var rowdata = $('#mashGrid').jqxGrid('getrowdata', mashRow);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5471 rowdata.step_time = parseFloat(event.args.value);
490
6c9ad1317f0a Recalculate mash after changing mash parameters.
Michiel Broek <mbroek@mbse.eu>
parents: 489
diff changeset
5472 calcMash();
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5473 });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5474 $('#wramp_time').jqxNumberInput(PosInt);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5475 $('#wramp_time').on('change', function(event) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5476 var rowdata = $('#mashGrid').jqxGrid('getrowdata', mashRow);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5477 rowdata.ramp_time = parseFloat(event.args.value);
490
6c9ad1317f0a Recalculate mash after changing mash parameters.
Michiel Broek <mbroek@mbse.eu>
parents: 489
diff changeset
5478 calcMash();
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5479 });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5480 $('#wstep_infuse_amount').jqxNumberInput(Spin1dec);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5481 $('#wstep_infuse_amount').on('change', function(event) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5482 var row, i, rows, rowdata = $('#mashGrid').jqxGrid('getrowdata', mashRow);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5483 rowdata.step_infuse_amount = parseFloat(event.args.value);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5484 mash_infuse = 0;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5485 rows = $('#mashGrid').jqxGrid('getrows');
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5486 for (i = 0; i < rows.length; i++) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5487 row = rows[i];
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5488 if (row.step_type == 0) // Infusion
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5489 mash_infuse += parseFloat(row.step_infuse_amount);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5490 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5491 if (dataRecord.w2_amount == 0) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5492 dataRecord.w1_amount = mash_infuse;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5493 $('#w1_amount').val(mash_infuse);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5494 } else {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5495 dataRecord.w1_amount = (dataRecord.w1_amount / (dataRecord.w1_amount + dataRecord.w2_amount)) * mash_infuse;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5496 dataRecord.w2_amount = (dataRecord.w2_amount / (dataRecord.w1_amount + dataRecord.w2_amount)) * mash_infuse;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5497 $('#w1_amount').val(dataRecord.w1_amount);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5498 $('#w2_amount').val(dataRecord.w2_amount);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5499 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5500 $('#wg_amount').val(mash_infuse);
479
67dbbf301ae7 Recalculate water and sparge water after changing the mash infuse volume
Michiel Broek <mbroek@mbse.eu>
parents: 478
diff changeset
5501 calcFermentables();
67dbbf301ae7 Recalculate water and sparge water after changing the mash infuse volume
Michiel Broek <mbroek@mbse.eu>
parents: 478
diff changeset
5502 calcWater();
67dbbf301ae7 Recalculate water and sparge water after changing the mash infuse volume
Michiel Broek <mbroek@mbse.eu>
parents: 478
diff changeset
5503 calcSparge();
490
6c9ad1317f0a Recalculate mash after changing mash parameters.
Michiel Broek <mbroek@mbse.eu>
parents: 489
diff changeset
5504 calcMash();
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5505 });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5506
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5507 // Tab 8, Water
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5508 $('#tgt_bu').jqxNumberInput(Show2wat);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5509 $('#tgt_cl_so4').jqxNumberInput(Show1wat);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5510 $('#got_cl_so4').jqxNumberInput(Show1wat);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5511
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5512 // Water source 1
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5513 $('#w1_name').jqxDropDownList({
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5514 placeHolder: 'Kies hoofd water:',
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5515 theme: theme,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5516 source: waterlist,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5517 displayMember: 'name',
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5518 width: 250,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5519 height: 27,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5520 dropDownWidth: 400,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5521 dropDownHeight: 400
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5522 });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5523 $('#w1_name').on('select', function(event) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5524 if (event.args) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5525 var datarecord, index = event.args.index;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5526 datarecord = waterlist.records[index];
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5527 dataRecord.w1_name = datarecord.name;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5528 $('#w1_calcium').val(datarecord.calcium);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5529 dataRecord.w1_calcium = datarecord.calcium;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5530 $('#w1_sulfate').val(datarecord.sulfate);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5531 dataRecord.w1_sulfate = datarecord.sulfate;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5532 $('#w1_chloride').val(datarecord.chloride);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5533 dataRecord.w1_chloride = datarecord.chloride;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5534 $('#w1_sodium').val(datarecord.sodium);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5535 dataRecord.w1_sodium = datarecord.sodium;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5536 $('#w1_magnesium').val(datarecord.magnesium);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5537 dataRecord.w1_magnesium = datarecord.magnesium;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5538 $('#w1_total_alkalinity').val(datarecord.total_alkalinity);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5539 dataRecord.w1_total_alkalinity = datarecord.total_alkalinity;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5540 $('#w1_ph').val(datarecord.ph);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5541 dataRecord.w1_ph = datarecord.ph;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5542 $('#w1_cost').val(datarecord.cost);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5543 dataRecord.w1_cost = datarecord.cost;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5544 calcWater();
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5545 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5546 });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5547 $('#w1_amount').jqxNumberInput(Show1wat);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5548 $('#w1_calcium').jqxNumberInput(Show1wat);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5549 $('#w1_magnesium').jqxNumberInput(Show1wat);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5550 $('#w1_sodium').jqxNumberInput(Show1wat);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5551 $('#w1_total_alkalinity').jqxNumberInput(Show1wat);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5552 $('#w1_chloride').jqxNumberInput(Show1wat);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5553 $('#w1_sulfate').jqxNumberInput(Show1wat);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5554 $('#w1_ph').jqxNumberInput(Show1wat);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5555 // Water source 2
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5556 $('#w2_name').jqxDropDownList({
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5557 placeHolder: 'Kies meng water:',
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5558 theme: theme,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5559 source: waterlist,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5560 displayMember: 'name',
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5561 width: 250,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5562 height: 27,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5563 dropDownWidth: 400,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5564 dropDownHeight: 400
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5565 });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5566 $('#w2_name').on('select', function(event) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5567 if (event.args) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5568 var datarecord, index = event.args.index;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5569 datarecord = waterlist.records[index];
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5570 dataRecord.w2_name = datarecord.name;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5571 $('#w2_calcium').val(datarecord.calcium);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5572 dataRecord.w2_calcium = datarecord.calcium;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5573 $('#w2_sulfate').val(datarecord.sulfate);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5574 dataRecord.w2_sulfate = datarecord.sulfate;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5575 $('#w2_chloride').val(datarecord.chloride);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5576 dataRecord.w2_chloride = datarecord.chloride;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5577 $('#w2_sodium').val(datarecord.sodium);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5578 dataRecord.w2_sodium = datarecord.sodium;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5579 $('#w2_magnesium').val(datarecord.magnesium);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5580 dataRecord.w2_magnesium = datarecord.magnesium;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5581 $('#w2_total_alkalinity').val(datarecord.total_alkalinity);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5582 dataRecord.w2_total_alkalinity = datarecord.total_alkalinity;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5583 $('#w2_ph').val(datarecord.ph);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5584 dataRecord.w2_ph = datarecord.ph;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5585 $('#w2_cost').val(datarecord.cost);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5586 dataRecord.w2_cost = datarecord.cost;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5587 $('#w2_amount').jqxNumberInput({ max: 100000, readOnly: false }); // Set high max to enable the spinbuttons.
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5588 calcWater();
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5589 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5590 });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5591 $('#w2_amount').jqxTooltip({ content: 'De verdeling van het hoofd en meng water. Het totale maisch water volume blijft gelijk.'});
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5592 $('#w2_amount').jqxNumberInput({
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5593 inputMode: 'simple', spinMode: 'simple', theme: theme, width: 94, height: 23, min: 0, max: 0, decimalDigits: 1,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5594 spinButtons: true, spinButtonsStep: 0.5, readOnly: true
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5595 });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5596 $('#w2_calcium').jqxNumberInput(Show1wat);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5597 $('#w2_magnesium').jqxNumberInput(Show1wat);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5598 $('#w2_sodium').jqxNumberInput(Show1wat);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5599 $('#w2_total_alkalinity').jqxNumberInput(Show1wat);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5600 $('#w2_chloride').jqxNumberInput(Show1wat);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5601 $('#w2_sulfate').jqxNumberInput(Show1wat);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5602 $('#w2_ph').jqxNumberInput(Show1wat);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5603 // Water mixed
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5604 $('#wg_amount').jqxNumberInput(Show1wat);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5605 $('#wg_calcium').jqxNumberInput(Show1wat);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5606 $('#wg_magnesium').jqxNumberInput(Show1wat);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5607 $('#wg_sodium').jqxNumberInput(Show1wat);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5608 $('#wg_total_alkalinity').jqxNumberInput(Show1wat);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5609 $('#wg_chloride').jqxNumberInput(Show1wat);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5610 $('#wg_sulfate').jqxNumberInput(Show1wat);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5611 $('#wg_ph').jqxNumberInput(Show1wat);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5612 // Water treated
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5613 $('#wb_calcium').jqxTooltip({ content: 'De ideale hoeveelheid Calcium is tussen 40 en 150.'});
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5614 $('#wb_calcium').jqxNumberInput(Show1wat);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5615 $('#wb_magnesium').jqxTooltip({ content: 'De ideale hoeveelheid Magnesium is lager dan 30.'});
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5616 $('#wb_magnesium').jqxNumberInput(Show1wat);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5617 $('#wb_sodium').jqxTooltip({ content: 'De ideale hoeveelheid Natrium is lager dan 150.'});
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5618 $('#wb_sodium').jqxNumberInput(Show1wat);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5619 $('#wb_total_alkalinity').jqxNumberInput(Show1wat);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5620 $('#wb_chloride').jqxTooltip({ content: 'De ideale hoeveelheid Chloride is tussen 50 en 100.'});
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5621 $('#wb_chloride').jqxNumberInput(Show1wat);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5622 $('#wb_sulfate').jqxTooltip({ content: 'De ideale hoeveelheid Sulfaat is tussen 50 en 350.'});
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5623 $('#wb_sulfate').jqxNumberInput(Show1wat);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5624 $('#wb_ph').jqxNumberInput(Show1wat);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5625 // Water target profile
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5626 $('#pr_name').jqxDropDownList({
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5627 placeHolder: 'Kies doel profiel:',
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5628 theme: theme,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5629 source: waterprofiles,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5630 displayMember: 'name',
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5631 width: 250,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5632 height: 27,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5633 dropDownWidth: 400,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5634 dropDownHeight: 300
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5635 });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5636 $('#pr_name').on('select', function(event) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5637 if (event.args) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5638 var datarecord, index = event.args.index;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5639 datarecord = waterprofiles.records[index];
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5640 $('#pr_calcium').val(datarecord.calcium);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5641 $('#pr_sulfate').val(datarecord.sulfate);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5642 $('#pr_chloride').val(datarecord.chloride);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5643 $('#pr_sodium').val(datarecord.sodium);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5644 $('#pr_magnesium').val(datarecord.magnesium);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5645 $('#pr_total_alkalinity').val(datarecord.total_alkalinity);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5646 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5647 });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5648 $('#pr_calcium').jqxNumberInput(Show1wat);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5649 $('#pr_magnesium').jqxNumberInput(Show1wat);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5650 $('#pr_sodium').jqxNumberInput(Show1wat);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5651 $('#pr_total_alkalinity').jqxNumberInput(Show1wat);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5652 $('#pr_chloride').jqxNumberInput(Show1wat);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5653 $('#pr_sulfate').jqxNumberInput(Show1wat);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5654
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5655 // Water agents
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5656 $('#wa_cacl2').jqxTooltip({ content: 'Voor het maken van een ander waterprofiel. Voegt calcium en chloride toe. Voor het verbeteren van zoetere bieren.' });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5657 $('#wa_cacl2').jqxNumberInput(Spin1dec);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5658 $('#wa_caso4').jqxTooltip({
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5659 content: 'Gips. Voor het maken van een ander waterprofiel. Voegt calcium en sulfaat toe. Voor het verbeteren van bittere bieren.'
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5660 });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5661 $('#wa_caso4').jqxNumberInput(Spin1dec);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5662 $('#wa_mgso4').jqxTooltip({ content: 'Epsom zout. Voor het maken van een ander waterprofiel. Voegt magnesium en sulfaat toe. Gebruik spaarzaam!' });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5663 $('#wa_mgso4').jqxNumberInput(Spin1dec);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5664 $('#wa_nacl').jqxTooltip({
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5665 content: 'Keukenzout. Voor het maken van een ander waterprofiel. Voegt natrium en chloride toe. ' +
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5666 'Voor het accentueren van zoetheid. Bij hoge dosering wordt het bier ziltig.'
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5667 });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5668 $('#wa_nacl').jqxNumberInput(Spin1dec);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5669 $('#mash_ph').jqxTooltip({ content: 'Maisch pH tussen 5.2 en 5.6. Gebruik 5.2 voor lichte en 5.5 voor donkere bieren.'});
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5670 $('#mash_ph').jqxNumberInput(SpinpH);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5671 $('#calc_acid').jqxCheckBox({ theme: theme, width: 120, height: 23 });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5672 $('#wa_base_name').jqxDropDownList({
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5673 theme: theme,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5674 source: BaseTypeAdapter,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5675 valueMember: 'id',
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5676 displayMember: 'nl',
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5677 width: 170,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5678 height: 23,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5679 autoDropDownHeight: true
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5680 });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5681 $('#wa_base').jqxNumberInput(Spin2dec);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5682 $('#wa_base').jqxNumberInput({ symbol: ' gr', symbolPosition: 'right' });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5683 $('#wa_acid_name').jqxDropDownList({
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5684 theme: theme,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5685 source: AcidTypeAdapter,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5686 valueMember: 'id',
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5687 displayMember: 'nl',
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5688 width: 170,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5689 height: 23,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5690 autoDropDownHeight: true
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5691 });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5692 $('#wa_acid').jqxNumberInput(Spin2dec);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5693 $('#wa_acid').jqxNumberInput({ symbol: ' ml', symbolPosition: 'right' });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5694 $('#wa_acid_perc').jqxNumberInput(Perc0);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5695 $('#wa_acid_perc').jqxNumberInput({ width: 70, symbol: '%', symbolPosition: 'right' });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5696 // Sparge water
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5697 $('#sparge_temp').jqxNumberInput(Spin1dec);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5698 $('#sparge_volume').jqxNumberInput(Spin1dec);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5699 $('#sparge_ph').jqxNumberInput(SpinpH);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5700 $('#sparge_source').jqxDropDownList({
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5701 theme: theme,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5702 source: SpargeSourceAdapter,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5703 valueMember: 'id',
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5704 displayMember: 'nl',
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5705 width: 110,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5706 height: 23,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5707 autoDropDownHeight: true
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5708 });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5709 $('#sparge_acid_amount').jqxNumberInput(Spin2dec);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5710 $('#sparge_acid_amount').jqxNumberInput({ spinButtons: false, readOnly: true, symbol: ' ml', symbolPosition: 'right' });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5711 $('#sparge_acid_type').jqxDropDownList({
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5712 theme: theme,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5713 source: AcidTypeAdapter,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5714 valueMember: 'id',
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5715 displayMember: 'nl',
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5716 width: 110,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5717 height: 23,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5718 autoDropDownHeight: true
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5719 });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5720 $('#sparge_acid_perc').jqxNumberInput(Perc0);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5721 $('#sparge_acid_perc').jqxNumberInput({ symbol: '%', symbolPosition: 'right' });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5722
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5723 // Tab 9, Brewday
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5724 $('#brew_date_start').jqxTooltip({ content: 'Brouw datum en tijd. Voor planning laat de tijd op 00:00:00 staan.' });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5725 $('#brew_date_start').jqxDateTimeInput(DateTimeopts);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5726 $('#brew_date_start').on('close', function(event) { calcStage(); });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5727 $('#brew_date_end').jqxTooltip({ content: 'End datum en tijd van de brouw. Leeg laten als er nog niet gebrouwen is.' });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5728 $('#brew_date_end').jqxDateTimeInput(DateTimeopts);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5729 $('#brew_date_end').on('close', function(event) { calcStage(); });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5730 $('#brew_mash_ph').jqxTooltip({ content: 'De gemeten pH tijdens het maischen eventueel na correctie.' });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5731 $('#brew_mash_ph').jqxNumberInput(SpinpH);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5732 $('#est_mash_ph').jqxTooltip({ content: 'De gewenste pH tijdens het maischen.' });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5733 $('#est_mash_ph').jqxNumberInput(Show1wat);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5734 $('#brew_preboil_ph').jqxTooltip({ content: 'De gemeten pH in de kookketel na het spoelen en voor de kook.' });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5735 $('#brew_preboil_ph').jqxNumberInput(SpinpH);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5736 // est_preboil_ph
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5737 $('#brew_aboil_ph').jqxTooltip({ content: 'De gemeten pH na het koken.' });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5738 $('#brew_aboil_ph').jqxNumberInput(SpinpH);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5739 // est_aboil_ph
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5740 $('#brew_mash_sg').jqxTooltip({ content: 'Het bereikte SG na het maischen.' });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5741 $('#brew_mash_sg').jqxNumberInput(SGopts);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5742 $('#brew_mash_sg').on('valueChanged', function() { calcMashEfficiency(); });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5743 $('#est_mash_sg').jqxTooltip({ content: 'Het berekende verwachte SG na het maischen.' });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5744 $('#est_mash_sg').jqxNumberInput(Show3wat);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5745 $('#brew_preboil_sg').jqxTooltip({ content: 'Het gemeten SG in de kookketel na het spoelen en voor het koken.' });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5746 $('#brew_preboil_sg').jqxNumberInput(SGopts);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5747 $('#brew_preboil_sg').on('valueChanged', function(event) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5748 dataRecord.brew_preboil_sg = event.args.value;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5749 calcEfficiencyBeforeBoil();
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5750 });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5751 $('#est_pre_sg').jqxTooltip({ content: 'Het berekende SG in de kookketel na het spoelen en voor het koken.' });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5752 $('#est_pre_sg').jqxNumberInput(Show3wat);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5753 $('#brew_aboil_sg').jqxTooltip({ content: 'Het gemeten SG in de kookketel na het koken.' });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5754 $('#brew_aboil_sg').jqxNumberInput(SGopts);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5755 $('#brew_aboil_sg').on('valueChanged', function(event) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5756 dataRecord.brew_aboil_sg = event.args.value;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5757 calcEfficiencyAfterBoil();
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5758 calcFermentables();
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5759 calcIBUs();
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5760 });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5761 $('#est_og3').jqxTooltip({ content: 'Het gewenste SG in de kookketel na het koken.' });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5762 $('#est_og3').jqxNumberInput(Show3wat);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5763 $('#brew_mash_efficiency').jqxTooltip({ content: 'Het behaalde maisch rendement.' });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5764 $('#brew_mash_efficiency').jqxNumberInput(Show1dec);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5765 $('#brew_preboil_volume').jqxTooltip({ content: 'Het gemeten volume van het wort voor het koken.' });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5766 $('#brew_preboil_volume').jqxNumberInput(Spin1dec);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5767 $('#brew_preboil_volume').on('valueChanged', function(event) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5768 dataRecord.brew_preboil_volume = event.args.value;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5769 calcEfficiencyBeforeBoil();
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5770 });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5771 $('#est_pre_vol').jqxTooltip({ content: 'Het berekende volume van het wort voor het koken.' });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5772 $('#est_pre_vol').jqxNumberInput(Show1wat);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5773 $('#brew_aboil_volume').jqxTooltip({ content: 'Het gemeten volume van het wort na het koken.' });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5774 $('#brew_aboil_volume').jqxNumberInput(Spin1dec);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5775 $('#brew_aboil_volume').on('valueChanged', function(event) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5776 dataRecord.brew_aboil_volume = event.args.value;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5777 calcEfficiencyAfterBoil();
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5778 calcFermentables();
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5779 calcIBUs();
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5780 });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5781 $('#est_a_vol').jqxTooltip({ content: 'Het gewenste volume na het koken.' });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5782 $('#est_a_vol').jqxNumberInput(Show1wat);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5783 $('#brew_preboil_efficiency').jqxTooltip({ content: 'Het berekende rendement voor het koken.' });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5784 $('#brew_preboil_efficiency').jqxNumberInput(Show1dec);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5785 $('#brew_aboil_efficiency').jqxTooltip({ content: 'Het bereikte rendement na het koken.' });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5786 $('#brew_aboil_efficiency').jqxNumberInput(Show1dec);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5787 $('#brew_sparge_temperature').jqxTooltip({ content: 'De spoelwater temperatuur, in te stellen in de Water tab.' });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5788 $('#brew_sparge_temperature').jqxNumberInput(Show1dec);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5789 $('#brew_sparge_volume').jqxTooltip({ content: 'Het spoelwater voorraad volume, in te stellen in de Water tab.' });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5790 $('#brew_sparge_volume').jqxNumberInput(Show1dec);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5791 $('#brew_sparge_est').jqxNumberInput(Show1dec);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5792 $('#brew_whirlpool9').jqxNumberInput(PosInt);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5793 $('#brew_whirlpool9').jqxNumberInput({ max: 120 });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5794 $('#brew_cooling_to').jqxNumberInput(Spin1dec);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5795 $('#brew_sparge_ph').jqxNumberInput(SpinpH);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5796 $('#brew_whirlpool7').jqxNumberInput(PosInt);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5797 $('#brew_whirlpool7').jqxNumberInput({ max: 120 });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5798 $('#brew_cooling_method').jqxDropDownList({
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5799 theme: theme,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5800 source: CoolingTypeAdapter,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5801 valueMember: 'id',
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5802 displayMember: 'nl',
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5803 width: 180,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5804 height: 23,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5805 autoDropDownHeight: true
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5806 });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5807 $('#brew_whirlpool6').jqxNumberInput(PosInt);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5808 $('#brew_whirlpool6').jqxNumberInput({ max: 120 });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5809 $('#brew_cooling_time').jqxNumberInput(PosInt);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5810 $('#brew_cooling_time').jqxNumberInput({ max: 1440 });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5811 $('#brew_whirlpool2').jqxNumberInput(PosInt);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5812 $('#brew_whirlpool2').jqxNumberInput({ max: 120 });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5813 $('#brew_aeration_type').jqxDropDownList({
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5814 theme: theme,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5815 source: AerationTypeAdapter,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5816 valueMember: 'id',
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5817 displayMember: 'nl',
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5818 width: 180,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5819 height: 23,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5820 autoDropDownHeight: true
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5821 });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5822 $('#brew_aeration_time').jqxNumberInput(PosInt);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5823 $('#brew_aeration_time').jqxNumberInput({ max: 1440 });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5824 $('#brew_aeration_speed').jqxNumberInput(PosInt);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5825 $('#brew_aeration_speed').jqxNumberInput({ max: 1440 });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5826 $('#brew_fermenter_volume').jqxNumberInput(Show1dec);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5827 $('#brew_fermenter_extrawater').jqxNumberInput(Spin1dec);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5828 $('#brew_fermenter_sg').jqxNumberInput(Show3dec);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5829 $('#brew_fermenter_tcloss').jqxNumberInput(Spin1dec);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5830 $('#brew_fermenter_ibu').jqxNumberInput(Show0dec);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5831 $('#brew_fermenter_color').jqxNumberInput(Show0dec);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5832 $('#BLog').jqxButton({ template: 'info', width: '150px', theme: theme });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5833 $('#BLog').click(function() {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5834 // Open log in a new tab.
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5835 window.open('log_brew.php?code=' + dataRecord.code + '&name=' + dataRecord.name);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5836 });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5837
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5838 // Tab 10, Fermentation
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5839 // Note, fermentation temps changes must do calcCarbonation()
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5840 $('#brew_fermenter_sg2').jqxTooltip({ content: 'Het behaalde SG in het gistvat, overgenomen van de brouwdag.' });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5841 $('#brew_fermenter_sg2').jqxNumberInput(Show3dec);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5842 $('#primary_start_temp').jqxTooltip({ content: 'De begintemperatuur van de hoofdvergisting.' });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5843 $('#primary_start_temp').jqxNumberInput(YeastT);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5844 $('#primary_max_temp').jqxTooltip({ content: 'De hoogst bereikte piek temperatuur tijdens de hoofgvergisting.' });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5845 $('#primary_max_temp').jqxNumberInput(YeastT);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5846 $('#primary_end_temp').jqxTooltip({ content: 'De eind temperatuur van de hoofdvergisting.' });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5847 $('#primary_end_temp').jqxNumberInput(YeastT);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5848 $('#primary_end_sg').jqxTooltip({ content: 'Het gemeten SG aan het eind van de hoofdvergisting.' });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5849 $('#primary_end_sg').jqxNumberInput(SGopts);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5850 $('#primary_end_brix').jqxTooltip({ content: 'Hulpfinctie: de afgelezen &deg;Brix RI waarde met een refractometer.' });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5851 $('#primary_end_brix').jqxNumberInput(Spin1dec);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5852 $('#primary_svg').jqxTooltip({ content: 'De schijnbare vergisting graad behaald na de hoofdgisting.' });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5853 $('#primary_svg').jqxNumberInput(Show1dec);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5854 $('#primary_end_date').jqxTooltip({ content: 'De eind datum van de hoofdvergisting en eventueel overhevelen.' });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5855 $('#primary_end_date').jqxDateTimeInput(Dateopts);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5856 $('#primary_end_date').on('close', function(event) { calcStage(); });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5857 $('#secondary_temp').jqxNumberInput(YeastT);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5858 $('#secondary_end_sg').jqxTooltip({ content: 'Het gemeten SG aan het eind van de navergisting.' });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5859 $('#secondary_end_sg').jqxNumberInput(SGopts);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5860 $('#secondary_end_brix').jqxTooltip({ content: 'Hulpfinctie: de afgelezen &deg;Brix RI waarde met een refractometer.' });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5861 $('#secondary_end_brix').jqxNumberInput(Spin1dec);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5862 $('#secondary_svg').jqxTooltip({ content: 'De schijnbare vergisting graad behaald na de nagisting.' });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5863 $('#secondary_svg').jqxNumberInput(Show1dec);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5864 $('#secondary_end_date').jqxTooltip({ content: 'De eind datum van de navergisting en het begin van het lageren.' });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5865 $('#secondary_end_date').jqxDateTimeInput(Dateopts);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5866 $('#secondary_end_date').on('close', function(event) { calcStage(); });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5867 $('#tertiary_temp').jqxNumberInput(YeastT);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5868 $('#fg').jqxNumberInput(Spin3dec);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5869 $('#est_fg3').jqxTooltip({ content: 'Het verwachte eind SG. Dit wordt automatisch berekend.' });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5870 $('#est_fg3').jqxNumberInput(Show3dec);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5871 $('#final_brix').jqxTooltip({ content: 'Hulpfinctie: de afgelezen &deg;Brix RI waarde met een refractometer.' });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5872 $('#final_brix').jqxNumberInput(Spin1dec);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5873 $('#final_abv').jqxNumberInput(Show2dec);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5874 $('#final_svg').jqxNumberInput(Show1dec);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5875 $('#FLog').jqxButton({ template: 'info', width: '150px', theme: theme });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5876 $('#FLog').click(function() {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5877 // Open log in a new tab.
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5878 window.open('log_fermentation.php?code=' + dataRecord.code + '&name=' + dataRecord.name);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5879 });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5880
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5881 // Tab 11, Packaging
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5882 // TODO: high gravity packaging, extra water and recalc abv, color and ibu.
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5883 $('#package_date').jqxTooltip({ content: 'De verpakkings datum van dit bier.' });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5884 $('#package_date').jqxDateTimeInput(Dateopts);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5885 $('#package_date').on('close', function(event) { calcStage(); });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5886 $('#package_volume').jqxTooltip({ content: 'Het beschikbare volume om te bottelen of op fust te zetten.' });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5887 $('#package_volume').jqxNumberInput(Spin1dec);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5888 $('#package_infuse_amount').jqxTooltip({ content: 'De hoeveelheid water of drank extra toe te voegen.' });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5889 $('#package_infuse_amount').jqxNumberInput(Spin3dec);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5890 $('#package_infuse_abv').jqxTooltip({ content: 'De hoeveelheid alcohol in de drank, of 0.0 als het water is.' });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5891 $('#package_infuse_abv').jqxNumberInput(Spin1dec);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5892 $('#package_infuse_notes').jqxTooltip({ content: 'Omschrijving van de extra toevoeging.' });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5893 $('#package_infuse_notes').jqxInput({ theme: theme, width: 640, height: 23 });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5894 $('#package_abv').jqxTooltip({ content: 'De uiteindelijke hoeveelheid alcohol volume %.' });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5895 $('#package_abv').jqxNumberInput(Show2dec);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5896 $('#package_ph').jqxTooltip({ content: 'De gemeten pH vlak voor het verpakken.' });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5897 $('#package_ph').jqxNumberInput(SpinpH);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5898 $('#st_carb_min2').jqxTooltip({ content: 'Het minimum aanbevolen koolzuur volume voor deze bierstijl.'});
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5899 $('#st_carb_min2').jqxNumberInput(Smal1dec);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5900 $('#st_carb_max2').jqxTooltip({ content: 'Het maximum aamnevolen koolzuur volume voor deze bierstijl.'});
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5901 $('#st_carb_max2').jqxNumberInput(Smal1dec);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5902 $('#bottle_amount').jqxTooltip({ content: 'De totale hoeveelheid te bottelen bier.' });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5903 $('#bottle_amount').jqxNumberInput(Spin1dec);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5904 $('#keg_amount').jqxTooltip({ content: 'De totale hoeveelheid op fust te zetten bier.' });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5905 $('#keg_amount').jqxNumberInput(Spin1dec);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5906 $('#bottle_carbonation').jqxTooltip({ content: 'Het gewenste CO2 volume in de flessen.' });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5907 $('#bottle_carbonation').jqxNumberInput(Spin2dec);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5908 $('#bottle_carbonation').jqxNumberInput({ max: 5 });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5909 $('#keg_carbonation').jqxTooltip({ content: 'Het gewenste CO2 volume door de suiker in de fusten.' });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5910 $('#keg_carbonation').jqxNumberInput(Spin2dec);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5911 $('#keg_carbonation').jqxNumberInput({ max: 5 });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5912 $('#bottle_priming_sugar').jqxDropDownList({
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5913 placeHolder: 'Kies suiker:',
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5914 theme: theme,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5915 source: fermentablesugars,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5916 displayMember: 'name',
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5917 width: 200,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5918 height: 23,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5919 dropDownWidth: 300,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5920 dropDownHeight: 400
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5921 });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5922 $('#bottle_priming_sugar').on('select', function(event) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5923 if (event.args) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5924 var rowID, index, editrow = -1, datarecord, rows, i, row = {};
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5925 index = event.args.index;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5926 datarecord = fermentablesugars.records[index];
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5927 rows = $('#fermentableGrid').jqxGrid('getrows');
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5928 for (i = 0; i < rows.length; i++) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5929 if (rows[i].f_added == 4) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5930 editrow = i;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5931 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5932 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5933 row['f_name'] = datarecord.name;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5934 row['f_origin'] = datarecord.origin;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5935 row['f_supplier'] = datarecord.supplier;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5936 row['f_amount'] = parseFloat($('#bottle_priming_total').jqxNumberInput('decimal')) / 1000;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5937 row['f_cost'] = datarecord.cost;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5938 row['f_type'] = datarecord.type;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5939 row['f_yield'] = datarecord.yield;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5940 row['f_color'] = datarecord.color;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5941 row['f_coarse_fine_diff'] = datarecord.coarse_fine_diff;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5942 row['f_moisture'] = datarecord.moisture;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5943 row['f_diastatic_power'] = datarecord.diastatic_power;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5944 row['f_protein'] = datarecord.protein;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5945 row['f_max_in_batch'] = datarecord.max_in_batch;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5946 row['f_graintype'] = datarecord.graintype;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5947 row['f_added'] = 4;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5948 row['f_dissolved_protein'] = datarecord.dissolved_protein;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5949 row['f_recommend_mash'] = datarecord.recommend_mash;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5950 row['f_add_after_boil'] = 1;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5951 row['f_adjust_to_total_100'] = 0;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5952 row['f_percentage'] = 0;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5953 row['f_di_ph'] = datarecord.di_ph;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5954 row['f_acid_to_ph_57'] = datarecord.acid_to_ph_57;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5955 row['f_inventory'] = datarecord.inventory;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5956 if (editrow >= 0) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5957 rowID = $('#fermentableGrid').jqxGrid('getrowid', editrow);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5958 $('#fermentableGrid').jqxGrid('updaterow', rowID, row);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5959 } else {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5960 $('#fermentableGrid').jqxGrid('addrow', null, row);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5961 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5962 calcCarbonation();
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5963 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5964 });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5965 $('#keg_priming_sugar').jqxDropDownList({
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5966 placeHolder: 'Kies suiker:',
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5967 theme: theme,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5968 source: fermentablesugars,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5969 displayMember: 'name',
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5970 width: 200,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5971 height: 23,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5972 dropDownWidth: 300,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5973 dropDownHeight: 400
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5974 });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5975 $('#keg_priming_sugar').on('select', function(event) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5976 if (event.args) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5977 var rowID, index, editrow = -1, datarecord, rows, i, row = {};
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5978 index = event.args.index;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5979 datarecord = fermentablesugars.records[index];
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5980 rows = $('#fermentableGrid').jqxGrid('getrows');
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5981 for (i = 0; i < rows.length; i++) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5982 if (rows[i].f_added == 5) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5983 editrow = i;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5984 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5985 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5986 row['f_name'] = datarecord.name;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5987 row['f_origin'] = datarecord.origin;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5988 row['f_supplier'] = datarecord.supplier;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5989 row['f_amount'] = parseFloat($('#keg_priming_total').jqxNumberInput('decimal')) / 1000;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5990 row['f_cost'] = datarecord.cost;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5991 row['f_type'] = datarecord.type;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5992 row['f_yield'] = datarecord.yield;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5993 row['f_color'] = datarecord.color;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5994 row['f_coarse_fine_diff'] = datarecord.coarse_fine_diff;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5995 row['f_moisture'] = datarecord.moisture;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5996 row['f_diastatic_power'] = datarecord.diastatic_power;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5997 row['f_protein'] = datarecord.protein;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5998 row['f_max_in_batch'] = datarecord.max_in_batch;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
5999 row['f_graintype'] = datarecord.graintype;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
6000 row['f_added'] = 5;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
6001 row['f_dissolved_protein'] = datarecord.dissolved_protein;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
6002 row['f_recommend_mash'] = datarecord.recommend_mash;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
6003 row['f_add_after_boil'] = 1;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
6004 row['f_adjust_to_total_100'] = 0;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
6005 row['f_percentage'] = 0;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
6006 row['f_di_ph'] = datarecord.di_ph;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
6007 row['f_acid_to_ph_57'] = datarecord.acid_to_ph_57;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
6008 row['f_inventory'] = datarecord.inventory;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
6009 if (editrow >= 0) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
6010 rowID = $('#fermentableGrid').jqxGrid('getrowid', editrow);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
6011 $('#fermentableGrid').jqxGrid('updaterow', rowID, row);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
6012 } else {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
6013 $('#fermentableGrid').jqxGrid('addrow', null, row);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
6014 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
6015 calcCarbonation();
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
6016 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
6017 });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
6018 $('#bottle_priming_amount').jqxNumberInput(Show1dec);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
6019 $('#bottle_priming_water').jqxTooltip({ content: 'De hoeveelheid water om de suiker op te lossen.' });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
6020 $('#bottle_priming_water').jqxNumberInput(Spin3dec);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
6021 $('#keg_priming_amount').jqxNumberInput(Show1dec);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
6022 $('#keg_priming_water').jqxTooltip({ content: 'De hoeveelheid water om de suiker op te lossen.' });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
6023 $('#keg_priming_water').jqxNumberInput(Spin3dec);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
6024 $('#bottle_priming_total').jqxNumberInput(Show1dec);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
6025 $('#bottle_pressure').jqxTooltip({ content: 'De maximaal te verwachten druk tijdens het hergisten.' });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
6026 $('#bottle_pressure').jqxNumberInput(Show1dec);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
6027 $('#keg_priming_total').jqxNumberInput(Show1dec);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
6028 $('#keg_forced_carb').jqxCheckBox({ theme: theme, width: 120, height: 23 });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
6029 $('#keg_pressure').jqxNumberInput(Show1dec);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
6030 $('#bottle_abv').jqxNumberInput(Show2dec);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
6031 $('#keg_abv').jqxNumberInput(Show2dec);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
6032 $('#bottle_carbonation_temp').jqxNumberInput(YeastT);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
6033 $('#keg_carbonation_temp').jqxNumberInput(YeastT);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
6034
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
6035 // Tab 12, Tasting
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
6036 $('#taste_date').jqxTooltip({ content: 'De proef datum van dit bier.' });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
6037 $('#taste_date').jqxDateTimeInput(Dateopts);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
6038 $('#taste_date').on('close', function(event) { calcStage(); });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
6039 $('#taste_rate').jqxTooltip({ content: 'Het cijfer voor dit bier van 1 tot 10.' });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
6040 $('#taste_rate').jqxNumberInput(Spin1dec);
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
6041 $('#taste_rate').jqxNumberInput({ max: 10 });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
6042 $('#taste_color').jqxTooltip({ content: 'De kleur van het bier.' });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
6043 $('#taste_color').jqxInput({ theme: theme, width: 320, height: 23 });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
6044 $('#taste_transparency').jqxTooltip({ content: 'De helderheid van het bier.' });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
6045 $('#taste_transparency').jqxInput({ theme: theme, width: 320, height: 23 });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
6046 $('#taste_head').jqxTooltip({ content: 'Het schuim op het bier.' });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
6047 $('#taste_head').jqxInput({ theme: theme, width: 320, height: 23 });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
6048 $('#taste_aroma').jqxTooltip({ content: 'Het aroma van het bier.' });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
6049 $('#taste_aroma').jqxInput({ theme: theme, width: 960, height: 23 });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
6050 $('#taste_taste').jqxTooltip({ content: 'De smaak van het bier.' });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
6051 $('#taste_taste').jqxInput({ theme: theme, width: 960, height: 23 });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
6052 $('#taste_aftertaste').jqxTooltip({ content: 'De nasmaak van het bier.' });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
6053 $('#taste_aftertaste').jqxInput({ theme: theme, width: 960, height: 23 });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
6054 $('#taste_mouthfeel').jqxTooltip({ content: 'Het mondgevoelvan het bier.' });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
6055 $('#taste_mouthfeel').jqxInput({ theme: theme, width: 960, height: 23 });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
6056 $('#taste_notes').jqxTooltip({ content: 'Het oordeel en opmerkingen over dit bier.' });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
6057 $('#taste_notes').jqxInput({ theme: theme, width: 960, height: 100 });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
6058
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
6059 $('#jqxTabs').jqxTabs({
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
6060 theme: theme,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
6061 width: 1280,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
6062 height: 660,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
6063 autoHeight: false,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
6064 position: 'top'
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
6065 });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
6066
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
6067 // Buttons below
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
6068 $('#Export').jqxButton({ template: 'info', width: '80px', theme: theme });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
6069 $('#Export').bind('click', function() {
489
18e5cfe5d126 Load new url in database write callback
Michiel Broek <mbroek@mbse.eu>
parents: 484
diff changeset
6070 saveRecord(0);
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
6071 });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
6072
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
6073 $('#Delete').jqxButton({ template: 'danger', width: '80px', theme: theme });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
6074 $('#Delete').bind('click', function() {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
6075 // Open a popup to confirm this action.
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
6076 $('#eventWindow').jqxWindow('open');
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
6077 $('#delOk').click(function() {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
6078 var data = 'delete=true&' + $.param({ uuid: dataRecord.uuid });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
6079 $.ajax({
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
6080 dataType: 'json',
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
6081 url: url,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
6082 cache: false,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
6083 data: data,
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
6084 type: 'POST',
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
6085 success: function(data, status, xhr) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
6086 // delete command is executed.
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
6087 window.location.href = my_return;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
6088 },
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
6089 error: function(jqXHR, textStatus, errorThrown) {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
6090 }
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
6091 });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
6092 });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
6093 });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
6094
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
6095 $('#Cancel').jqxButton({ template: 'primary', width: '80px', theme: theme });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
6096 $('#Cancel').bind('click', function() {
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
6097 window.location.href = my_return;
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
6098 });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
6099
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
6100 $('#Save').jqxButton({ template: 'success', width: '80px', theme: theme });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
6101 $('#Save').bind('click', function() {
489
18e5cfe5d126 Load new url in database write callback
Michiel Broek <mbroek@mbse.eu>
parents: 484
diff changeset
6102 saveRecord(1);
478
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
6103 });
0a270fee6aa0 Code cleanup using gjslint
Michiel Broek <mbroek@mbse.eu>
parents: 470
diff changeset
6104 createDelElements();
111
8c4ba91adf58 Basic screens for brew products.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
6105 });
8c4ba91adf58 Basic screens for brew products.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
6106

mercurial