www/js/prod_edit.js

changeset 818
f9c071906643
parent 817
6ee186182c70
child 819
d759d9ed357e
--- a/www/js/prod_edit.js	Fri Aug 05 12:12:53 2022 +0200
+++ b/www/js/prod_edit.js	Fri Aug 05 14:19:21 2022 +0200
@@ -1,5 +1,5 @@
 /*****************************************************************************
- * Copyright (C) 2018-2021
+ * Copyright (C) 2018-2022
  *
  * Michiel Broek <mbroek at mbse dot eu>
  *
@@ -23,24 +23,6 @@
 
 function createPopupElements() {
 
- $('#eventWindow').jqxWindow({
-  theme: theme,
-  position: { x: 490, y: 210 },
-  width: 300,
-  height: 175,
-  resizable: false,
-  isModal: true,
-  modalOpacity: 0.4,
-  autoOpen: false,
-  okButton: $('#delOk'),
-  cancelButton: $('#delCancel'),
-  initContent: function() {
-   $('#delOk').jqxButton({ template: 'danger', width: '65px', theme: theme });
-   $('#delCancel').jqxButton({ template: 'success', width: '65px', theme: theme });
-   $('#delCancel').focus();
-  }
- });
-
  $('#volumeWindow').jqxWindow({
   theme: theme,
   position: { x: 380, y: 210 },
@@ -655,7 +637,7 @@
    $('#st_carb_min2').val(dataRecord.st_carb_min);
    $('#st_carb_max').val(dataRecord.st_carb_max);
    $('#st_carb_max2').val(dataRecord.st_carb_max);
-   $('#type').val(dataRecord.type);
+   $('#type').val(RecipeTypeData[dataRecord.type].nl);
    $('#batch_size').val(dataRecord.batch_size);
    $('#est_a_vol').val(dataRecord.batch_size * 1.04);
    $('#boil_size').val(dataRecord.boil_size);
@@ -671,10 +653,10 @@
    $('#est_color').val(dataRecord.est_color);
    $('#est_color2').val(dataRecord.est_color);
    $('#est_abv').val(dataRecord.est_abv);
-   $('#color_method').val(dataRecord.color_method);
+   $('#color_method').val(ColorMethodData[dataRecord.color_method].nl);
    $('#est_ibu').val(dataRecord.est_ibu);
    $('#est_ibu2').val(dataRecord.est_ibu);
-   $('#ibu_method').val(dataRecord.ibu_method);
+   $('#ibu_method').val(IBUmethodData[dataRecord.ibu_method].nl);
    $('#est_carb').val(dataRecord.est_carb);
    $('#mash_name').val(dataRecord.mash_name);
    $('#mash_ph').val(dataRecord.mash_ph);
@@ -3723,7 +3705,6 @@
 
  function en_stage_equipment(state) {
   $('#equipmentSelect').jqxDropDownList({ disabled: (state) ? true:false });
-  $('#Delete').jqxButton({ disabled: (state) ? true:false });
  }
 
  function en_stage_brewday(state) {
@@ -3737,17 +3718,6 @@
   var spinsmall = { spinButtons: (state) ? false:true, readOnly: (state) ? true:false, width: (state) ? 70:90 };
 
   $('#jqxTabs').jqxTabs((state) ? 'enableAt':'disableAt', 9);	// Fermentation tab
-  $('#name').jqxInput(onval);
-  $('#code').jqxInput(onval);
-  $('#batch_size').jqxNumberInput(spinstate);
-  $('#boil_size').jqxNumberInput(spinstate);
-  $('#boil_time').jqxNumberInput(spinstate);
-  $('#efficiency').jqxNumberInput(spinstate);
-  $('#est_og').jqxNumberInput(spinstate);
-  $('#type').jqxDropDownList(onval);
-  $('#styleSelect').jqxDropDownList(onval);
-  $('#color_method').jqxDropDownList(onval);
-  $('#ibu_method').jqxDropDownList(onval);
   $('#mash_select').jqxDropDownList(onval);
   $('#w1_name').jqxDropDownList(onval);
   $('#w2_name').jqxDropDownList(onval);
@@ -4150,79 +4120,6 @@
    calcWater();
   });
 
-  $('#color_method').on('select', function(event) {
-   dataRecord.color_method = event.args.index;
-   calcFermentables();
-  });
-  $('#ibu_method').on('select', function(event) {
-   dataRecord.ibu_method = event.args.index;
-   calcFermentables();
-   calcIBUs();
-  });
-
-  $('#batch_size').on('change', function(event) {
-   console.log('batch_size change:' + event.args.value + ' old:' + dataRecord.batch_size);
-   $('#est_a_vol').val(event.args.value * 1.04);
-   var evap = parseFloat($('#eq_evap_rate').jqxNumberInput('decimal')) * dataRecord.boil_time / 60;
-   dataRecord.boil_size = parseFloat(event.args.value) + evap;
-   var factor = parseFloat(event.args.value) / dataRecord.batch_size;
-   $('#boil_size').val(Round(dataRecord.boil_size, 2));
-   $('#est_pre_vol').val(Round(dataRecord.boil_size * 1.04, 2));
-   dataRecord.sparge_volume *= factor;
-   $('#sparge_volume').val(dataRecord.sparge_volume);
-   $('#brew_sparge_volume').val(dataRecord.sparge_volume);
-   dataRecord.batch_size = parseFloat(event.args.value);
-   calcFermentablesFromOG(parseFloat($('#est_og').jqxNumberInput('decimal')));     // Keep the OG
-   adjustWaters(factor);
-   calcFermentables();
-   adjustHops(factor);
-   adjustMiscs(factor);
-   adjustYeasts(factor);
-   calcIBUs();
-   calcWater();
-   calcSparge();
-   calcMash();
-  });
-  $('#boil_time').on('change', function(event) {
-   var new_time, old_time, new_evap;
-   old_time = parseFloat(dataRecord.boil_time);
-   new_time = parseFloat(event.args.value);
-   console.log('boil_time change:' + new_time + ' old:' + old_time);
-   new_evap = parseFloat($('#eq_evap_rate').jqxNumberInput('decimal')) * new_time / 60;
-   dataRecord.boil_size = parseFloat(dataRecord.batch_size) + new_evap;
-   dataRecord.boil_time = new_time;
-   $('#est_pre_vol').val(Round(dataRecord.boil_size * 1.04, 2));
-   $('#boil_size').val(Round(dataRecord.boil_size, 2));
-   calcFermentables();
-   calcIBUs();
-   calcYeast();
-   calcStage();
-   kookTijd();
-  });
-  $('#efficiency').on('change', function(event) {
-   var estog = parseFloat($('#est_og').jqxNumberInput('decimal'));
-   dataRecord.efficiency = parseFloat(event.args.value);
-   console.log('efficiency change:' + dataRecord.efficiency + ' est_og:' + estog);
-   calcFermentablesFromOG(estog);     // Keep the OG
-   calcFermentables();
-   calcIBUs();
-   calcYeast();
-  });
-  $('#est_og').on('change', function(event) {
-   dataRecord.est_og = parseFloat(event.args.value);
-   console.log('est_og change:' + dataRecord.est_og);
-   $('#est_og2').val(dataRecord.est_og);
-   calcFermentablesFromOG(dataRecord.est_og);      // Adjust fermentables amounts
-   calcFermentables();                             // Update the recipe details
-   calcIBUs();                                     // and the IBU's.
-   calcMash();
-   calcYeast();
-  });
-  $('#mash_ph').on('change', function(event) {
-   dataRecord.mash_ph = parseFloat(event.args.value);
-   calcWater();
-  });
-
   $('#sparge_ph').on('change', function(event) {
    dataRecord.sparge_ph = parseFloat(event.args.value);
    calcSparge();
@@ -4435,48 +4332,6 @@
   $('#CLog').jqxButton({ disabled: (dataRecord.log_co2pressure) ? false : true});
  }
 
- $('#styleSelect').jqxDropDownList({
-  placeHolder: 'Kies bierstijl:',
-  theme: theme,
-  source: styleslist,
-  displayMember: 'name',
-  width: 180,
-  height: 23,
-  dropDownVerticalAlignment: 'top',
-  dropDownWidth: 500,
-  dropDownHeight: 380,
-  renderer: function(index, label, value) {
-   var datarecord = styleslist.records[index];
-   return datarecord.style_guide + ' ' + datarecord.style_letter + ' ' + datarecord.name;
-  }
- });
- $('#styleSelect').on('select', function(event) {
-  if (event.args) {
-   var datarecord, index = event.args.index;
-   datarecord = styleslist.records[index];
-   $('#st_name').val(datarecord.name);
-   $('#st_category').val(datarecord.category);
-   $('#st_category_number').val(datarecord.category_number);
-   $('#st_letter').val(datarecord.style_letter);
-   $('#st_guide').val(datarecord.style_guide);
-   $('#st_type').val(StyleTypeData[datarecord.type].nl);
-   $('#st_og_min').val(datarecord.og_min);
-   $('#st_og_max').val(datarecord.og_max);
-   $('#st_fg_min').val(datarecord.fg_min);
-   $('#st_fg_max').val(datarecord.fg_max);
-   $('#st_ibu_min').val(datarecord.ibu_min);
-   $('#st_ibu_max').val(datarecord.ibu_max);
-   $('#st_color_min').val(datarecord.color_min);
-   $('#st_color_max').val(datarecord.color_max);
-   $('#st_carb_min').val(datarecord.carb_min);
-   $('#st_carb_min2').val(datarecord.carb_min);
-   $('#st_carb_max').val(datarecord.carb_max);
-   $('#st_carb_max2').val(datarecord.carb_max);
-   $('#st_abv_min').val(datarecord.abv_min);
-   $('#st_abv_max').val(datarecord.abv_max);
-  }
- });
-
  // Equipemnt dropdown list
  $('#equipmentSelect').jqxDropDownList({
   placeHolder: 'Kies apparatuur:',
@@ -4547,248 +4402,6 @@
   }
  });
 
- function saveRecord(goback) {
-  var row = {
-   record: my_record,
-   uuid: dataRecord.uuid,
-   name: $('#name').val(),
-   code: $('#code').val(),
-   birth: $('#birth').val(),
-   stage: dataRecord.stage,
-   notes: $('#notes').val(),
-   log_brew: dataRecord.log_brew,
-   log_fermentation: dataRecord.log_fermentation,
-   log_ispindel: dataRecord.log_ispindel,
-   log_co2pressure: dataRecord.log_co2pressure,
-   inventory_reduced: dataRecord.inventory_reduced,
-   locked: dataRecord.locked,
-   eq_name: $('#eq_name').val(),
-   eq_boil_size: parseFloat($('#eq_boil_size').jqxNumberInput('decimal')),
-   eq_batch_size: parseFloat($('#eq_batch_size').jqxNumberInput('decimal')),
-   eq_tun_volume: parseFloat($('#eq_tun_volume').jqxNumberInput('decimal')),
-   eq_tun_weight: dataRecord.eq_tun_weight,
-   eq_tun_specific_heat: dataRecord.eq_tun_specific_heat,
-   eq_tun_material: dataRecord.eq_tun_material,
-   eq_tun_height: dataRecord.eq_tun_height,
-   eq_top_up_water: parseFloat($('#eq_top_up_water').jqxNumberInput('decimal')),
-   eq_trub_chiller_loss: parseFloat($('#eq_trub_chiller_loss').jqxNumberInput('decimal')),
-   eq_evap_rate: parseFloat($('#eq_evap_rate').jqxNumberInput('decimal')),
-   eq_boil_time: parseFloat($('#eq_boil_time').jqxNumberInput('decimal')),
-   eq_calc_boil_volume: dataRecord.eq_calc_boil_volume,
-   eq_top_up_kettle: parseFloat($('#eq_top_up_kettle').jqxNumberInput('decimal')),
-   eq_hop_utilization: parseFloat($('#eq_hop_utilization').jqxNumberInput('decimal')),
-   eq_notes: $('#eq_notes').val(),
-   eq_lauter_volume: parseFloat($('#eq_lauter_volume').jqxNumberInput('decimal')),
-   eq_lauter_height: dataRecord.eq_lauter_height,
-   eq_lauter_deadspace: parseFloat($('#eq_lauter_deadspace').jqxNumberInput('decimal')),
-   eq_kettle_volume: parseFloat($('#eq_kettle_volume').jqxNumberInput('decimal')),
-   eq_kettle_height: dataRecord.eq_kettle_height,
-   eq_mash_volume: parseFloat($('#eq_mash_volume').jqxNumberInput('decimal')),
-   eq_mash_max: parseFloat($('#eq_mash_max').jqxNumberInput('decimal')),
-   eq_efficiency: parseFloat($('#eq_efficiency').jqxNumberInput('decimal')),
-   brew_date_start: $('#brew_date_start').val(),
-   brew_mash_ph: parseFloat($('#brew_mash_ph').jqxNumberInput('decimal')),
-   brew_mash_sg: parseFloat($('#brew_mash_sg').jqxNumberInput('decimal')),
-   brew_mash_efficiency: parseFloat($('#brew_mash_efficiency').jqxNumberInput('decimal')),
-   brew_sparge_est: parseFloat($('#brew_sparge_est').jqxNumberInput('decimal')),
-   brew_sparge_ph: parseFloat($('#brew_sparge_ph').jqxNumberInput('decimal')),
-   brew_preboil_volume: parseFloat($('#brew_preboil_volume').jqxNumberInput('decimal')),
-   brew_preboil_sg: parseFloat($('#brew_preboil_sg').jqxNumberInput('decimal')),
-   brew_preboil_ph: parseFloat($('#brew_preboil_ph').jqxNumberInput('decimal')),
-   brew_preboil_efficiency: parseFloat($('#brew_preboil_efficiency').jqxNumberInput('decimal')),
-   brew_aboil_volume: parseFloat($('#brew_aboil_volume').jqxNumberInput('decimal')),
-   brew_aboil_sg: parseFloat($('#brew_aboil_sg').jqxNumberInput('decimal')),
-   brew_aboil_ph: parseFloat($('#brew_aboil_ph').jqxNumberInput('decimal')),
-   brew_aboil_efficiency: parseFloat($('#brew_aboil_efficiency').jqxNumberInput('decimal')),
-   brew_cooling_method: $('#brew_cooling_method').val(),
-   brew_cooling_time: parseFloat($('#brew_cooling_time').jqxNumberInput('decimal')),
-   brew_cooling_to: parseFloat($('#brew_cooling_to').jqxNumberInput('decimal')),
-   brew_whirlpool9: parseFloat($('#brew_whirlpool9').jqxNumberInput('decimal')),
-   brew_whirlpool7: parseFloat($('#brew_whirlpool7').jqxNumberInput('decimal')),
-   brew_whirlpool6: parseFloat($('#brew_whirlpool6').jqxNumberInput('decimal')),
-   brew_whirlpool2: parseFloat($('#brew_whirlpool2').jqxNumberInput('decimal')),
-   brew_fermenter_volume: parseFloat($('#brew_fermenter_volume').jqxNumberInput('decimal')),
-   brew_fermenter_extrawater: parseFloat($('#brew_fermenter_extrawater').jqxNumberInput('decimal')),
-   brew_fermenter_tcloss: parseFloat($('#brew_fermenter_tcloss').jqxNumberInput('decimal')),
-   brew_aeration_time: parseFloat($('#brew_aeration_time').jqxNumberInput('decimal')),
-   brew_aeration_speed: parseFloat($('#brew_aeration_speed').jqxNumberInput('decimal')),
-   brew_aeration_type: $('#brew_aeration_type').val(),
-   brew_fermenter_sg: parseFloat($('#brew_fermenter_sg').jqxNumberInput('decimal')),
-   brew_fermenter_ibu: parseFloat($('#brew_fermenter_ibu').jqxNumberInput('decimal')),
-   brew_fermenter_color: parseFloat($('#brew_fermenter_color').jqxNumberInput('decimal')),
-   brew_date_end: $('#brew_date_end').val(),
-   og: dataRecord.og,
-   fg: parseFloat($('#fg').jqxNumberInput('decimal')),
-   primary_start_temp: parseFloat($('#primary_start_temp').jqxNumberInput('decimal')),
-   primary_max_temp: parseFloat($('#primary_max_temp').jqxNumberInput('decimal')),
-   primary_end_temp: parseFloat($('#primary_end_temp').jqxNumberInput('decimal')),
-   primary_end_sg: parseFloat($('#primary_end_sg').jqxNumberInput('decimal')),
-   primary_end_date: $('#primary_end_date').val(),
-   secondary_temp: parseFloat($('#secondary_temp').jqxNumberInput('decimal')),
-   secondary_end_sg: parseFloat($('#secondary_end_sg').jqxNumberInput('decimal')),
-   secondary_end_date: $('#secondary_end_date').val(),
-   tertiary_temp: parseFloat($('#tertiary_temp').jqxNumberInput('decimal')),
-   package_date: $('#package_date').val(),
-   package_volume: parseFloat($('#package_volume').jqxNumberInput('decimal')),
-   package_infuse_amount: parseFloat($('#package_infuse_amount').jqxNumberInput('decimal')),
-   package_infuse_abv: parseFloat($('#package_infuse_abv').jqxNumberInput('decimal')),
-   package_infuse_notes: $('#package_infuse_notes').val(),
-   package_abv: parseFloat($('#package_abv').jqxNumberInput('decimal')),
-   package_ph: parseFloat($('#package_ph').jqxNumberInput('decimal')),
-   bottle_amount: parseFloat($('#bottle_amount').jqxNumberInput('decimal')),
-   bottle_carbonation: parseFloat($('#bottle_carbonation').jqxNumberInput('decimal')),
-   bottle_priming_water: parseFloat($('#bottle_priming_water').jqxNumberInput('decimal')),
-   bottle_priming_amount: parseFloat($('#bottle_priming_amount').jqxNumberInput('decimal')),
-   bottle_carbonation_temp: parseFloat($('#bottle_carbonation_temp').jqxNumberInput('decimal')),
-   keg_amount: parseFloat($('#keg_amount').jqxNumberInput('decimal')),
-   keg_carbonation: parseFloat($('#keg_carbonation').jqxNumberInput('decimal')),
-   keg_priming_water: parseFloat($('#keg_priming_water').jqxNumberInput('decimal')),
-   keg_priming_amount: parseFloat($('#keg_priming_amount').jqxNumberInput('decimal')),
-   keg_carbonation_temp: parseFloat($('#keg_carbonation_temp').jqxNumberInput('decimal')),
-   keg_forced_carb: dataRecord.keg_forced_carb,
-   keg_pressure: parseFloat($('#keg_pressure').jqxNumberInput('decimal')),
-   taste_notes: $('#taste_notes').val(),
-   taste_rate: parseFloat($('#taste_rate').jqxNumberInput('decimal')),
-   taste_date: $('#taste_date').val(),
-   taste_color: $('#taste_color').val(),
-   taste_transparency: $('#taste_transparency').val(),
-   taste_head: $('#taste_head').val(),
-   taste_aroma: $('#taste_aroma').val(),
-   taste_taste: $('#taste_taste').val(),
-   taste_mouthfeel: $('#taste_mouthfeel').val(),
-   taste_aftertaste: $('#taste_aftertaste').val(),
-   st_name: $('#st_name').val(),
-   st_letter: $('#st_letter').val(),
-   st_guide: $('#st_guide').val(),
-   st_type: dataRecord.st_type,
-   st_category: $('#st_category').val(),
-   st_category_number: $('#st_category_number').val(),
-   st_og_min: parseFloat($('#st_og_min').jqxNumberInput('decimal')),
-   st_og_max: parseFloat($('#st_og_max').jqxNumberInput('decimal')),
-   st_fg_min: parseFloat($('#st_fg_min').jqxNumberInput('decimal')),
-   st_fg_max: parseFloat($('#st_fg_max').jqxNumberInput('decimal')),
-   st_ibu_min: parseFloat($('#st_ibu_min').jqxNumberInput('decimal')),
-   st_ibu_max: parseFloat($('#st_ibu_max').jqxNumberInput('decimal')),
-   st_color_min: parseFloat($('#st_color_min').jqxNumberInput('decimal')),
-   st_color_max: parseFloat($('#st_color_max').jqxNumberInput('decimal')),
-   st_carb_min: parseFloat($('#st_carb_min').jqxNumberInput('decimal')),
-   st_carb_max: parseFloat($('#st_carb_max').jqxNumberInput('decimal')),
-   st_abv_min: parseFloat($('#st_abv_min').jqxNumberInput('decimal')),
-   st_abv_max: parseFloat($('#st_abv_max').jqxNumberInput('decimal')),
-   type: $('#type').val(),
-   batch_size: parseFloat($('#batch_size').jqxNumberInput('decimal')),
-   boil_size: parseFloat($('#boil_size').jqxNumberInput('decimal')),
-   boil_time: parseFloat($('#boil_time').jqxNumberInput('decimal')),
-   efficiency: parseFloat($('#efficiency').jqxNumberInput('decimal')),
-   est_og: parseFloat($('#est_og').jqxNumberInput('decimal')),
-   est_og3: parseFloat($('#est_og3').jqxNumberInput('decimal')),
-   est_fg: parseFloat($('#est_fg').jqxNumberInput('decimal')),
-   est_abv: parseFloat($('#est_abv').jqxNumberInput('decimal')),
-   est_color: parseFloat($('#est_color').jqxNumberInput('decimal')),
-   color_method: $('#color_method').val(),
-   est_ibu: parseFloat($('#est_ibu').jqxNumberInput('decimal')),
-   ibu_method: $('#ibu_method').val(),
-   est_carb: parseFloat($('#est_carb').jqxNumberInput('decimal')),
-   mash_name: $('#mash_name').val(),
-   mash_ph: parseFloat($('#mash_ph').jqxNumberInput('decimal')),
-   sparge_temp: parseFloat($('#sparge_temp').jqxNumberInput('decimal')),
-   sparge_ph: parseFloat($('#sparge_ph').jqxNumberInput('decimal')),
-   sparge_volume: parseFloat($('#sparge_volume').jqxNumberInput('decimal')),
-   sparge_source: $('#sparge_source').val(),
-   sparge_acid_type: $('#sparge_acid_type').val(),
-   sparge_acid_perc: parseFloat($('#sparge_acid_perc').jqxNumberInput('decimal')),
-   sparge_acid_amount: dataRecord.sparge_acid_amount,
-   calc_acid: dataRecord.calc_acid,
-   w1_name: $('#w1_name').val(),
-   w1_amount: parseFloat($('#w1_amount').jqxNumberInput('decimal')),
-   w1_calcium: parseFloat($('#w1_calcium').jqxNumberInput('decimal')),
-   w1_sulfate: parseFloat($('#w1_sulfate').jqxNumberInput('decimal')),
-   w1_chloride: parseFloat($('#w1_chloride').jqxNumberInput('decimal')),
-   w1_sodium: parseFloat($('#w1_sodium').jqxNumberInput('decimal')),
-   w1_magnesium: parseFloat($('#w1_magnesium').jqxNumberInput('decimal')),
-   w1_total_alkalinity: parseFloat($('#w1_total_alkalinity').jqxNumberInput('decimal')),
-   w1_ph: parseFloat($('#w1_ph').jqxNumberInput('decimal')),
-   w1_cost: dataRecord.w1_cost,
-   w2_name: $('#w2_name').val(),
-   w2_amount: parseFloat($('#w2_amount').jqxNumberInput('decimal')),
-   w2_calcium: parseFloat($('#w2_calcium').jqxNumberInput('decimal')),
-   w2_sulfate: parseFloat($('#w2_sulfate').jqxNumberInput('decimal')),
-   w2_chloride: parseFloat($('#w2_chloride').jqxNumberInput('decimal')),
-   w2_sodium: parseFloat($('#w2_sodium').jqxNumberInput('decimal')),
-   w2_magnesium: parseFloat($('#w2_magnesium').jqxNumberInput('decimal')),
-   w2_total_alkalinity: parseFloat($('#w2_total_alkalinity').jqxNumberInput('decimal')),
-   w2_ph: parseFloat($('#w2_ph').jqxNumberInput('decimal')),
-   w2_cost: dataRecord.w2_cost,
-   wg_amount: parseFloat($('#wg_amount').jqxNumberInput('decimal')),
-   wg_calcium: parseFloat($('#wg_calcium').jqxNumberInput('decimal')),
-   wg_sulfate: parseFloat($('#wg_sulfate').jqxNumberInput('decimal')),
-   wg_chloride: parseFloat($('#wg_chloride').jqxNumberInput('decimal')),
-   wg_sodium: parseFloat($('#wg_sodium').jqxNumberInput('decimal')),
-   wg_magnesium: parseFloat($('#wg_magnesium').jqxNumberInput('decimal')),
-   wg_total_alkalinity: parseFloat($('#wg_total_alkalinity').jqxNumberInput('decimal')),
-   wg_ph: parseFloat($('#wg_ph').jqxNumberInput('decimal')),
-   wb_calcium: parseFloat($('#wb_calcium').jqxNumberInput('decimal')),
-   wb_sulfate: parseFloat($('#wb_sulfate').jqxNumberInput('decimal')),
-   wb_chloride: parseFloat($('#wb_chloride').jqxNumberInput('decimal')),
-   wb_sodium: parseFloat($('#wb_sodium').jqxNumberInput('decimal')),
-   wb_magnesium: parseFloat($('#wb_magnesium').jqxNumberInput('decimal')),
-   wb_total_alkalinity: parseFloat($('#wb_total_alkalinity').jqxNumberInput('decimal')),
-   wb_ph: parseFloat($('#wb_ph').jqxNumberInput('decimal')),
-   wa_acid_name: parseInt($('#wa_acid_name').val()),
-   wa_acid_perc: parseFloat($('#wa_acid_perc').jqxNumberInput('decimal')),
-   wa_base_name: 0,
-   starter_enable: dataRecord.starter_enable,
-   starter_type: $('#starter_type').val(),
-   starter_sg: parseFloat($('#starter_sg').jqxNumberInput('decimal')),
-   starter_viability: parseFloat($('#starter_viability').jqxNumberInput('decimal')),
-   yeast_prod_date: $('#yeast_prod_date').val(),
-   yeast_pitchrate: parseFloat($('#yeast_pitchrate').jqxNumberInput('decimal')),
-   prop1_type: $('#prop1_type').val(),
-   prop1_volume: parseFloat($('#prop1_volume').jqxNumberInput('decimal')),
-   prop2_type: $('#prop2_type').val(),
-   prop2_volume: parseFloat($('#prop2_volume').jqxNumberInput('decimal')),
-   prop3_type: $('#prop3_type').val(),
-   prop3_volume: parseFloat($('#prop3_volume').jqxNumberInput('decimal')),
-   prop4_type: $('#prop4_type').val(),
-   prop4_volume: parseFloat($('#prop4_volume').jqxNumberInput('decimal')),
-   divide_type: dataRecord.divide_type,
-   divide_size: dataRecord.divide_size,
-   divide_factor: dataRecord.divide_factor,
-   divide_parts: dataRecord.divide_parts,
-   divide_part: dataRecord.divide_part,
-   fermentables: $('#fermentableGrid').jqxGrid('getrows'),
-   hops: $('#hopGrid').jqxGrid('getrows'),
-   miscs: $('#miscGrid').jqxGrid('getrows'),
-   yeasts: $('#yeastGrid').jqxGrid('getrows'),
-   mashs: $('#mashGrid').jqxGrid('getrows')
-  },
-  data = 'update=true&' + $.param(row);
-  $.ajax({
-   dataType: 'json',
-   url: url,
-   cache: false,
-   data: data,
-   async: false,
-   type: 'POST',
-   success: function(data) {
-    if (data.error) {
-     console.log('saveRecord(' + goback + ') error ' + data.msg);
-     alert('SQL fout: ' + data.msg);
-    } else {
-     console.log('saveRecord(' + goback + ') success');
-    }
-    if (goback)
-     window.location.href = my_return;
-    else
-     window.location.href =
-        'prod_export.php?record=' + my_record + '&return=' + my_return + '&select=' + my_select + '&code=' + dataRecord.code + '&name=' + dataRecord.name +
-        '&stage=' + dataRecord.stage + '&split=' + dataRecord.divide_type;
-   },
-   error: function(jqXHR, textStatus, errorThrown) {
-    console.log('saveRecord() ' + textStatus);
-   }
-  });
- };
 
  // initialize the input fields.
  // Tab 1, Algemeen
@@ -4834,62 +4447,21 @@
  $('#name').jqxInput({ theme: theme, width: 640, height: 23 });
  $('#code, #stage').jqxInput({ theme: theme, width: 100, height: 23 });
  $('#locked').jqxCheckBox({ theme: theme, width: 120, height: 23, disabled: true });
- $('#locked').on('checked', function(event) {
-  if (dataRecord.stage >= 10) {
-   dataRecord.locked = 1;
-   dataRecord.stage = 11;
-   calcStage();
-  }
- });
- $('#locked').on('unchecked', function(event) {
-  if (dataRecord.stage >= 10) {
-   dataRecord.locked = 0;
-   dataRecord.stage = 10;
-   calcStage();
-  }
- });
  $('#birth,#divide_batch,#divide_type').jqxInput({ theme: theme, width: 120, height: 23 });
  $('#notes').jqxInput({ theme: theme, width: 960, height: 100 });
- $('#type').jqxDropDownList({
-  theme: theme,
-  source: RecipeTypeAdapter,
-  valueMember: 'id',
-  displayMember: 'nl',
-  width: 180,
-  height: 23,
-  autoDropDownHeight: true
- });
- $('#efficiency').jqxNumberInput(Perc1dec);
- $('#batch_size').jqxNumberInput(Spin1dec);
- $('#batch_size').jqxNumberInput({ min: 4 });
- $('#boil_time').jqxNumberInput(PosInt);
- $('#boil_time').jqxNumberInput({ min: 0, max: 360 });
- $('#boil_size').jqxNumberInput({ inputMode: 'simple', theme: theme, width: 90, height: 23, decimalDigits: 2, readOnly: true });
+ $('#type').jqxInput({ theme: theme, width: 180, height: 23 });
+ $('#efficiency').jqxNumberInput(Show1dec);
+ $('#batch_size').jqxNumberInput(Show1dec);
+ $('#boil_time').jqxNumberInput(Show0dec);
+ $('#boil_size').jqxNumberInput(Show2dec);
  $('#st_guide,#st_name,#st_type,#st_category').jqxInput({ theme: theme, width: 250, height: 23 });
- $('#est_og').jqxNumberInput(SGopts);
+ $('#est_og').jqxNumberInput(Show3dec);
  $('#est_fg').jqxNumberInput(Show3dec);
  $('#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 });
  $('#est_ibu,#est_color').jqxNumberInput(Show0dec);
- $('#color_method').jqxDropDownList({
-  theme: theme,
-  source: ColorMethodAdapter,
-  valueMember: 'id',
-  displayMember: 'nl',
-  width: 180,
-  height: 23,
-  autoDropDownHeight: true
- });
+ $('#color_method').jqxInput({ theme: theme, width: 180, height: 23 });
  $('#st_color_min,#st_color_max,#st_category_number,#st_ibu_min,#st_ibu_max,#kcal').jqxNumberInput(Smal0dec);
- $('#ibu_method').jqxDropDownList({
-  theme: theme,
-  source: IBUmethodAdapter,
-  valueMember: 'id',
-  displayMember: 'nl',
-  width: 180,
-  height: 23,
-  autoDropDownHeight: true,
-  dropDownVerticalAlignment: 'top'
- });
+ $('#ibu_method').jqxInput({ theme: theme, width: 180, height: 23 });
  $('#est_abv,#st_abv_min,#st_abv_max,#est_carb,#st_carb_min,#st_carb_max').jqxNumberInput(Smal1dec);
 
  // Tab 2, Equipment
@@ -6413,37 +5985,11 @@
  });
 
  // Buttons below
- $('#Delete').jqxButton({ template: 'danger', width: '80px', theme: theme });
- $('#Delete').bind('click', function() {
-  // Open a popup to confirm this action.
-  $('#eventWindow').jqxWindow('open');
-  $('#delOk').click(function() {
-   var data = 'delete=true&' + $.param({ uuid: dataRecord.uuid });
-   $.ajax({
-    dataType: 'json',
-    url: url,
-    cache: false,
-    data: data,
-    type: 'POST',
-    success: function(data, status, xhr) {
-     // delete command is executed.
-     window.location.href = my_return;
-    },
-    error: function(jqXHR, textStatus, errorThrown) {
-    }
-   });
-  });
- });
-
- $('#Cancel').jqxButton({ template: 'primary', width: '80px', theme: theme });
- $('#Cancel').bind('click', function() {
+ $('#Terug').jqxButton({ template: 'primary', width: '80px', theme: theme });
+ $('#Terug').bind('click', function() {
   window.location.href = my_return;
  });
 
- $('#Save').jqxButton({ template: 'success', width: '80px', theme: theme });
- $('#Save').bind('click', function() {
-  saveRecord(1);
- });
  createPopupElements();
 });
 

mercurial