Prepared the edit fields for dynamic enable/disable during split batches.

Tue, 27 Oct 2020 19:51:22 +0100

author
Michiel Broek <mbroek@mbse.eu>
date
Tue, 27 Oct 2020 19:51:22 +0100
changeset 723
3a837905bbce
parent 722
c4457e10d968
child 724
66e0b4ef9268

Prepared the edit fields for dynamic enable/disable during split batches.

www/js/prod_edit.js file | annotate | diff | comparison | revisions
--- a/www/js/prod_edit.js	Wed Oct 21 20:54:25 2020 +0200
+++ b/www/js/prod_edit.js	Tue Oct 27 19:51:22 2020 +0100
@@ -2974,11 +2974,6 @@
   return 0;
  }
 
- // mg/l as CaCO3
-// function ResidualAlkalinity(total_alkalinity, calcium, magnesium) {
-//  return total_alkalinity - (calcium / 1.4 + magnesium / 1.7);
-// }
-
  function PartCO3(pH) {
   var H = Math.pow(10, -pH);
   return 100 * Ka1 * Ka2 / (H * H + H * Ka1 + Ka1 * Ka2);
@@ -3229,7 +3224,6 @@
        RA = (parseFloat($('#wa_base').jqxNumberInput('decimal')) * MMHCO3 / MMNaHCO3 * 1000) / liters;
        bicarbonate = wg_bicarbonate + RA;
        total_alkalinity = bicarbonate * 50 / 61;
-//       RA = ResidualAlkalinity(wb_total_alkalinity, wb_calcium, wb_magnesium);
       }
       break;
      case 1:
@@ -3245,7 +3239,6 @@
        RA = (parseFloat($('#wa_base').jqxNumberInput('decimal')) * MMHCO3 / MMNa2CO3 * 1000) / liters;
        bicarbonate = wg_bicarbonate + RA;
        total_alkalinity = bicarbonate * 50 / 61;
-//       RA = ResidualAlkalinity(wb_total_alkalinity, wb_calcium, wb_magnesium);
       }
       break;
      case 2:
@@ -3265,7 +3258,6 @@
              parseFloat($('#wa_caso4').jqxNumberInput('decimal')) * MMCa / MMCaSO4 * 1000 +
              parseFloat($('#wa_base').jqxNumberInput('decimal')) * MMCa / MMCaCO3 * 1000) / liters;
        calcium = wg_calcium + RA;
-//       RA = ResidualAlkalinity(wb_total_alkalinity, wb_calcium, wb_magnesium);
       }
       break;
      case 3:
@@ -3282,7 +3274,6 @@
              parseFloat($('#wa_caso4').jqxNumberInput('decimal')) * MMCa / MMCaSO4 * 1000 +
              parseFloat($('#wa_base').jqxNumberInput('decimal')) * MMCa / MMCaOH2 * 1000) / liters;
        calcium = wg_calcium + RA;
-//       RA = ResidualAlkalinity(wb_total_alkalinity, wb_calcium, wb_magnesium);
       }
       break;
     }
@@ -3305,7 +3296,6 @@
       RA = (parseFloat($('#wa_base').jqxNumberInput('decimal')) * MMHCO3 / MMNaHCO3 * 1000) / liters;
       bicarbonate = wg_bicarbonate + RA;
       total_alkalinity = bicarbonate * 50 / 61;
-//      RA = ResidualAlkalinity(wb_total_alkalinity, wb_calcium, wb_magnesium);
       break;
      case 1: // Sodiumcarbonate
       RA = (parseFloat($('#wa_nacl').jqxNumberInput('decimal')) * MMNa / MMNaCl * 1000 +
@@ -3315,13 +3305,11 @@
       RA = (parseFloat($('#wa_base').jqxNumberInput('decimal')) * MMHCO3 / MMNa2CO3 * 1000) / liters;
       bicarbonate = wg_bicarbonate + RA;
       total_alkalinity = bicarbonate * 50 / 61;
-//      RA = ResidualAlkalinity(wb_total_alkalinity, wb_calcium, wb_magnesium);
       break;
      case 2: // Calciumcarbonate: Bicarbonate
       RA = (parseFloat($('#wa_base').jqxNumberInput('decimal')) / 3 * MMHCO3 * 1000 / MMCaCO3) / liters;
       bicarbonate = wg_bicarbonate + RA;
       total_alkalinity = bicarbonate * 50 / 61;
-//      RA = ResidualAlkalinity(wb_total_alkalinity, wb_calcium, wb_magnesium);
       // Ca
       RA = (parseFloat($('#wa_cacl2').jqxNumberInput('decimal')) * MMCa * 1000 / MMCaCl2 +
             parseFloat($('#wa_caso4').jqxNumberInput('decimal')) * MMCa * 1000 / MMCaSO4 +
@@ -3700,6 +3688,170 @@
   }
  }
 
+ function en_stage_equipment(state) {
+  $('#equipmentSelect').jqxDropDownList({ disabled: (state) ? true:false });
+  $('#Delete').jqxButton({ disabled: (state) ? true:false });
+ }
+
+ function en_stage_brewday(state) {
+  $('#jqxTabs').jqxTabs((state) ? 'disableAt':'enableAt', 8);	// Brewday tab
+ }
+
+ function en_stage_afterbrew(state) {
+
+  var onval = { disabled: (state) ? true:false };
+  var spinstate = { spinButtons: (state) ? false:true, readOnly: (state) ? true:false, width: (state) ? 90:110 };
+  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);
+  $('#w2_amount').jqxNumberInput(onval);
+  $('#pr_name').jqxDropDownList(onval);
+  $('#wa_cacl2').jqxNumberInput(spinstate);
+  $('#wa_caso4').jqxNumberInput(spinstate);
+  $('#wa_mgso4').jqxNumberInput(spinstate);
+  $('#wa_nacl').jqxNumberInput(spinstate);
+  $('#mash_ph').jqxNumberInput(spinstate);
+  $('#calc_acid').jqxCheckBox(onval);
+  $('#wa_base_name').jqxDropDownList(onval);
+  $('#wa_base').jqxNumberInput(spinstate);
+  $('#wa_acid_name').jqxDropDownList(onval);
+  $('#wa_acid').jqxNumberInput(spinstate);
+  $('#wa_acid_perc').jqxNumberInput(spinsmall);
+  $('#sparge_temp').jqxNumberInput(spinstate);
+  $('#sparge_volume').jqxNumberInput(spinstate);
+  $('#sparge_ph').jqxNumberInput(spinstate);
+  $('#sparge_source').jqxDropDownList(onval);
+  $('#sparge_acid_type').jqxDropDownList(onval);
+  $('#sparge_acid_perc').jqxNumberInput(spinstate);
+  $('#starter_type').jqxDropDownList(onval);
+  $('#starter_try').jqxButton(onval);
+  $('#starter_sg').jqxNumberInput(spinstate);
+  $('#yeast_prod_date').jqxDateTimeInput(onval);
+  $('#yeast_pitchrate').jqxNumberInput(spinstate);
+  $('#but_pickpitchrate').jqxButton(onval);
+ }
+
+ function en_stage_afterprimary(istate) {
+
+  var state = istate;
+  var onval = { disabled: (state) ? true:false };
+  var spinstate = { spinButtons: (state) ? false:true, readOnly: (state) ? true:false, width: (state) ? 90:110 };
+
+  $('#brew_date_start').jqxDateTimeInput(onval);
+  $('#brew_date_end').jqxDateTimeInput(onval);
+  $('#brew_mash_ph').jqxNumberInput(spinstate);
+  $('#brew_mash_sg').jqxNumberInput(spinstate);
+  $('#brew_whirlpool9').jqxNumberInput(spinstate);
+  $('#brew_cooling_to').jqxNumberInput(spinstate);
+  $('#brew_whirlpool7').jqxNumberInput(spinstate);
+  $('#brew_cooling_method').jqxDropDownList(onval);
+  $('#brew_whirlpool6').jqxNumberInput(spinstate);
+  $('#brew_cooling_time').jqxNumberInput(spinstate);
+  $('#brew_sparge_ph').jqxNumberInput(spinstate);
+  $('#brew_whirlpool2').jqxNumberInput(spinstate);
+  $('#brew_aeration_type').jqxDropDownList(onval);
+  $('#brew_fermenter_tcloss').jqxNumberInput(spinstate);
+  $('#brew_aeration_time').jqxNumberInput(spinstate);
+  $('#brew_fermenter_extrawater').jqxNumberInput(spinstate);
+  $('#brew_aeration_speed').jqxNumberInput(spinstate);
+
+  if (! state) {
+   state = (dataRecord.boil_time == 0);
+  }
+  onval = { disabled: (state) ? true:false };
+  spinstate = { spinButtons: (state) ? false:true, readOnly: (state) ? true:false, width: (state) ? 90:110 };
+  $('#brew_preboil_ph').jqxNumberInput(spinstate);
+  $('#brew_aboil_ph').jqxNumberInput(spinstate);
+  $('#brew_preboil_sg').jqxNumberInput(spinstate);
+  $('#brew_aboil_sg').jqxNumberInput(spinstate);
+  $('#brew_preboil_volume').jqxNumberInput(spinstate);
+  $('#brew_aboil_volume').jqxNumberInput(spinstate);
+  $('#but_pre_boil').jqxButton(onval);
+  $('#but_after_boil').jqxButton(onval);
+ }
+
+ function en_stage_tertiary(state) {
+  $('#package_date').jqxDateTimeInput({ disabled: (state) ? false:true });
+ }
+
+ function en_stage_aftertertiary(state) {
+
+  var spinstate = { spinButtons: (state) ? false:true, readOnly: (state) ? true:false, width: (state) ? 90:110 };
+
+  $('#primary_start_temp').jqxNumberInput(spinstate);
+  $('#primary_max_temp').jqxNumberInput(spinstate);
+  $('#primary_end_temp').jqxNumberInput(spinstate);
+  $('#primary_end_sg').jqxNumberInput(spinstate);
+  $('#primary_end_brix').jqxNumberInput(spinstate);
+  $('#primary_end_date').jqxDateTimeInput({ disabled: (state) ? true:false });
+ }
+
+ function en_stage_afterpackaging(state) {
+
+  var onval = { disabled: (state) ? true:false };
+  var spinstate = { spinButtons: (state) ? false:true, readOnly: (state) ? true:false, width: (state) ? 90:110 };
+
+  $('#secondary_temp').jqxNumberInput(spinstate);
+  $('#secondary_end_sg').jqxNumberInput(spinstate);
+  $('#secondary_end_date').jqxDateTimeInput(onval);
+  $('#secondary_end_brix').jqxNumberInput(spinstate);
+  $('#tertiary_temp').jqxNumberInput(spinstate);
+  $('#fg').jqxNumberInput(spinstate);
+  $('#final_brix').jqxNumberInput(spinstate);
+  $('#package_date').jqxDateTimeInput(onval);
+  $('#package_volume').jqxNumberInput(spinstate);
+  $('#package_infuse_amount').jqxNumberInput(spinstate);
+  $('#package_infuse_abv').jqxNumberInput(spinstate);
+  $('#package_infuse_notes').jqxInput(onval);
+  $('#package_ph').jqxNumberInput(spinstate);
+  $('#bottle_amount').jqxNumberInput(spinstate);
+  $('#bottle_priming_water').jqxNumberInput(spinstate);
+  $('#keg_priming_water').jqxNumberInput(spinstate);
+  $('#keg_amount').jqxNumberInput(spinstate);
+  $('#bottle_carbonation').jqxNumberInput(spinstate);
+  $('#keg_carbonation').jqxNumberInput(spinstate);
+  $('#bottle_priming_sugar').jqxDropDownList(onval);
+  $('#keg_priming_sugar').jqxDropDownList(onval);
+  $('#keg_forced_carb').jqxCheckBox(onval);
+  $('#bottle_carbonation_temp').jqxNumberInput(spinstate);
+  $('#keg_carbonation_temp').jqxNumberInput(spinstate);
+ }
+
+ function en_stage_b4taste(state) {
+  $('#jqxTabs').jqxTabs((state) ? 'disableAt':'enableAt', 11); // Tasting tab
+ }
+
+ function en_stage_locked(state) {
+
+  var onval = { disabled: (state) ? true:false };
+
+  $('#taste_date').jqxDateTimeInput(onval);
+  $('#taste_rate').jqxNumberInput({ spinButtons: (state) ? false:true, readOnly: (state) ? true:false, width: (state) ? 90:110 });
+  $('#taste_color').jqxInput(onval);
+  $('#taste_transparency').jqxInput(onval);
+  $('#taste_head').jqxInput(onval);
+  $('#taste_aroma').jqxInput(onval);
+  $('#taste_taste').jqxInput(onval);
+  $('#taste_aftertaste').jqxInput(onval);
+  $('#taste_mouthfeel').jqxInput(onval);
+  $('#taste_notes').jqxInput(onval);
+  $('#notes').jqxInput(onval);
+ }
+
  function calcStage() {
 
   var newstage = dataRecord.stage, d, date1, date2, date1_unixtime, date2_unixtime, timeDifference, timeDifferenceInDays;
@@ -3757,167 +3909,17 @@
   }
 
   /*
-   * When the brew is in progress or done, block equipment select and delete.
+   * Enable or disable parts of the screens.
    */
-  if (dataRecord.stage > 1) {
-   $('#equipmentSelect').jqxDropDownList({ disabled: true });
-   $('#Delete').jqxButton({ disabled: true });
-  }
-
-  if (dataRecord.stage < 1)       // Planning, no ingredients
-   $('#jqxTabs').jqxTabs('disableAt', 8);  // Brewday tab
-  else
-   $('#jqxTabs').jqxTabs('enableAt', 8);
-
-  if (dataRecord.stage < 3) {     // Primary
-   $('#jqxTabs').jqxTabs('disableAt', 9);  // Fermentation tab
-  } else {
-   $('#jqxTabs').jqxTabs('enableAt', 9);
-   $('#name').jqxInput({ disabled: true });
-   $('#code').jqxInput({ disabled: true });
-   $('#batch_size').jqxNumberInput({ spinButtons: false, readOnly: true, width: 90 });
-   $('#boil_size').jqxNumberInput({ spinButtons: false, readOnly: true, width: 90 });
-   $('#boil_time').jqxNumberInput({ spinButtons: false, readOnly: true, width: 90 });
-   $('#efficiency').jqxNumberInput({ spinButtons: false, readOnly: true, width: 90 });
-   $('#est_og').jqxNumberInput({ spinButtons: false, readOnly: true, width: 90 });
-   $('#type').jqxDropDownList({ disabled: true });
-   $('#styleSelect').jqxDropDownList({ disabled: true });
-   $('#color_method').jqxDropDownList({ disabled: true });
-   $('#ibu_method').jqxDropDownList({ disabled: true });
-   $('#mash_select').jqxDropDownList({ disabled: true });
-   $('#w1_name').jqxDropDownList({ disabled: true });
-   $('#w2_name').jqxDropDownList({ disabled: true });
-   $('#w2_amount').jqxNumberInput({ readOnly: true });
-   $('#pr_name').jqxDropDownList({ disabled: true });
-   $('#wa_cacl2').jqxNumberInput({ spinButtons: false, readOnly: true, width: 90 });
-   $('#wa_caso4').jqxNumberInput({ spinButtons: false, readOnly: true, width: 90 });
-   $('#wa_mgso4').jqxNumberInput({ spinButtons: false, readOnly: true, width: 90 });
-   $('#wa_nacl').jqxNumberInput({ spinButtons: false, readOnly: true, width: 90 });
-   $('#mash_ph').jqxNumberInput({ spinButtons: false, readOnly: true, width: 90 });
-   $('#calc_acid').jqxCheckBox({ disabled: true });
-   $('#wa_base_name').jqxDropDownList({ disabled: true });
-   $('#wa_base').jqxNumberInput({ spinButtons: false, readOnly: true, width: 90 });
-   $('#wa_acid_name').jqxDropDownList({ disabled: true });
-   $('#wa_acid').jqxNumberInput({ spinButtons: false, readOnly: true, width: 90 });
-   $('#wa_acid_perc').jqxNumberInput({ spinButtons: false, readOnly: true, width: 70 });
-   $('#sparge_temp').jqxNumberInput({ spinButtons: false, readOnly: true, width: 90 });
-   $('#sparge_volume').jqxNumberInput({ spinButtons: false, readOnly: true, width: 90 });
-   $('#sparge_ph').jqxNumberInput({ spinButtons: false, readOnly: true, width: 90 });
-   $('#sparge_source').jqxDropDownList({ disabled: true });
-   $('#sparge_acid_type').jqxDropDownList({ disabled: true });
-   $('#sparge_acid_perc').jqxNumberInput({ spinButtons: false, readOnly: true, width: false });
-   $('#starter_type').jqxDropDownList({ disabled: true });
-   $('#starter_try').jqxButton({ disabled: true });
-   $('#starter_sg').jqxNumberInput({ spinButtons: false, readOnly: true, width: 90 });
-   $('#yeast_prod_date').jqxDateTimeInput({ disabled: true });
-   $('#yeast_pitchrate').jqxNumberInput({ spinButtons: false, readOnly: true, width: 90 });
-   $('#but_pickpitchrate').jqxButton({ disabled: true });
-  }
-  if (dataRecord.stage > 3) { // Primary fermentation done
-   $('#brew_date_start').jqxDateTimeInput({ disabled: true });
-   $('#brew_date_end').jqxDateTimeInput({ disabled: true });
-   $('#brew_mash_ph').jqxNumberInput({ spinButtons: false, readOnly: true, width: 90 });
-   $('#brew_preboil_ph').jqxNumberInput({ spinButtons: false, readOnly: true, width: 90 });
-   $('#brew_aboil_ph').jqxNumberInput({ spinButtons: false, readOnly: true, width: 90 });
-   $('#brew_mash_sg').jqxNumberInput({ spinButtons: false, readOnly: true, width: 90 });
-   $('#brew_preboil_sg').jqxNumberInput({ spinButtons: false, readOnly: true, width: 90 });
-   $('#brew_aboil_sg').jqxNumberInput({ spinButtons: false, readOnly: true, width: 90 });
-   $('#brew_preboil_volume').jqxNumberInput({ spinButtons: false, readOnly: true, width: 90 });
-   $('#brew_aboil_volume').jqxNumberInput({ spinButtons: false, readOnly: true, width: 90 });
-   $('#brew_whirlpool9').jqxNumberInput({ spinButtons: false, readOnly: true, width: 90 });
-   $('#brew_cooling_to').jqxNumberInput({ spinButtons: false, readOnly: true, width: 90 });
-   $('#brew_whirlpool7').jqxNumberInput({ spinButtons: false, readOnly: true, width: 90 });
-   $('#brew_cooling_method').jqxDropDownList({ disabled: true });
-   $('#brew_whirlpool6').jqxNumberInput({ spinButtons: false, readOnly: true, width: 90 });
-   $('#brew_cooling_time').jqxNumberInput({ spinButtons: false, readOnly: true, width: 90 });
-   $('#brew_sparge_ph').jqxNumberInput({ spinButtons: false, readOnly: true, width: 90 });
-   $('#brew_whirlpool2').jqxNumberInput({ spinButtons: false, readOnly: true, width: 90 });
-   $('#brew_aeration_type').jqxDropDownList({ disabled: true });
-   $('#brew_fermenter_tcloss').jqxNumberInput({ spinButtons: false, readOnly: true, width: 90 });
-   $('#brew_aeration_time').jqxNumberInput({ spinButtons: false, readOnly: true, width: 90 });
-   $('#brew_fermenter_extrawater').jqxNumberInput({ spinButtons: false, readOnly: true, width: 90 });
-   $('#brew_aeration_speed').jqxNumberInput({ spinButtons: false, readOnly: true, width: 90 });
-   $('#but_pre_boil').jqxButton({ disabled: true });
-   $('#but_after_boil').jqxButton({ disabled: true });
-  } else {
-   if (dataRecord.boil_time == 0) {
-    $('#brew_preboil_ph').jqxNumberInput({ spinButtons: false, readOnly: true, width: 90 });
-    $('#brew_aboil_ph').jqxNumberInput({ spinButtons: false, readOnly: true, width: 90 });
-    $('#brew_preboil_sg').jqxNumberInput({ spinButtons: false, readOnly: true, width: 90 });
-    $('#brew_aboil_sg').jqxNumberInput({ spinButtons: false, readOnly: true, width: 90 });
-    $('#brew_preboil_volume').jqxNumberInput({ spinButtons: false, readOnly: true, width: 90 });
-    $('#brew_aboil_volume').jqxNumberInput({ spinButtons: false, readOnly: true, width: 90 });
-    $('#but_pre_boil').jqxButton({ disabled: true });
-    $('#but_after_boil').jqxButton({ disabled: true });
-   } else {
-    $('#brew_preboil_ph').jqxNumberInput({ spinButtons: true, readOnly: false, width: 110 });
-    $('#brew_aboil_ph').jqxNumberInput({ spinButtons: true, readOnly: false, width: 110 });
-    $('#brew_preboil_sg').jqxNumberInput({ spinButtons: true, readOnly: false, width: 110 });
-    $('#brew_aboil_sg').jqxNumberInput({ spinButtons: true, readOnly: false, width: 110 });
-    $('#brew_preboil_volume').jqxNumberInput({ spinButtons: true, readOnly: false, width: 110 });
-    $('#brew_aboil_volume').jqxNumberInput({ spinButtons: true, readOnly: false, width: 110 });
-    $('#but_pre_boil').jqxButton({ disabled: false });
-    $('#but_after_boil').jqxButton({ disabled: false });
-   }
-  }
-  if (dataRecord.stage == 5) // Lagering, allow packaging
-   $('#package_date').jqxDateTimeInput({ disabled: false });
-  else
-   $('#package_date').jqxDateTimeInput({ disabled: true });
-  if (dataRecord.stage >= 5) { // At least secondary
-   $('#primary_start_temp').jqxNumberInput({ spinButtons: false, readOnly: true, width: 90 });
-   $('#primary_max_temp').jqxNumberInput({ spinButtons: false, readOnly: true, width: 90 });
-   $('#primary_end_temp').jqxNumberInput({ spinButtons: false, readOnly: true, width: 90 });
-   $('#primary_end_sg').jqxNumberInput({ spinButtons: false, readOnly: true, width: 90 });
-   $('#primary_end_brix').jqxNumberInput({ spinButtons: false, readOnly: true, width: 90 });
-   $('#primary_end_date').jqxDateTimeInput({ disabled: true });
-  }
-  if (dataRecord.stage >= 6) {    // Packaged
-   $('#secondary_temp').jqxNumberInput({ spinButtons: false, readOnly: true, width: 90 });
-   $('#secondary_end_sg').jqxNumberInput({ spinButtons: false, readOnly: true, width: 90 });
-   $('#secondary_end_date').jqxDateTimeInput({ disabled: true });
-   $('#tertiary_temp').jqxNumberInput({ spinButtons: false, readOnly: true, width: 90 });
-   $('#fg').jqxNumberInput({ spinButtons: false, readOnly: true, width: 90 });
-   $('#final_brix').jqxNumberInput({ spinButtons: false, readOnly: true, width: 90 });
-   $('#package_date').jqxDateTimeInput({ disabled: true });
-   $('#package_volume').jqxNumberInput({ spinButtons: false, readOnly: true, width: 90 });
-   $('#package_infuse_amount').jqxNumberInput({ spinButtons: false, readOnly: true, width: 90 });
-   $('#package_infuse_abv').jqxNumberInput({ spinButtons: false, readOnly: true, width: 90 });
-   $('#package_infuse_notes').jqxInput({ disabled: true });
-   $('#package_ph').jqxNumberInput({ spinButtons: false, readOnly: true, width: 90 });
-   $('#bottle_amount').jqxNumberInput({ spinButtons: false, readOnly: true, width: 90 });
-   $('#bottle_priming_water').jqxNumberInput({ spinButtons: false, readOnly: true, width: 90 });
-   $('#keg_priming_water').jqxNumberInput({ spinButtons: false, readOnly: true, width: 90 });
-   $('#keg_amount').jqxNumberInput({ spinButtons: false, readOnly: true, width: 90 });
-   $('#bottle_carbonation').jqxNumberInput({ spinButtons: false, readOnly: true, width: 90 });
-   $('#keg_carbonation').jqxNumberInput({ spinButtons: false, readOnly: true, width: 90 });
-   $('#bottle_priming_sugar').jqxDropDownList({ disabled: true });
-   $('#keg_priming_sugar').jqxDropDownList({ disabled: true });
-   $('#keg_forced_carb').jqxCheckBox({ disabled: true });
-   $('#bottle_carbonation_temp').jqxNumberInput({ spinButtons: false, readOnly: true, width: 90 });
-   $('#keg_carbonation_temp').jqxNumberInput({ spinButtons: false, readOnly: true, width: 90 });
-  }
-  if (dataRecord.stage < 8) { // Taste when at least Mature.
-   $('#jqxTabs').jqxTabs('disableAt', 11); // Tasting tab
-  } else {
-   $('#jqxTabs').jqxTabs('enableAt', 11);
-  }
-
-  if (dataRecord.stage == 11) { // Locked
-   $('#taste_date').jqxDateTimeInput({ disabled: true });
-   $('#taste_rate').jqxNumberInput({ spinButtons: false, readOnly: true, width: 90 });
-   $('#taste_color').jqxInput({ disabled: true });
-   $('#taste_transparency').jqxInput({ disabled: true });
-   $('#taste_head').jqxInput({ disabled: true });
-   $('#taste_aroma').jqxInput({ disabled: true });
-   $('#taste_taste').jqxInput({ disabled: true });
-   $('#taste_aftertaste').jqxInput({ disabled: true });
-   $('#taste_mouthfeel').jqxInput({ disabled: true });
-   $('#taste_notes').jqxInput({ disabled: true });
-   $('#notes').jqxInput({ disabled: true });
-  } else {
-   $('#notes').jqxInput({ disabled: false });
-  }
+  en_stage_equipment(dataRecord.stage > 1);		// When the brew is in progress or done
+  en_stage_brewday(dataRecord.stage < 1);		// Planning, no ingredients
+  en_stage_afterbrew(dataRecord.stage > 2);		// After the brew
+  en_stage_afterprimary(dataRecord.stage > 3);		// Primary fermentation done
+  en_stage_tertiary(dataRecord.stage == 5);		// Tertiary, allow packaging
+  en_stage_aftertertiary(dataRecord.stage >= 5);	// After all fermentation steps
+  en_stage_afterpackaging(dataRecord.stage >= 6);	// After packaging
+  en_stage_b4taste(dataRecord.stage < 9);		// Taste when at least Mature.
+  en_stage_locked(dataRecord.stage == 11);		// Locked.
  }
 
  function showStarter() {

mercurial