www/js/prod_new.js

changeset 167
dabcd35f8f92
parent 166
635033a29c48
child 170
71850ebe5a1c
equal deleted inserted replaced
166:635033a29c48 167:dabcd35f8f92
22 22
23 23
24 $(document).ready(function () { 24 $(document).ready(function () {
25 25
26 // tooltips 26 // tooltips
27 $("#name").jqxTooltip({ content: 'De naam voor dit recept.' }); 27 $("#name").jqxTooltip({ content: 'De naam voor dit brouw project.' });
28 $("#notes").jqxTooltip({ content: 'De uitgebreide opmerkingen over dit recept.' }); 28 $("#code").jqxTooltip({ content: 'Het unieke code nummer van dit brouw project.' });
29 $("#notes").jqxTooltip({ content: 'De uitgebreide opmerkingen over dit project.' });
30 $("#type").jqxTooltip({ content: 'Het brouw type van bier in dit brouw project.' });
29 31
30 // editers 32 // editers
31 var srcType = [ "All Grain", "Partial Mash", "Extract" ]; 33 var srcType = [ "All Grain", "Partial Mash", "Extract" ];
32 $("#name").jqxInput({ theme: theme, width: 640, height: 23 }); 34 $("#name").jqxInput({ theme: theme, width: 640, height: 23 });
35 $("#code").jqxInput({ theme: theme, width: 100, height: 23 });
33 $("#notes").jqxInput({ theme: theme, width: 960, height: 200 }); 36 $("#notes").jqxInput({ theme: theme, width: 960, height: 200 });
37 $("#type").jqxDropDownList({ theme: theme, source: srcType, width: 125, height: 23, dropDownHeight: 95 });
38
39 $("#st_name").jqxInput({ theme: theme, width: 250, height: 23 });
40 $("#st_category").jqxInput({ theme: theme, width: 250, height: 23 });
41 $("#st_category_number").jqxInput({ theme: theme, width: 70, height: 23 });
42 $("#st_letter").jqxInput({ theme: theme, width: 250, height: 23 });
43 $("#st_guide").jqxInput({ theme: theme, width: 250, height: 23 });
44 $("#st_notes").jqxInput({ theme: theme, width: 800, height: 100 });
45 $("#st_type").jqxInput({ theme: theme, width: 90, height: 23 });
46 $("#st_og_min").jqxNumberInput({ inputMode: 'simple', theme: theme, width: 50, height: 23, decimalDigits: 3, readOnly: true });
47 $("#st_og_max").jqxNumberInput({ inputMode: 'simple', theme: theme, width: 50, height: 23, decimalDigits: 3, readOnly: true });
48 $("#st_fg_min").jqxNumberInput({ inputMode: 'simple', theme: theme, width: 50, height: 23, decimalDigits: 3, readOnly: true });
49 $("#st_fg_max").jqxNumberInput({ inputMode: 'simple', theme: theme, width: 50, height: 23, decimalDigits: 3, readOnly: true });
50 $("#st_ibu_min").jqxNumberInput({ inputMode: 'simple', theme: theme, width: 50, height: 23, decimalDigits: 0, readOnly: true });
51 $("#st_ibu_max").jqxNumberInput({ inputMode: 'simple', theme: theme, width: 50, height: 23, decimalDigits: 0, readOnly: true });
52 $("#st_color_min").jqxNumberInput({ inputMode: 'simple', theme: theme, width: 50, height: 23, decimalDigits: 0, readOnly: true });
53 $("#st_color_max").jqxNumberInput({ inputMode: 'simple', theme: theme, width: 50, height: 23, decimalDigits: 0, readOnly: true });
54 $("#st_carb_min").jqxNumberInput({ inputMode: 'simple', theme: theme, width: 50, height: 23, decimalDigits: 1, readOnly: true });
55 $("#st_carb_max").jqxNumberInput({ inputMode: 'simple', theme: theme, width: 50, height: 23, decimalDigits: 1, readOnly: true });
56 $("#st_abv_min").jqxNumberInput({ inputMode: 'simple', theme: theme, width: 50, height: 23, decimalDigits: 1, readOnly: true });
57 $("#st_abv_max").jqxNumberInput({ inputMode: 'simple', theme: theme, width: 50, height: 23, decimalDigits: 1, readOnly: true });
58 $("#st_profile").jqxInput({ theme: theme, width: 800, height: 48 });
59 $("#st_ingredients").jqxInput({ theme: theme, width: 800, height: 23 });
60 $("#st_examples").jqxInput({ theme: theme, width: 800, height: 48 });
61
62 $("#eq_name").jqxTooltip({ content: 'De naam van deze brouw apparatuur.' });
63 $("#eq_name").jqxInput({ theme: theme, width: 250, height: 23 });
64 $("#eq_calc_boil_volume").jqxCheckBox({ theme: theme, width: 120, height: 23, disabled: true });
65 $("#eq_boil_size").jqxTooltip({ content: 'Normaal kook volume in liters' });
66 $("#eq_boil_size").jqxNumberInput({ inputMode: 'simple', readOnly: true, theme: theme, width: 70, height: 23, decimalDigits: 1 });
67 $("#eq_batch_size").jqxTooltip({ content: 'Berekende batch grootte in liters aan het eind van de kook.' });
68 $("#eq_batch_size").jqxNumberInput({ inputMode: 'simple', readOnly: true, theme: theme, width: 70, height: 23, decimalDigits: 1 });
69 $("#eq_tun_volume").jqxTooltip({ content: 'Maisch ketel volume.' });
70 $("#eq_tun_volume").jqxNumberInput({ inputMode: 'simple', readOnly: true, theme: theme, width: 70, height: 23, decimalDigits: 1 });
71 $("#eq_tun_weight").jqxTooltip({ content: 'Maisch ketel gewicht.' });
72 $("#eq_tun_weight").jqxNumberInput({ inputMode: 'simple', readOnly: true, theme: theme, width: 70, height: 23, decimalDigits: 1 });
73 $("#eq_tun_height").jqxTooltip({ content: 'Maisch ketel hoogte.' });
74 $("#eq_tun_height").jqxNumberInput({ inputMode: 'simple', readOnly: true, theme: theme, width: 70, height: 23, decimalDigits: 1 });
75 $("#eq_tun_material").jqxTooltip({ content: 'Maisch ketel materiaal.' });
76 $("#eq_tun_material").jqxInput({ theme: theme, width: 120, height: 23 });
77 $("#eq_tun_specific_heat").jqxTooltip({ content: 'Maisch ketel warmte geleiding.' });
78 $("#eq_tun_specific_heat").jqxNumberInput({ inputMode: 'simple', readOnly: true, theme: theme, width: 70, height: 23, decimalDigits: 1 });
79 $("#eq_top_up_water").jqxTooltip({ content: 'Extra water in het gistvat.' });
80 $("#eq_top_up_water").jqxNumberInput({ inputMode: 'simple', readOnly: true, theme: theme, width: 70, height: 23, decimalDigits: 1 });
81 $("#eq_trub_chiller_loss").jqxTooltip({ content: 'Standaard verlies bij het overbrengen naar het gistvat.' });
82 $("#eq_trub_chiller_loss").jqxNumberInput({ inputMode: 'simple', readOnly: true, theme: theme, width: 70, height: 23, decimalDigits: 1 });
83 $("#eq_evap_rate").jqxTooltip({ content: 'Verdamping in liters per uur.' });
84 $("#eq_evap_rate").jqxNumberInput({ inputMode: 'simple', readOnly: true, theme: theme, width: 70, height: 23, decimalDigits: 2, });
85 $("#eq_boil_time").jqxTooltip({ content: 'Normale kooktijd in minuten.' });
86 $("#eq_boil_time").jqxNumberInput({ inputMode: 'simple', readOnly: true, theme: theme, width: 70, height: 23, decimalDigits: 0 });
87 $("#eq_top_up_kettle").jqxTooltip({ content: 'Extra water toevoegen tijdens de kook.' });
88 $("#eq_top_up_kettle").jqxNumberInput({ inputMode: 'simple', readOnly: true, theme: theme, width: 70, height: 23, decimalDigits: 1 });
89 $("#eq_hop_utilization").jqxTooltip({ content: '100% voor kleine installaties, hoger voor grote brouwerijen.' });
90 $("#eq_hop_utilization").jqxNumberInput({ inputMode: 'simple', readOnly: true, theme: theme, width: 70, height: 23, decimalDigits: 0 });
91 $("#eq_notes").jqxTooltip({ content: 'Opmerkingen over deze apparatuur.' });
92 $("#eq_notes").jqxInput({ theme: theme, width: 960, height: 100 });
93 $("#eq_lauter_volume").jqxTooltip({ content: 'Filterkuip volume.' });
94 $("#eq_lauter_volume").jqxNumberInput({ inputMode: 'simple', readOnly: true, theme: theme, width: 70, height: 23, decimalDigits: 1 });
95 $("#eq_lauter_height").jqxTooltip({ content: 'Filterkuip hoogte.' });
96 $("#eq_lauter_height").jqxNumberInput({ inputMode: 'simple', readOnly: true, theme: theme, width: 70, height: 23, decimalDigits: 1 });
97 $("#eq_lauter_deadspace").jqxTooltip({ content: 'Filterkuip verlies in liters.' });
98 $("#eq_lauter_deadspace").jqxNumberInput({ inputMode: 'simple', readOnly: true, theme: theme, width: 70, height: 23, decimalDigits: 1 });
99 $("#eq_kettle_volume").jqxTooltip({ content: 'Kook ketel volume in liters.' });
100 $("#eq_kettle_volume").jqxNumberInput({ inputMode: 'simple', readOnly: true, theme: theme, width: 70, height: 23, decimalDigits: 1 });
101 $("#eq_kettle_height").jqxTooltip({ content: 'Kook ketel hoogte in cm.' });
102 $("#eq_kettle_height").jqxNumberInput({ inputMode: 'simple', readOnly: true, theme: theme, width: 70, height: 23, decimalDigits: 1 });
103 $("#eq_mash_volume").jqxTooltip({ content: 'Maisch water voor de eerste stap.' });
104 $("#eq_mash_volume").jqxNumberInput({ inputMode: 'simple', readOnly: true, theme: theme, width: 70, height: 23, decimalDigits: 1 });
105 $("#eq_mash_max").jqxTooltip({ content: 'De maximale moutstort in Kg.' });
106 $("#eq_mash_max").jqxNumberInput({ inputMode: 'simple', readOnly: true, theme: theme, width: 70, height: 23, decimalDigits: 1 });
107 $("#eq_efficiency").jqxTooltip({ content: 'Gemiddeld brouwzaal rendement.' });
108 $("#eq_efficiency").jqxNumberInput({ inputMode: 'simple', readOnly: true, theme: theme, width: 70, height: 23, decimalDigits: 1 });
109
110 // Default values
111 $("#type").val('All Grain');
112
113 $("#styleSelect").jqxDropDownList({
114 placeHolder: "Kies bierstijl:",
115 theme: theme,
116 source: styleslist,
117 displayMember: "name",
118 width: 150,
119 height: 27,
120 dropDownWidth: 500,
121 dropDownHeight: 500,
122 renderer: function (index, label, value) {
123 var datarecord = styleslist.records[index];
124 return datarecord.style_guide + " " + datarecord.style_letter+ " " + datarecord.name;
125 }
126 });
127 $("#styleSelect").on('select', function (event) {
128 if (event.args) {
129 var index = event.args.index;
130 var datarecord = styleslist.records[index];
131 $("#st_name").val(datarecord.name);
132 $("#st_category").val(datarecord.category);
133 $("#st_category_number").val(datarecord.category_number);
134 $("#st_letter").val(datarecord.style_letter);
135 $("#st_guide").val(datarecord.style_guide);
136 $("#st_type").val(datarecord.type);
137 $("#st_og_min").val(datarecord.og_min);
138 $("#st_og_max").val(datarecord.og_max);
139 $("#st_fg_min").val(datarecord.fg_min);
140 $("#st_fg_max").val(datarecord.fg_max);
141 $("#st_ibu_min").val(datarecord.ibu_min);
142 $("#st_ibu_max").val(datarecord.ibu_max);
143 $("#st_color_min").val(datarecord.color_min);
144 $("#st_color_max").val(datarecord.color_max);
145 $("#st_carb_min").val(datarecord.carb_min);
146 $("#st_carb_max").val(datarecord.carb_max);
147 $("#st_abv_min").val(datarecord.abv_min);
148 $("#st_abv_max").val(datarecord.abv_max);
149 $("#st_notes").val(datarecord.notes);
150 $("#st_profile").val(datarecord.profile);
151 $("#st_ingredients").val(datarecord.ingredients);
152 $("#st_examples").val(datarecord.examples);
153 }
154 });
155
156 // Equipemnt dropdown list
157 $("#equipmentSelect").jqxDropDownList({
158 placeHolder: "Kies apparatuur:",
159 theme: theme,
160 source: equipmentlist,
161 displayMember: "name",
162 width: 150,
163 height: 27,
164 dropDownWidth: 300,
165 renderer: function (index, label, value) {
166 var datarecord = equipmentlist.records[index];
167 return datarecord.batch_size + " liter " + datarecord.name;
168 }
169 });
170 $("#equipmentSelect").on('select', function (event) {
171 if (event.args) {
172 var index = event.args.index;
173 var datarecord = equipmentlist.records[index];
174 $("#eq_name").val(datarecord.name);
175 $("#eq_boil_size").val(datarecord.boil_size);
176 $("#eq_batch_size").val(datarecord.batch_size);
177 $("#eq_tun_volume").val(datarecord.tun_volume);
178 $("#eq_tun_weight").val(datarecord.tun_weight);
179 $("#eq_tun_specific_heat").val(datarecord.tun_specific_heat);
180 $("#eq_tun_material").val(datarecord.tun_material);
181 $("#eq_tun_height").val(datarecord.tun_height);
182 $("#eq_top_up_water").val(datarecord.top_up_water);
183 $("#eq_trub_chiller_loss").val(datarecord.trub_chiller_loss);
184 $("#eq_evap_rate").val(datarecord.evap_rate);
185 $("#eq_boil_time").val(datarecord.boil_time);
186 $("#eq_calc_boil_volume").val(datarecord.calc_boil_volume);
187 $("#eq_top_up_kettle").val(datarecord.top_up_kettle);
188 $("#eq_hop_utilization").val(datarecord.hop_utilization);
189 $("#eq_notes").val(datarecord.notes);
190 $("#eq_lauter_volume").val(datarecord.lauter_volume);
191 $("#eq_lauter_height").val(datarecord.lauter_height);
192 $("#eq_lauter_deadspace").val(datarecord.lauter_deadspace);
193 $("#eq_kettle_volume").val(datarecord.kettle_volume);
194 $("#eq_kettle_height").val(datarecord.kettle_height);
195 $("#eq_mash_volume").val(datarecord.mash_volume);
196 $("#eq_mash_max").val(datarecord.mash_max);
197 $("#eq_efficiency").val(datarecord.efficiency);
198 }
199 });
34 200
35 //Creating wizard module 201 //Creating wizard module
36 var wizard = (function () { 202 var wizard = (function () {
37 203
38 //Adding event listeners 204 //Adding event listeners
39 var _addHandlers = function () { 205 var _addHandlers = function () {
40 $('#name').on('change', function (event) { wizard.validate(true); }); 206 $('#name').on('change', function (event) { wizard.validate(true); });
207 $('#code').on('change', function (event) { wizard.validate(true); });
208 $('#type').on('change', function (event) { wizard.validate(true); });
209 $('#styleSelect').on('change', function (event) { wizard.validate(true); });
210 $('#equipmentSelect').on('change', function (event) { wizard.validate(true); });
41 $('#nextButtonCompleted').click(function () { 211 $('#nextButtonCompleted').click(function () {
42 console.log("insert start"); 212 var d = new Date();
213 var m = d.getMonth() + 1;
214 var b = d.getFullYear() + '-';
215 if (m < 10)
216 b = b + '0';
217 b = b + m + '-';
218 if (d.getDate() < 10)
219 b = b + '0';
220 b = b + d.getDate();
43 var newrow = { 221 var newrow = {
44 record: -1, 222 record: -1,
45 name: $("#name").val(), 223 name: $("#name").val(),
46 code: $("#code").val(), 224 code: $("#code").val(),
47 birth: $("#birth").val(), 225 birth: b,
48 stage: 'Plan', 226 stage: 'Plan',
49 notes: $("#notes").val(), 227 notes: $("#notes").val(),
50 log_brew: false, 228 log_brew: false,
51 log_fermentation: false, 229 log_fermentation: false,
52 inventory_reduced: false, 230 inventory_reduced: false,
53 locked: false, 231 locked: false,
54 eq_name: $("#eq_name").val(), 232 eq_name: $("#eq_name").val(),
55 eq_boil_size: parseFloat($("#eq_boil_size").jqxNumberInput('decimal')), 233 eq_boil_size: parseFloat($("#eq_boil_size").jqxNumberInput('decimal')),
56 eq_batch_size: parseFloat($("#eq_batch_size").jqxNumberInput('decimal')), 234 eq_batch_size: parseFloat($("#eq_batch_size").jqxNumberInput('decimal')),
57 eq_tun_volume: parseFloat($("#eq_tun_volume").jqxNumberInput('decimal')), 235 eq_tun_volume: parseFloat($("#eq_tun_volume").jqxNumberInput('decimal')),
58 eq_tun_weight: dataRecord.eq_tun_weight, 236 eq_tun_weight: parseFloat($("#eq_tun_weight").jqxNumberInput('decimal')),
59 eq_tun_specific_heat: dataRecord.eq_tun_specific_heat, 237 eq_tun_specific_heat: parseFloat($("#eq_tun_specific_heat").jqxNumberInput('decimal')),
60 eq_tun_material: dataRecord.eq_tun_material, 238 eq_tun_material: $("#eq_tun_material").val(),
61 eq_tun_height: dataRecord.eq_tun_height, 239 eq_tun_height: parseFloat($("#eq_tun_height").jqxNumberInput('decimal')),
62 eq_top_up_water: parseFloat($("#eq_top_up_water").jqxNumberInput('decimal')), 240 eq_top_up_water: parseFloat($("#eq_top_up_water").jqxNumberInput('decimal')),
63 eq_trub_chiller_loss: parseFloat($("#eq_trub_chiller_loss").jqxNumberInput('decimal')), 241 eq_trub_chiller_loss: parseFloat($("#eq_trub_chiller_loss").jqxNumberInput('decimal')),
64 eq_evap_rate: parseFloat($("#eq_evap_rate").jqxNumberInput('decimal')), 242 eq_evap_rate: parseFloat($("#eq_evap_rate").jqxNumberInput('decimal')),
65 eq_boil_time: parseFloat($("#eq_boil_time").jqxNumberInput('decimal')), 243 eq_boil_time: parseFloat($("#eq_boil_time").jqxNumberInput('decimal')),
66 eq_calc_boil_volume: dataRecord.eq_calc_boil_volume, 244 eq_calc_boil_volume: $("#eq_calc_boil_volume").val(),
67 eq_top_up_kettle: parseFloat($("#eq_top_up_kettle").jqxNumberInput('decimal')), 245 eq_top_up_kettle: parseFloat($("#eq_top_up_kettle").jqxNumberInput('decimal')),
68 eq_hop_utilization: parseFloat($("#eq_hop_utilization").jqxNumberInput('decimal')), 246 eq_hop_utilization: parseFloat($("#eq_hop_utilization").jqxNumberInput('decimal')),
69 eq_notes: $("#eq_notes").val(), 247 eq_notes: $("#eq_notes").val(),
70 eq_lauter_volume: parseFloat($("#eq_lauter_volume").jqxNumberInput('decimal')), 248 eq_lauter_volume: parseFloat($("#eq_lauter_volume").jqxNumberInput('decimal')),
71 eq_lauter_height: dataRecord.eq_lauter_height, 249 eq_lauter_height: parseFloat($("#eq_lauter_height").jqxNumberInput('decimal')),
72 eq_lauter_deadspace: parseFloat($("#eq_lauter_deadspace").jqxNumberInput('decimal')), 250 eq_lauter_deadspace: parseFloat($("#eq_lauter_deadspace").jqxNumberInput('decimal')),
73 eq_kettle_volume: parseFloat($("#eq_kettle_volume").jqxNumberInput('decimal')), 251 eq_kettle_volume: parseFloat($("#eq_kettle_volume").jqxNumberInput('decimal')),
74 eq_kettle_height: dataRecord.eq_kettle_height, 252 eq_kettle_height: parseFloat($("#eq_kettle_height").jqxNumberInput('decimal')),
75 eq_mash_volume: parseFloat($("#eq_mash_volume").jqxNumberInput('decimal')), 253 eq_mash_volume: parseFloat($("#eq_mash_volume").jqxNumberInput('decimal')),
76 eq_mash_max: parseFloat($("#eq_mash_max").jqxNumberInput('decimal')), 254 eq_mash_max: parseFloat($("#eq_mash_max").jqxNumberInput('decimal')),
77 eq_efficiency: parseFloat($("#eq_efficiency").jqxNumberInput('decimal')), 255 eq_efficiency: parseFloat($("#eq_efficiency").jqxNumberInput('decimal')),
78 brew_date_start: '', 256 brew_date_start: '',
79 brew_mash_ph: 0.0, 257 brew_mash_ph: 0.0,
80 brew_mash_sg: 1.000, 258 brew_mash_sg: 1.000,
81 brew_sparge_temperature: 85, 259 brew_sparge_temperature: 0,
82 brew_sparge_volume: parseFloat($("#eq_mash_volume").jqxNumberInput('decimal')), 260 brew_sparge_volume: 0,
83 brew_sparge_ph: 0.0, 261 brew_sparge_ph: 0.0,
84 brew_preboil_volume: parseFloat($("#eq_boil_size").jqxNumberInput('decimal')), 262 brew_preboil_volume: 0,
85 brew_preboil_sg: 1.000, 263 brew_preboil_sg: 1.000,
86 brew_preboil_ph: 0.0, 264 brew_preboil_ph: 0.0,
87 brew_aboil_volume: parseFloat($("#eq_boil_size").jqxNumberInput('decimal')) * 0.9, 265 brew_aboil_volume: 0,
88 brew_aboil_sg: 1.000, 266 brew_aboil_sg: 1.000,
89 brew_aboil_ph: 0.0, 267 brew_aboil_ph: 0.0,
90 brew_aboil_efficiency: 0, 268 brew_aboil_efficiency: 0,
91 brew_cooling_method: '-', 269 brew_cooling_method: '-',
92 brew_cooling_time: 0, 270 brew_cooling_time: 0,
93 brew_cooling_to: 0, 271 brew_cooling_to: 0,
94 brew_whirlpool9: 0, 272 brew_whirlpool9: 0,
95 brew_whirlpool7: 0, 273 brew_whirlpool7: 0,
96 brew_whirlpool6: 0, 274 brew_whirlpool6: 0,
97 brew_whirlpool2: 0, 275 brew_whirlpool2: 0,
98 brew_fermenter_volume: parseFloat($("#eq_batch_size").jqxNumberInput('decimal')), 276 brew_fermenter_volume: 0,
99 brew_fermenter_extrawater: 0, 277 brew_fermenter_extrawater: 0,
100 brew_aeration_time: 0, 278 brew_aeration_time: 0,
101 brew_aeration_speed: 0, 279 brew_aeration_speed: 0,
102 brew_aeration_type: 'None', 280 brew_aeration_type: 'None',
103 brew_fermenter_sg: 0, 281 brew_fermenter_sg: 0,
154 st_carb_min: parseFloat($("#st_carb_min").jqxNumberInput('decimal')), 332 st_carb_min: parseFloat($("#st_carb_min").jqxNumberInput('decimal')),
155 st_carb_max: parseFloat($("#st_carb_max").jqxNumberInput('decimal')), 333 st_carb_max: parseFloat($("#st_carb_max").jqxNumberInput('decimal')),
156 st_abv_min: parseFloat($("#st_abv_min").jqxNumberInput('decimal')), 334 st_abv_min: parseFloat($("#st_abv_min").jqxNumberInput('decimal')),
157 st_abv_max: parseFloat($("#st_abv_max").jqxNumberInput('decimal')), 335 st_abv_max: parseFloat($("#st_abv_max").jqxNumberInput('decimal')),
158 type: $("#type").val(), 336 type: $("#type").val(),
159 batch_size: 20.0, 337 batch_size: parseFloat($("#eq_batch_size").jqxNumberInput('decimal')),
160 boil_time: parseFloat($("#boil_time").jqxNumberInput('decimal')), 338 boil_size: parseFloat($("#eq_boil_size").jqxNumberInput('decimal')),
161 efficiency: parseFloat($("#efficiency").jqxNumberInput('decimal')), 339 boil_time: parseFloat($("#eq_boil_time").jqxNumberInput('decimal')),
162 est_og: parseFloat($("#est_og").jqxNumberInput('decimal')), 340 efficiency: parseFloat($("#eq_efficiency").jqxNumberInput('decimal')),
163 est_fg: 1.000, 341 est_og: 0.000,
342 est_fg: 0.000,
164 est_color: 0, 343 est_color: 0,
165 est_abv: 0.0, 344 est_abv: 0.0,
166 est_carb: 0.0, 345 est_carb: 0.0,
167 color_method: "Morey", 346 color_method: "Morey",
168 est_ibu: 0, 347 est_ibu: 0,
169 ibu_method: "Tinseth", 348 ibu_method: "Tinseth",
170 mash_name: "", 349 mash_name: "",
171 mash_ph: 5.4, 350 mash_ph: 5.4,
172 mash_sparge_temp: 78.0 351 sparge_temp: 78.0,
352 sparge_volume: parseFloat($("#eq_boil_size").jqxNumberInput('decimal')) / 2,
353 sparge_ph: 5.8,
354 sparge_source: 'Bron 1',
355 sparge_acid_type: 'Melkzuur',
356 sparge_acid_perc: 80,
357 sparge_acid_amount: 0,
358 calc_acid: true
173 }; 359 };
174 var data = "insert=true&return=" + my_return + "&" + $.param(newrow); 360 var data = "insert=true&return=" + my_return + "&" + $.param(newrow);
175 $.ajax({ 361 $.ajax({
176 dataType: 'json', 362 dataType: 'json',
177 url: "includes/db_product.php", 363 url: "includes/db_product.php",
208 keyboardNavigation: false 394 keyboardNavigation: false
209 }); 395 });
210 $('#nextButtonBase').jqxButton({ theme: theme, width: 150 }); 396 $('#nextButtonBase').jqxButton({ theme: theme, width: 150 });
211 $('#nextButtonStyle').jqxButton({ theme: theme, width: 150}); 397 $('#nextButtonStyle').jqxButton({ theme: theme, width: 150});
212 $('#backButtonStyle').jqxButton({ theme: theme, width: 150}); 398 $('#backButtonStyle').jqxButton({ theme: theme, width: 150});
399 $('#nextButtonEq').jqxButton({ theme: theme, width: 150});
400 $('#backButtonEq').jqxButton({ theme: theme, width: 150});
213 $('#nextButtonCompleted').jqxButton({ theme: theme, width: 150}); 401 $('#nextButtonCompleted').jqxButton({ theme: theme, width: 150});
214 $('#backButtonCompleted').jqxButton({ theme: theme, width: 150}); 402 $('#backButtonCompleted').jqxButton({ theme: theme, width: 150});
215 _addHandlers(); 403 _addHandlers();
216 this.validate(); 404 this.validate();
217 this.showHint('Validation hints.'); 405 this.showHint('Validation hints.');
220 //Validating all wizard tabs 408 //Validating all wizard tabs
221 validate: function (notify) { 409 validate: function (notify) {
222 if (!this.firstTab(notify)) { 410 if (!this.firstTab(notify)) {
223 $('#jqxTabs').jqxTabs('disableAt', 1); 411 $('#jqxTabs').jqxTabs('disableAt', 1);
224 $('#jqxTabs').jqxTabs('disableAt', 2); 412 $('#jqxTabs').jqxTabs('disableAt', 2);
413 $('#jqxTabs').jqxTabs('disableAt', 3);
225 return; 414 return;
226 } else { 415 } else {
227 $('#jqxTabs').jqxTabs('enableAt', 1); 416 $('#jqxTabs').jqxTabs('enableAt', 1);
228 } 417 }
229 if (!this.secondTab(notify)) { 418 if (!this.secondTab(notify)) {
230 $('#jqxTabs').jqxTabs('disableAt', 2); 419 $('#jqxTabs').jqxTabs('disableAt', 2);
420 $('#jqxTabs').jqxTabs('disableAt', 3);
231 return; 421 return;
232 } else { 422 } else {
233 $('#jqxTabs').jqxTabs('enableAt', 2); 423 $('#jqxTabs').jqxTabs('enableAt', 2);
424 }
425 if (!this.thirdTab(notify)) {
426 $('#jqxTabs').jqxTabs('disableAt', 3);
427 return;
428 } else {
429 $('#jqxTabs').jqxTabs('enableAt', 3);
234 } 430 }
235 }, 431 },
236 432
237 //Displaying message to the user 433 //Displaying message to the user
238 showHint: function (message, selector) { 434 showHint: function (message, selector) {
245 $(selector).html('<strong>' + message + '</strong>'); 441 $(selector).html('<strong>' + message + '</strong>');
246 }, 442 },
247 443
248 //Validating the first tab 444 //Validating the first tab
249 firstTab: function (notify) { 445 firstTab: function (notify) {
250 var name = $('#name').val(), 446 var name = $('#name').val(), code = $('#code').val(), message = '';
251 message = '';
252 if (name.length < 3) { 447 if (name.length < 3) {
253 message += 'Je moet een recept naam invullen. <br />'; 448 message += 'Je moet een brouw project naam invullen. <br />';
254 } 449 }
255 // Check if name already exists. 450 if (code.length < 3) {
256 //if ((boil_time < 4) || (boil_time > 360)) { 451 message += 'Je moet een brouw project code invullen. <br />';
257 // message += 'De kooktijd moet tussen 4 en 360 minuten zijn. <br />'; 452 }
258 //} 453 // Check if code already exists.
259 //if ((est_og < 1.010) || (est_og > 1.200)) {
260 // message += 'Het OG moet tussen 1.010 en 1.500 zijn. <br />';
261 //}
262 //if ((efficiency < 35) || (efficiency > 95)) {
263 // message += 'Het brouwzaal rendement moet tussen 35 en 95 zijn. <br />';
264 //}
265 if (message !== '') { 454 if (message !== '') {
266 if (notify) { 455 if (notify) {
267 this.showHint(message, '#hintBase'); 456 this.showHint(message, '#hintBase');
268 } 457 }
269 return false; 458 return false;
285 } 474 }
286 return false; 475 return false;
287 } 476 }
288 this.showHint('Ok, je mag doorgaan.', '#hintStyle'); 477 this.showHint('Ok, je mag doorgaan.', '#hintStyle');
289 return true; 478 return true;
479 },
480
481 //Validating the third tab
482 thirdTab: function (notify) {
483 var equipsel = $('#equipmentSelect').val(),
484 message = '';
485 if (equipsel.length < 3) {
486 message += 'Je moet een brouw installatie kiezen. <br />';
487 }
488 if (message !== '') {
489 if (notify) {
490 this.showHint(message, '#hintEq');
491 }
492 return false;
493 }
494 this.showHint('Ok, je mag doorgaan.', '#hintEq');
495 return true;
290 } 496 }
291 } 497 }
292 } ()); 498 } ());
293 499
294 //Initializing the wizard 500 //Initializing the wizard

mercurial