www/js/prod_edit.js

changeset 818
f9c071906643
parent 817
6ee186182c70
child 819
d759d9ed357e
equal deleted inserted replaced
817:6ee186182c70 818:f9c071906643
1 /***************************************************************************** 1 /*****************************************************************************
2 * Copyright (C) 2018-2021 2 * Copyright (C) 2018-2022
3 * 3 *
4 * Michiel Broek <mbroek at mbse dot eu> 4 * Michiel Broek <mbroek at mbse dot eu>
5 * 5 *
6 * This file is part of BMS 6 * This file is part of BMS
7 * 7 *
20 * Software Foundation, 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. 20 * Software Foundation, 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
21 *****************************************************************************/ 21 *****************************************************************************/
22 22
23 23
24 function createPopupElements() { 24 function createPopupElements() {
25
26 $('#eventWindow').jqxWindow({
27 theme: theme,
28 position: { x: 490, y: 210 },
29 width: 300,
30 height: 175,
31 resizable: false,
32 isModal: true,
33 modalOpacity: 0.4,
34 autoOpen: false,
35 okButton: $('#delOk'),
36 cancelButton: $('#delCancel'),
37 initContent: function() {
38 $('#delOk').jqxButton({ template: 'danger', width: '65px', theme: theme });
39 $('#delCancel').jqxButton({ template: 'success', width: '65px', theme: theme });
40 $('#delCancel').focus();
41 }
42 });
43 25
44 $('#volumeWindow').jqxWindow({ 26 $('#volumeWindow').jqxWindow({
45 theme: theme, 27 theme: theme,
46 position: { x: 380, y: 210 }, 28 position: { x: 380, y: 210 },
47 width: 500, 29 width: 500,
653 $('#st_ibu_max').val(dataRecord.st_ibu_max); 635 $('#st_ibu_max').val(dataRecord.st_ibu_max);
654 $('#st_carb_min').val(dataRecord.st_carb_min); 636 $('#st_carb_min').val(dataRecord.st_carb_min);
655 $('#st_carb_min2').val(dataRecord.st_carb_min); 637 $('#st_carb_min2').val(dataRecord.st_carb_min);
656 $('#st_carb_max').val(dataRecord.st_carb_max); 638 $('#st_carb_max').val(dataRecord.st_carb_max);
657 $('#st_carb_max2').val(dataRecord.st_carb_max); 639 $('#st_carb_max2').val(dataRecord.st_carb_max);
658 $('#type').val(dataRecord.type); 640 $('#type').val(RecipeTypeData[dataRecord.type].nl);
659 $('#batch_size').val(dataRecord.batch_size); 641 $('#batch_size').val(dataRecord.batch_size);
660 $('#est_a_vol').val(dataRecord.batch_size * 1.04); 642 $('#est_a_vol').val(dataRecord.batch_size * 1.04);
661 $('#boil_size').val(dataRecord.boil_size); 643 $('#boil_size').val(dataRecord.boil_size);
662 $('#est_pre_vol').val(dataRecord.boil_size * 1.04); 644 $('#est_pre_vol').val(dataRecord.boil_size * 1.04);
663 $('#boil_time').val(dataRecord.boil_time); 645 $('#boil_time').val(dataRecord.boil_time);
669 $('#est_fg2').val(dataRecord.est_fg); 651 $('#est_fg2').val(dataRecord.est_fg);
670 $('#est_fg3').val(dataRecord.est_fg); 652 $('#est_fg3').val(dataRecord.est_fg);
671 $('#est_color').val(dataRecord.est_color); 653 $('#est_color').val(dataRecord.est_color);
672 $('#est_color2').val(dataRecord.est_color); 654 $('#est_color2').val(dataRecord.est_color);
673 $('#est_abv').val(dataRecord.est_abv); 655 $('#est_abv').val(dataRecord.est_abv);
674 $('#color_method').val(dataRecord.color_method); 656 $('#color_method').val(ColorMethodData[dataRecord.color_method].nl);
675 $('#est_ibu').val(dataRecord.est_ibu); 657 $('#est_ibu').val(dataRecord.est_ibu);
676 $('#est_ibu2').val(dataRecord.est_ibu); 658 $('#est_ibu2').val(dataRecord.est_ibu);
677 $('#ibu_method').val(dataRecord.ibu_method); 659 $('#ibu_method').val(IBUmethodData[dataRecord.ibu_method].nl);
678 $('#est_carb').val(dataRecord.est_carb); 660 $('#est_carb').val(dataRecord.est_carb);
679 $('#mash_name').val(dataRecord.mash_name); 661 $('#mash_name').val(dataRecord.mash_name);
680 $('#mash_ph').val(dataRecord.mash_ph); 662 $('#mash_ph').val(dataRecord.mash_ph);
681 $('#sparge_temp').val(dataRecord.sparge_temp); 663 $('#sparge_temp').val(dataRecord.sparge_temp);
682 $('#sparge_ph').val(dataRecord.sparge_ph); 664 $('#sparge_ph').val(dataRecord.sparge_ph);
3721 } 3703 }
3722 } 3704 }
3723 3705
3724 function en_stage_equipment(state) { 3706 function en_stage_equipment(state) {
3725 $('#equipmentSelect').jqxDropDownList({ disabled: (state) ? true:false }); 3707 $('#equipmentSelect').jqxDropDownList({ disabled: (state) ? true:false });
3726 $('#Delete').jqxButton({ disabled: (state) ? true:false });
3727 } 3708 }
3728 3709
3729 function en_stage_brewday(state) { 3710 function en_stage_brewday(state) {
3730 $('#jqxTabs').jqxTabs((state) ? 'disableAt':'enableAt', 8); // Brewday tab 3711 $('#jqxTabs').jqxTabs((state) ? 'disableAt':'enableAt', 8); // Brewday tab
3731 } 3712 }
3735 var onval = { disabled: (state) ? true:false }; 3716 var onval = { disabled: (state) ? true:false };
3736 var spinstate = { spinButtons: (state) ? false:true, readOnly: (state) ? true:false, width: (state) ? 90:110 }; 3717 var spinstate = { spinButtons: (state) ? false:true, readOnly: (state) ? true:false, width: (state) ? 90:110 };
3737 var spinsmall = { spinButtons: (state) ? false:true, readOnly: (state) ? true:false, width: (state) ? 70:90 }; 3718 var spinsmall = { spinButtons: (state) ? false:true, readOnly: (state) ? true:false, width: (state) ? 70:90 };
3738 3719
3739 $('#jqxTabs').jqxTabs((state) ? 'enableAt':'disableAt', 9); // Fermentation tab 3720 $('#jqxTabs').jqxTabs((state) ? 'enableAt':'disableAt', 9); // Fermentation tab
3740 $('#name').jqxInput(onval);
3741 $('#code').jqxInput(onval);
3742 $('#batch_size').jqxNumberInput(spinstate);
3743 $('#boil_size').jqxNumberInput(spinstate);
3744 $('#boil_time').jqxNumberInput(spinstate);
3745 $('#efficiency').jqxNumberInput(spinstate);
3746 $('#est_og').jqxNumberInput(spinstate);
3747 $('#type').jqxDropDownList(onval);
3748 $('#styleSelect').jqxDropDownList(onval);
3749 $('#color_method').jqxDropDownList(onval);
3750 $('#ibu_method').jqxDropDownList(onval);
3751 $('#mash_select').jqxDropDownList(onval); 3721 $('#mash_select').jqxDropDownList(onval);
3752 $('#w1_name').jqxDropDownList(onval); 3722 $('#w1_name').jqxDropDownList(onval);
3753 $('#w2_name').jqxDropDownList(onval); 3723 $('#w2_name').jqxDropDownList(onval);
3754 $('#w2_amount').jqxNumberInput(onval); 3724 $('#w2_amount').jqxNumberInput(onval);
3755 $('#pr_name').jqxDropDownList(onval); 3725 $('#pr_name').jqxDropDownList(onval);
4148 $('#wa_acid_perc').on('change', function(event) { 4118 $('#wa_acid_perc').on('change', function(event) {
4149 dataRecord.wa_acid_perc = parseFloat(event.args.value); 4119 dataRecord.wa_acid_perc = parseFloat(event.args.value);
4150 calcWater(); 4120 calcWater();
4151 }); 4121 });
4152 4122
4153 $('#color_method').on('select', function(event) {
4154 dataRecord.color_method = event.args.index;
4155 calcFermentables();
4156 });
4157 $('#ibu_method').on('select', function(event) {
4158 dataRecord.ibu_method = event.args.index;
4159 calcFermentables();
4160 calcIBUs();
4161 });
4162
4163 $('#batch_size').on('change', function(event) {
4164 console.log('batch_size change:' + event.args.value + ' old:' + dataRecord.batch_size);
4165 $('#est_a_vol').val(event.args.value * 1.04);
4166 var evap = parseFloat($('#eq_evap_rate').jqxNumberInput('decimal')) * dataRecord.boil_time / 60;
4167 dataRecord.boil_size = parseFloat(event.args.value) + evap;
4168 var factor = parseFloat(event.args.value) / dataRecord.batch_size;
4169 $('#boil_size').val(Round(dataRecord.boil_size, 2));
4170 $('#est_pre_vol').val(Round(dataRecord.boil_size * 1.04, 2));
4171 dataRecord.sparge_volume *= factor;
4172 $('#sparge_volume').val(dataRecord.sparge_volume);
4173 $('#brew_sparge_volume').val(dataRecord.sparge_volume);
4174 dataRecord.batch_size = parseFloat(event.args.value);
4175 calcFermentablesFromOG(parseFloat($('#est_og').jqxNumberInput('decimal'))); // Keep the OG
4176 adjustWaters(factor);
4177 calcFermentables();
4178 adjustHops(factor);
4179 adjustMiscs(factor);
4180 adjustYeasts(factor);
4181 calcIBUs();
4182 calcWater();
4183 calcSparge();
4184 calcMash();
4185 });
4186 $('#boil_time').on('change', function(event) {
4187 var new_time, old_time, new_evap;
4188 old_time = parseFloat(dataRecord.boil_time);
4189 new_time = parseFloat(event.args.value);
4190 console.log('boil_time change:' + new_time + ' old:' + old_time);
4191 new_evap = parseFloat($('#eq_evap_rate').jqxNumberInput('decimal')) * new_time / 60;
4192 dataRecord.boil_size = parseFloat(dataRecord.batch_size) + new_evap;
4193 dataRecord.boil_time = new_time;
4194 $('#est_pre_vol').val(Round(dataRecord.boil_size * 1.04, 2));
4195 $('#boil_size').val(Round(dataRecord.boil_size, 2));
4196 calcFermentables();
4197 calcIBUs();
4198 calcYeast();
4199 calcStage();
4200 kookTijd();
4201 });
4202 $('#efficiency').on('change', function(event) {
4203 var estog = parseFloat($('#est_og').jqxNumberInput('decimal'));
4204 dataRecord.efficiency = parseFloat(event.args.value);
4205 console.log('efficiency change:' + dataRecord.efficiency + ' est_og:' + estog);
4206 calcFermentablesFromOG(estog); // Keep the OG
4207 calcFermentables();
4208 calcIBUs();
4209 calcYeast();
4210 });
4211 $('#est_og').on('change', function(event) {
4212 dataRecord.est_og = parseFloat(event.args.value);
4213 console.log('est_og change:' + dataRecord.est_og);
4214 $('#est_og2').val(dataRecord.est_og);
4215 calcFermentablesFromOG(dataRecord.est_og); // Adjust fermentables amounts
4216 calcFermentables(); // Update the recipe details
4217 calcIBUs(); // and the IBU's.
4218 calcMash();
4219 calcYeast();
4220 });
4221 $('#mash_ph').on('change', function(event) {
4222 dataRecord.mash_ph = parseFloat(event.args.value);
4223 calcWater();
4224 });
4225
4226 $('#sparge_ph').on('change', function(event) { 4123 $('#sparge_ph').on('change', function(event) {
4227 dataRecord.sparge_ph = parseFloat(event.args.value); 4124 dataRecord.sparge_ph = parseFloat(event.args.value);
4228 calcSparge(); 4125 calcSparge();
4229 }); 4126 });
4230 $('#sparge_volume').on('change', function(event) { 4127 $('#sparge_volume').on('change', function(event) {
4432 $('#BLog').jqxButton({ disabled: (dataRecord.log_brew) ? false : true}); 4329 $('#BLog').jqxButton({ disabled: (dataRecord.log_brew) ? false : true});
4433 $('#FLog').jqxButton({ disabled: (dataRecord.log_fermentation) ? false : true}); 4330 $('#FLog').jqxButton({ disabled: (dataRecord.log_fermentation) ? false : true});
4434 $('#ILog').jqxButton({ disabled: (dataRecord.log_ispindel) ? false : true}); 4331 $('#ILog').jqxButton({ disabled: (dataRecord.log_ispindel) ? false : true});
4435 $('#CLog').jqxButton({ disabled: (dataRecord.log_co2pressure) ? false : true}); 4332 $('#CLog').jqxButton({ disabled: (dataRecord.log_co2pressure) ? false : true});
4436 } 4333 }
4437
4438 $('#styleSelect').jqxDropDownList({
4439 placeHolder: 'Kies bierstijl:',
4440 theme: theme,
4441 source: styleslist,
4442 displayMember: 'name',
4443 width: 180,
4444 height: 23,
4445 dropDownVerticalAlignment: 'top',
4446 dropDownWidth: 500,
4447 dropDownHeight: 380,
4448 renderer: function(index, label, value) {
4449 var datarecord = styleslist.records[index];
4450 return datarecord.style_guide + ' ' + datarecord.style_letter + ' ' + datarecord.name;
4451 }
4452 });
4453 $('#styleSelect').on('select', function(event) {
4454 if (event.args) {
4455 var datarecord, index = event.args.index;
4456 datarecord = styleslist.records[index];
4457 $('#st_name').val(datarecord.name);
4458 $('#st_category').val(datarecord.category);
4459 $('#st_category_number').val(datarecord.category_number);
4460 $('#st_letter').val(datarecord.style_letter);
4461 $('#st_guide').val(datarecord.style_guide);
4462 $('#st_type').val(StyleTypeData[datarecord.type].nl);
4463 $('#st_og_min').val(datarecord.og_min);
4464 $('#st_og_max').val(datarecord.og_max);
4465 $('#st_fg_min').val(datarecord.fg_min);
4466 $('#st_fg_max').val(datarecord.fg_max);
4467 $('#st_ibu_min').val(datarecord.ibu_min);
4468 $('#st_ibu_max').val(datarecord.ibu_max);
4469 $('#st_color_min').val(datarecord.color_min);
4470 $('#st_color_max').val(datarecord.color_max);
4471 $('#st_carb_min').val(datarecord.carb_min);
4472 $('#st_carb_min2').val(datarecord.carb_min);
4473 $('#st_carb_max').val(datarecord.carb_max);
4474 $('#st_carb_max2').val(datarecord.carb_max);
4475 $('#st_abv_min').val(datarecord.abv_min);
4476 $('#st_abv_max').val(datarecord.abv_max);
4477 }
4478 });
4479 4334
4480 // Equipemnt dropdown list 4335 // Equipemnt dropdown list
4481 $('#equipmentSelect').jqxDropDownList({ 4336 $('#equipmentSelect').jqxDropDownList({
4482 placeHolder: 'Kies apparatuur:', 4337 placeHolder: 'Kies apparatuur:',
4483 theme: theme, 4338 theme: theme,
4545 calcWater(); 4400 calcWater();
4546 calcSparge(); 4401 calcSparge();
4547 } 4402 }
4548 }); 4403 });
4549 4404
4550 function saveRecord(goback) {
4551 var row = {
4552 record: my_record,
4553 uuid: dataRecord.uuid,
4554 name: $('#name').val(),
4555 code: $('#code').val(),
4556 birth: $('#birth').val(),
4557 stage: dataRecord.stage,
4558 notes: $('#notes').val(),
4559 log_brew: dataRecord.log_brew,
4560 log_fermentation: dataRecord.log_fermentation,
4561 log_ispindel: dataRecord.log_ispindel,
4562 log_co2pressure: dataRecord.log_co2pressure,
4563 inventory_reduced: dataRecord.inventory_reduced,
4564 locked: dataRecord.locked,
4565 eq_name: $('#eq_name').val(),
4566 eq_boil_size: parseFloat($('#eq_boil_size').jqxNumberInput('decimal')),
4567 eq_batch_size: parseFloat($('#eq_batch_size').jqxNumberInput('decimal')),
4568 eq_tun_volume: parseFloat($('#eq_tun_volume').jqxNumberInput('decimal')),
4569 eq_tun_weight: dataRecord.eq_tun_weight,
4570 eq_tun_specific_heat: dataRecord.eq_tun_specific_heat,
4571 eq_tun_material: dataRecord.eq_tun_material,
4572 eq_tun_height: dataRecord.eq_tun_height,
4573 eq_top_up_water: parseFloat($('#eq_top_up_water').jqxNumberInput('decimal')),
4574 eq_trub_chiller_loss: parseFloat($('#eq_trub_chiller_loss').jqxNumberInput('decimal')),
4575 eq_evap_rate: parseFloat($('#eq_evap_rate').jqxNumberInput('decimal')),
4576 eq_boil_time: parseFloat($('#eq_boil_time').jqxNumberInput('decimal')),
4577 eq_calc_boil_volume: dataRecord.eq_calc_boil_volume,
4578 eq_top_up_kettle: parseFloat($('#eq_top_up_kettle').jqxNumberInput('decimal')),
4579 eq_hop_utilization: parseFloat($('#eq_hop_utilization').jqxNumberInput('decimal')),
4580 eq_notes: $('#eq_notes').val(),
4581 eq_lauter_volume: parseFloat($('#eq_lauter_volume').jqxNumberInput('decimal')),
4582 eq_lauter_height: dataRecord.eq_lauter_height,
4583 eq_lauter_deadspace: parseFloat($('#eq_lauter_deadspace').jqxNumberInput('decimal')),
4584 eq_kettle_volume: parseFloat($('#eq_kettle_volume').jqxNumberInput('decimal')),
4585 eq_kettle_height: dataRecord.eq_kettle_height,
4586 eq_mash_volume: parseFloat($('#eq_mash_volume').jqxNumberInput('decimal')),
4587 eq_mash_max: parseFloat($('#eq_mash_max').jqxNumberInput('decimal')),
4588 eq_efficiency: parseFloat($('#eq_efficiency').jqxNumberInput('decimal')),
4589 brew_date_start: $('#brew_date_start').val(),
4590 brew_mash_ph: parseFloat($('#brew_mash_ph').jqxNumberInput('decimal')),
4591 brew_mash_sg: parseFloat($('#brew_mash_sg').jqxNumberInput('decimal')),
4592 brew_mash_efficiency: parseFloat($('#brew_mash_efficiency').jqxNumberInput('decimal')),
4593 brew_sparge_est: parseFloat($('#brew_sparge_est').jqxNumberInput('decimal')),
4594 brew_sparge_ph: parseFloat($('#brew_sparge_ph').jqxNumberInput('decimal')),
4595 brew_preboil_volume: parseFloat($('#brew_preboil_volume').jqxNumberInput('decimal')),
4596 brew_preboil_sg: parseFloat($('#brew_preboil_sg').jqxNumberInput('decimal')),
4597 brew_preboil_ph: parseFloat($('#brew_preboil_ph').jqxNumberInput('decimal')),
4598 brew_preboil_efficiency: parseFloat($('#brew_preboil_efficiency').jqxNumberInput('decimal')),
4599 brew_aboil_volume: parseFloat($('#brew_aboil_volume').jqxNumberInput('decimal')),
4600 brew_aboil_sg: parseFloat($('#brew_aboil_sg').jqxNumberInput('decimal')),
4601 brew_aboil_ph: parseFloat($('#brew_aboil_ph').jqxNumberInput('decimal')),
4602 brew_aboil_efficiency: parseFloat($('#brew_aboil_efficiency').jqxNumberInput('decimal')),
4603 brew_cooling_method: $('#brew_cooling_method').val(),
4604 brew_cooling_time: parseFloat($('#brew_cooling_time').jqxNumberInput('decimal')),
4605 brew_cooling_to: parseFloat($('#brew_cooling_to').jqxNumberInput('decimal')),
4606 brew_whirlpool9: parseFloat($('#brew_whirlpool9').jqxNumberInput('decimal')),
4607 brew_whirlpool7: parseFloat($('#brew_whirlpool7').jqxNumberInput('decimal')),
4608 brew_whirlpool6: parseFloat($('#brew_whirlpool6').jqxNumberInput('decimal')),
4609 brew_whirlpool2: parseFloat($('#brew_whirlpool2').jqxNumberInput('decimal')),
4610 brew_fermenter_volume: parseFloat($('#brew_fermenter_volume').jqxNumberInput('decimal')),
4611 brew_fermenter_extrawater: parseFloat($('#brew_fermenter_extrawater').jqxNumberInput('decimal')),
4612 brew_fermenter_tcloss: parseFloat($('#brew_fermenter_tcloss').jqxNumberInput('decimal')),
4613 brew_aeration_time: parseFloat($('#brew_aeration_time').jqxNumberInput('decimal')),
4614 brew_aeration_speed: parseFloat($('#brew_aeration_speed').jqxNumberInput('decimal')),
4615 brew_aeration_type: $('#brew_aeration_type').val(),
4616 brew_fermenter_sg: parseFloat($('#brew_fermenter_sg').jqxNumberInput('decimal')),
4617 brew_fermenter_ibu: parseFloat($('#brew_fermenter_ibu').jqxNumberInput('decimal')),
4618 brew_fermenter_color: parseFloat($('#brew_fermenter_color').jqxNumberInput('decimal')),
4619 brew_date_end: $('#brew_date_end').val(),
4620 og: dataRecord.og,
4621 fg: parseFloat($('#fg').jqxNumberInput('decimal')),
4622 primary_start_temp: parseFloat($('#primary_start_temp').jqxNumberInput('decimal')),
4623 primary_max_temp: parseFloat($('#primary_max_temp').jqxNumberInput('decimal')),
4624 primary_end_temp: parseFloat($('#primary_end_temp').jqxNumberInput('decimal')),
4625 primary_end_sg: parseFloat($('#primary_end_sg').jqxNumberInput('decimal')),
4626 primary_end_date: $('#primary_end_date').val(),
4627 secondary_temp: parseFloat($('#secondary_temp').jqxNumberInput('decimal')),
4628 secondary_end_sg: parseFloat($('#secondary_end_sg').jqxNumberInput('decimal')),
4629 secondary_end_date: $('#secondary_end_date').val(),
4630 tertiary_temp: parseFloat($('#tertiary_temp').jqxNumberInput('decimal')),
4631 package_date: $('#package_date').val(),
4632 package_volume: parseFloat($('#package_volume').jqxNumberInput('decimal')),
4633 package_infuse_amount: parseFloat($('#package_infuse_amount').jqxNumberInput('decimal')),
4634 package_infuse_abv: parseFloat($('#package_infuse_abv').jqxNumberInput('decimal')),
4635 package_infuse_notes: $('#package_infuse_notes').val(),
4636 package_abv: parseFloat($('#package_abv').jqxNumberInput('decimal')),
4637 package_ph: parseFloat($('#package_ph').jqxNumberInput('decimal')),
4638 bottle_amount: parseFloat($('#bottle_amount').jqxNumberInput('decimal')),
4639 bottle_carbonation: parseFloat($('#bottle_carbonation').jqxNumberInput('decimal')),
4640 bottle_priming_water: parseFloat($('#bottle_priming_water').jqxNumberInput('decimal')),
4641 bottle_priming_amount: parseFloat($('#bottle_priming_amount').jqxNumberInput('decimal')),
4642 bottle_carbonation_temp: parseFloat($('#bottle_carbonation_temp').jqxNumberInput('decimal')),
4643 keg_amount: parseFloat($('#keg_amount').jqxNumberInput('decimal')),
4644 keg_carbonation: parseFloat($('#keg_carbonation').jqxNumberInput('decimal')),
4645 keg_priming_water: parseFloat($('#keg_priming_water').jqxNumberInput('decimal')),
4646 keg_priming_amount: parseFloat($('#keg_priming_amount').jqxNumberInput('decimal')),
4647 keg_carbonation_temp: parseFloat($('#keg_carbonation_temp').jqxNumberInput('decimal')),
4648 keg_forced_carb: dataRecord.keg_forced_carb,
4649 keg_pressure: parseFloat($('#keg_pressure').jqxNumberInput('decimal')),
4650 taste_notes: $('#taste_notes').val(),
4651 taste_rate: parseFloat($('#taste_rate').jqxNumberInput('decimal')),
4652 taste_date: $('#taste_date').val(),
4653 taste_color: $('#taste_color').val(),
4654 taste_transparency: $('#taste_transparency').val(),
4655 taste_head: $('#taste_head').val(),
4656 taste_aroma: $('#taste_aroma').val(),
4657 taste_taste: $('#taste_taste').val(),
4658 taste_mouthfeel: $('#taste_mouthfeel').val(),
4659 taste_aftertaste: $('#taste_aftertaste').val(),
4660 st_name: $('#st_name').val(),
4661 st_letter: $('#st_letter').val(),
4662 st_guide: $('#st_guide').val(),
4663 st_type: dataRecord.st_type,
4664 st_category: $('#st_category').val(),
4665 st_category_number: $('#st_category_number').val(),
4666 st_og_min: parseFloat($('#st_og_min').jqxNumberInput('decimal')),
4667 st_og_max: parseFloat($('#st_og_max').jqxNumberInput('decimal')),
4668 st_fg_min: parseFloat($('#st_fg_min').jqxNumberInput('decimal')),
4669 st_fg_max: parseFloat($('#st_fg_max').jqxNumberInput('decimal')),
4670 st_ibu_min: parseFloat($('#st_ibu_min').jqxNumberInput('decimal')),
4671 st_ibu_max: parseFloat($('#st_ibu_max').jqxNumberInput('decimal')),
4672 st_color_min: parseFloat($('#st_color_min').jqxNumberInput('decimal')),
4673 st_color_max: parseFloat($('#st_color_max').jqxNumberInput('decimal')),
4674 st_carb_min: parseFloat($('#st_carb_min').jqxNumberInput('decimal')),
4675 st_carb_max: parseFloat($('#st_carb_max').jqxNumberInput('decimal')),
4676 st_abv_min: parseFloat($('#st_abv_min').jqxNumberInput('decimal')),
4677 st_abv_max: parseFloat($('#st_abv_max').jqxNumberInput('decimal')),
4678 type: $('#type').val(),
4679 batch_size: parseFloat($('#batch_size').jqxNumberInput('decimal')),
4680 boil_size: parseFloat($('#boil_size').jqxNumberInput('decimal')),
4681 boil_time: parseFloat($('#boil_time').jqxNumberInput('decimal')),
4682 efficiency: parseFloat($('#efficiency').jqxNumberInput('decimal')),
4683 est_og: parseFloat($('#est_og').jqxNumberInput('decimal')),
4684 est_og3: parseFloat($('#est_og3').jqxNumberInput('decimal')),
4685 est_fg: parseFloat($('#est_fg').jqxNumberInput('decimal')),
4686 est_abv: parseFloat($('#est_abv').jqxNumberInput('decimal')),
4687 est_color: parseFloat($('#est_color').jqxNumberInput('decimal')),
4688 color_method: $('#color_method').val(),
4689 est_ibu: parseFloat($('#est_ibu').jqxNumberInput('decimal')),
4690 ibu_method: $('#ibu_method').val(),
4691 est_carb: parseFloat($('#est_carb').jqxNumberInput('decimal')),
4692 mash_name: $('#mash_name').val(),
4693 mash_ph: parseFloat($('#mash_ph').jqxNumberInput('decimal')),
4694 sparge_temp: parseFloat($('#sparge_temp').jqxNumberInput('decimal')),
4695 sparge_ph: parseFloat($('#sparge_ph').jqxNumberInput('decimal')),
4696 sparge_volume: parseFloat($('#sparge_volume').jqxNumberInput('decimal')),
4697 sparge_source: $('#sparge_source').val(),
4698 sparge_acid_type: $('#sparge_acid_type').val(),
4699 sparge_acid_perc: parseFloat($('#sparge_acid_perc').jqxNumberInput('decimal')),
4700 sparge_acid_amount: dataRecord.sparge_acid_amount,
4701 calc_acid: dataRecord.calc_acid,
4702 w1_name: $('#w1_name').val(),
4703 w1_amount: parseFloat($('#w1_amount').jqxNumberInput('decimal')),
4704 w1_calcium: parseFloat($('#w1_calcium').jqxNumberInput('decimal')),
4705 w1_sulfate: parseFloat($('#w1_sulfate').jqxNumberInput('decimal')),
4706 w1_chloride: parseFloat($('#w1_chloride').jqxNumberInput('decimal')),
4707 w1_sodium: parseFloat($('#w1_sodium').jqxNumberInput('decimal')),
4708 w1_magnesium: parseFloat($('#w1_magnesium').jqxNumberInput('decimal')),
4709 w1_total_alkalinity: parseFloat($('#w1_total_alkalinity').jqxNumberInput('decimal')),
4710 w1_ph: parseFloat($('#w1_ph').jqxNumberInput('decimal')),
4711 w1_cost: dataRecord.w1_cost,
4712 w2_name: $('#w2_name').val(),
4713 w2_amount: parseFloat($('#w2_amount').jqxNumberInput('decimal')),
4714 w2_calcium: parseFloat($('#w2_calcium').jqxNumberInput('decimal')),
4715 w2_sulfate: parseFloat($('#w2_sulfate').jqxNumberInput('decimal')),
4716 w2_chloride: parseFloat($('#w2_chloride').jqxNumberInput('decimal')),
4717 w2_sodium: parseFloat($('#w2_sodium').jqxNumberInput('decimal')),
4718 w2_magnesium: parseFloat($('#w2_magnesium').jqxNumberInput('decimal')),
4719 w2_total_alkalinity: parseFloat($('#w2_total_alkalinity').jqxNumberInput('decimal')),
4720 w2_ph: parseFloat($('#w2_ph').jqxNumberInput('decimal')),
4721 w2_cost: dataRecord.w2_cost,
4722 wg_amount: parseFloat($('#wg_amount').jqxNumberInput('decimal')),
4723 wg_calcium: parseFloat($('#wg_calcium').jqxNumberInput('decimal')),
4724 wg_sulfate: parseFloat($('#wg_sulfate').jqxNumberInput('decimal')),
4725 wg_chloride: parseFloat($('#wg_chloride').jqxNumberInput('decimal')),
4726 wg_sodium: parseFloat($('#wg_sodium').jqxNumberInput('decimal')),
4727 wg_magnesium: parseFloat($('#wg_magnesium').jqxNumberInput('decimal')),
4728 wg_total_alkalinity: parseFloat($('#wg_total_alkalinity').jqxNumberInput('decimal')),
4729 wg_ph: parseFloat($('#wg_ph').jqxNumberInput('decimal')),
4730 wb_calcium: parseFloat($('#wb_calcium').jqxNumberInput('decimal')),
4731 wb_sulfate: parseFloat($('#wb_sulfate').jqxNumberInput('decimal')),
4732 wb_chloride: parseFloat($('#wb_chloride').jqxNumberInput('decimal')),
4733 wb_sodium: parseFloat($('#wb_sodium').jqxNumberInput('decimal')),
4734 wb_magnesium: parseFloat($('#wb_magnesium').jqxNumberInput('decimal')),
4735 wb_total_alkalinity: parseFloat($('#wb_total_alkalinity').jqxNumberInput('decimal')),
4736 wb_ph: parseFloat($('#wb_ph').jqxNumberInput('decimal')),
4737 wa_acid_name: parseInt($('#wa_acid_name').val()),
4738 wa_acid_perc: parseFloat($('#wa_acid_perc').jqxNumberInput('decimal')),
4739 wa_base_name: 0,
4740 starter_enable: dataRecord.starter_enable,
4741 starter_type: $('#starter_type').val(),
4742 starter_sg: parseFloat($('#starter_sg').jqxNumberInput('decimal')),
4743 starter_viability: parseFloat($('#starter_viability').jqxNumberInput('decimal')),
4744 yeast_prod_date: $('#yeast_prod_date').val(),
4745 yeast_pitchrate: parseFloat($('#yeast_pitchrate').jqxNumberInput('decimal')),
4746 prop1_type: $('#prop1_type').val(),
4747 prop1_volume: parseFloat($('#prop1_volume').jqxNumberInput('decimal')),
4748 prop2_type: $('#prop2_type').val(),
4749 prop2_volume: parseFloat($('#prop2_volume').jqxNumberInput('decimal')),
4750 prop3_type: $('#prop3_type').val(),
4751 prop3_volume: parseFloat($('#prop3_volume').jqxNumberInput('decimal')),
4752 prop4_type: $('#prop4_type').val(),
4753 prop4_volume: parseFloat($('#prop4_volume').jqxNumberInput('decimal')),
4754 divide_type: dataRecord.divide_type,
4755 divide_size: dataRecord.divide_size,
4756 divide_factor: dataRecord.divide_factor,
4757 divide_parts: dataRecord.divide_parts,
4758 divide_part: dataRecord.divide_part,
4759 fermentables: $('#fermentableGrid').jqxGrid('getrows'),
4760 hops: $('#hopGrid').jqxGrid('getrows'),
4761 miscs: $('#miscGrid').jqxGrid('getrows'),
4762 yeasts: $('#yeastGrid').jqxGrid('getrows'),
4763 mashs: $('#mashGrid').jqxGrid('getrows')
4764 },
4765 data = 'update=true&' + $.param(row);
4766 $.ajax({
4767 dataType: 'json',
4768 url: url,
4769 cache: false,
4770 data: data,
4771 async: false,
4772 type: 'POST',
4773 success: function(data) {
4774 if (data.error) {
4775 console.log('saveRecord(' + goback + ') error ' + data.msg);
4776 alert('SQL fout: ' + data.msg);
4777 } else {
4778 console.log('saveRecord(' + goback + ') success');
4779 }
4780 if (goback)
4781 window.location.href = my_return;
4782 else
4783 window.location.href =
4784 'prod_export.php?record=' + my_record + '&return=' + my_return + '&select=' + my_select + '&code=' + dataRecord.code + '&name=' + dataRecord.name +
4785 '&stage=' + dataRecord.stage + '&split=' + dataRecord.divide_type;
4786 },
4787 error: function(jqXHR, textStatus, errorThrown) {
4788 console.log('saveRecord() ' + textStatus);
4789 }
4790 });
4791 };
4792 4405
4793 // initialize the input fields. 4406 // initialize the input fields.
4794 // Tab 1, Algemeen 4407 // Tab 1, Algemeen
4795 $('#name').jqxTooltip({ content: 'De naam voor dit product.' }); 4408 $('#name').jqxTooltip({ content: 'De naam voor dit product.' });
4796 $('#code').jqxTooltip({ content: 'Product code nummer.' }); 4409 $('#code').jqxTooltip({ content: 'Product code nummer.' });
4832 $('#st_carb_max').jqxTooltip({ content: 'Het maximum koolzuur volume voor deze bierstijl.'}); 4445 $('#st_carb_max').jqxTooltip({ content: 'Het maximum koolzuur volume voor deze bierstijl.'});
4833 4446
4834 $('#name').jqxInput({ theme: theme, width: 640, height: 23 }); 4447 $('#name').jqxInput({ theme: theme, width: 640, height: 23 });
4835 $('#code, #stage').jqxInput({ theme: theme, width: 100, height: 23 }); 4448 $('#code, #stage').jqxInput({ theme: theme, width: 100, height: 23 });
4836 $('#locked').jqxCheckBox({ theme: theme, width: 120, height: 23, disabled: true }); 4449 $('#locked').jqxCheckBox({ theme: theme, width: 120, height: 23, disabled: true });
4837 $('#locked').on('checked', function(event) {
4838 if (dataRecord.stage >= 10) {
4839 dataRecord.locked = 1;
4840 dataRecord.stage = 11;
4841 calcStage();
4842 }
4843 });
4844 $('#locked').on('unchecked', function(event) {
4845 if (dataRecord.stage >= 10) {
4846 dataRecord.locked = 0;
4847 dataRecord.stage = 10;
4848 calcStage();
4849 }
4850 });
4851 $('#birth,#divide_batch,#divide_type').jqxInput({ theme: theme, width: 120, height: 23 }); 4450 $('#birth,#divide_batch,#divide_type').jqxInput({ theme: theme, width: 120, height: 23 });
4852 $('#notes').jqxInput({ theme: theme, width: 960, height: 100 }); 4451 $('#notes').jqxInput({ theme: theme, width: 960, height: 100 });
4853 $('#type').jqxDropDownList({ 4452 $('#type').jqxInput({ theme: theme, width: 180, height: 23 });
4854 theme: theme, 4453 $('#efficiency').jqxNumberInput(Show1dec);
4855 source: RecipeTypeAdapter, 4454 $('#batch_size').jqxNumberInput(Show1dec);
4856 valueMember: 'id', 4455 $('#boil_time').jqxNumberInput(Show0dec);
4857 displayMember: 'nl', 4456 $('#boil_size').jqxNumberInput(Show2dec);
4858 width: 180,
4859 height: 23,
4860 autoDropDownHeight: true
4861 });
4862 $('#efficiency').jqxNumberInput(Perc1dec);
4863 $('#batch_size').jqxNumberInput(Spin1dec);
4864 $('#batch_size').jqxNumberInput({ min: 4 });
4865 $('#boil_time').jqxNumberInput(PosInt);
4866 $('#boil_time').jqxNumberInput({ min: 0, max: 360 });
4867 $('#boil_size').jqxNumberInput({ inputMode: 'simple', theme: theme, width: 90, height: 23, decimalDigits: 2, readOnly: true });
4868 $('#st_guide,#st_name,#st_type,#st_category').jqxInput({ theme: theme, width: 250, height: 23 }); 4457 $('#st_guide,#st_name,#st_type,#st_category').jqxInput({ theme: theme, width: 250, height: 23 });
4869 $('#est_og').jqxNumberInput(SGopts); 4458 $('#est_og').jqxNumberInput(Show3dec);
4870 $('#est_fg').jqxNumberInput(Show3dec); 4459 $('#est_fg').jqxNumberInput(Show3dec);
4871 $('#st_og_min,#st_og_max,#st_fg_min,#st_fg_max').jqxNumberInput({ inputMode: 'simple', theme: theme, width: 50, height: 23, decimalDigits: 3, readOnly: true }); 4460 $('#st_og_min,#st_og_max,#st_fg_min,#st_fg_max').jqxNumberInput({ inputMode: 'simple', theme: theme, width: 50, height: 23, decimalDigits: 3, readOnly: true });
4872 $('#est_ibu,#est_color').jqxNumberInput(Show0dec); 4461 $('#est_ibu,#est_color').jqxNumberInput(Show0dec);
4873 $('#color_method').jqxDropDownList({ 4462 $('#color_method').jqxInput({ theme: theme, width: 180, height: 23 });
4874 theme: theme,
4875 source: ColorMethodAdapter,
4876 valueMember: 'id',
4877 displayMember: 'nl',
4878 width: 180,
4879 height: 23,
4880 autoDropDownHeight: true
4881 });
4882 $('#st_color_min,#st_color_max,#st_category_number,#st_ibu_min,#st_ibu_max,#kcal').jqxNumberInput(Smal0dec); 4463 $('#st_color_min,#st_color_max,#st_category_number,#st_ibu_min,#st_ibu_max,#kcal').jqxNumberInput(Smal0dec);
4883 $('#ibu_method').jqxDropDownList({ 4464 $('#ibu_method').jqxInput({ theme: theme, width: 180, height: 23 });
4884 theme: theme,
4885 source: IBUmethodAdapter,
4886 valueMember: 'id',
4887 displayMember: 'nl',
4888 width: 180,
4889 height: 23,
4890 autoDropDownHeight: true,
4891 dropDownVerticalAlignment: 'top'
4892 });
4893 $('#est_abv,#st_abv_min,#st_abv_max,#est_carb,#st_carb_min,#st_carb_max').jqxNumberInput(Smal1dec); 4465 $('#est_abv,#st_abv_min,#st_abv_max,#est_carb,#st_carb_min,#st_carb_max').jqxNumberInput(Smal1dec);
4894 4466
4895 // Tab 2, Equipment 4467 // Tab 2, Equipment
4896 $('#eq_name').jqxTooltip({ content: 'De naam van deze brouw apparatuur.' }); 4468 $('#eq_name').jqxTooltip({ content: 'De naam van deze brouw apparatuur.' });
4897 $('#eq_boil_size').jqxTooltip({ content: 'Normaal kook volume in liters' }); 4469 $('#eq_boil_size').jqxTooltip({ content: 'Normaal kook volume in liters' });
6411 autoHeight: false, 5983 autoHeight: false,
6412 position: 'top' 5984 position: 'top'
6413 }); 5985 });
6414 5986
6415 // Buttons below 5987 // Buttons below
6416 $('#Delete').jqxButton({ template: 'danger', width: '80px', theme: theme }); 5988 $('#Terug').jqxButton({ template: 'primary', width: '80px', theme: theme });
6417 $('#Delete').bind('click', function() { 5989 $('#Terug').bind('click', function() {
6418 // Open a popup to confirm this action.
6419 $('#eventWindow').jqxWindow('open');
6420 $('#delOk').click(function() {
6421 var data = 'delete=true&' + $.param({ uuid: dataRecord.uuid });
6422 $.ajax({
6423 dataType: 'json',
6424 url: url,
6425 cache: false,
6426 data: data,
6427 type: 'POST',
6428 success: function(data, status, xhr) {
6429 // delete command is executed.
6430 window.location.href = my_return;
6431 },
6432 error: function(jqXHR, textStatus, errorThrown) {
6433 }
6434 });
6435 });
6436 });
6437
6438 $('#Cancel').jqxButton({ template: 'primary', width: '80px', theme: theme });
6439 $('#Cancel').bind('click', function() {
6440 window.location.href = my_return; 5990 window.location.href = my_return;
6441 }); 5991 });
6442 5992
6443 $('#Save').jqxButton({ template: 'success', width: '80px', theme: theme });
6444 $('#Save').bind('click', function() {
6445 saveRecord(1);
6446 });
6447 createPopupElements(); 5993 createPopupElements();
6448 }); 5994 });
6449 5995

mercurial