diff -r 635033a29c48 -r dabcd35f8f92 www/js/prod_new.js
--- a/www/js/prod_new.js Thu Jan 03 14:21:35 2019 +0100
+++ b/www/js/prod_new.js Thu Jan 03 20:56:47 2019 +0100
@@ -24,13 +24,179 @@
$(document).ready(function () {
// tooltips
- $("#name").jqxTooltip({ content: 'De naam voor dit recept.' });
- $("#notes").jqxTooltip({ content: 'De uitgebreide opmerkingen over dit recept.' });
+ $("#name").jqxTooltip({ content: 'De naam voor dit brouw project.' });
+ $("#code").jqxTooltip({ content: 'Het unieke code nummer van dit brouw project.' });
+ $("#notes").jqxTooltip({ content: 'De uitgebreide opmerkingen over dit project.' });
+ $("#type").jqxTooltip({ content: 'Het brouw type van bier in dit brouw project.' });
// editers
var srcType = [ "All Grain", "Partial Mash", "Extract" ];
$("#name").jqxInput({ theme: theme, width: 640, height: 23 });
+ $("#code").jqxInput({ theme: theme, width: 100, height: 23 });
$("#notes").jqxInput({ theme: theme, width: 960, height: 200 });
+ $("#type").jqxDropDownList({ theme: theme, source: srcType, width: 125, height: 23, dropDownHeight: 95 });
+
+ $("#st_name").jqxInput({ theme: theme, width: 250, height: 23 });
+ $("#st_category").jqxInput({ theme: theme, width: 250, height: 23 });
+ $("#st_category_number").jqxInput({ theme: theme, width: 70, height: 23 });
+ $("#st_letter").jqxInput({ theme: theme, width: 250, height: 23 });
+ $("#st_guide").jqxInput({ theme: theme, width: 250, height: 23 });
+ $("#st_notes").jqxInput({ theme: theme, width: 800, height: 100 });
+ $("#st_type").jqxInput({ theme: theme, width: 90, height: 23 });
+ $("#st_og_min").jqxNumberInput({ inputMode: 'simple', theme: theme, width: 50, height: 23, decimalDigits: 3, readOnly: true });
+ $("#st_og_max").jqxNumberInput({ inputMode: 'simple', theme: theme, width: 50, height: 23, decimalDigits: 3, readOnly: true });
+ $("#st_fg_min").jqxNumberInput({ inputMode: 'simple', theme: theme, width: 50, height: 23, decimalDigits: 3, readOnly: true });
+ $("#st_fg_max").jqxNumberInput({ inputMode: 'simple', theme: theme, width: 50, height: 23, decimalDigits: 3, readOnly: true });
+ $("#st_ibu_min").jqxNumberInput({ inputMode: 'simple', theme: theme, width: 50, height: 23, decimalDigits: 0, readOnly: true });
+ $("#st_ibu_max").jqxNumberInput({ inputMode: 'simple', theme: theme, width: 50, height: 23, decimalDigits: 0, readOnly: true });
+ $("#st_color_min").jqxNumberInput({ inputMode: 'simple', theme: theme, width: 50, height: 23, decimalDigits: 0, readOnly: true });
+ $("#st_color_max").jqxNumberInput({ inputMode: 'simple', theme: theme, width: 50, height: 23, decimalDigits: 0, readOnly: true });
+ $("#st_carb_min").jqxNumberInput({ inputMode: 'simple', theme: theme, width: 50, height: 23, decimalDigits: 1, readOnly: true });
+ $("#st_carb_max").jqxNumberInput({ inputMode: 'simple', theme: theme, width: 50, height: 23, decimalDigits: 1, readOnly: true });
+ $("#st_abv_min").jqxNumberInput({ inputMode: 'simple', theme: theme, width: 50, height: 23, decimalDigits: 1, readOnly: true });
+ $("#st_abv_max").jqxNumberInput({ inputMode: 'simple', theme: theme, width: 50, height: 23, decimalDigits: 1, readOnly: true });
+ $("#st_profile").jqxInput({ theme: theme, width: 800, height: 48 });
+ $("#st_ingredients").jqxInput({ theme: theme, width: 800, height: 23 });
+ $("#st_examples").jqxInput({ theme: theme, width: 800, height: 48 });
+
+ $("#eq_name").jqxTooltip({ content: 'De naam van deze brouw apparatuur.' });
+ $("#eq_name").jqxInput({ theme: theme, width: 250, height: 23 });
+ $("#eq_calc_boil_volume").jqxCheckBox({ theme: theme, width: 120, height: 23, disabled: true });
+ $("#eq_boil_size").jqxTooltip({ content: 'Normaal kook volume in liters' });
+ $("#eq_boil_size").jqxNumberInput({ inputMode: 'simple', readOnly: true, theme: theme, width: 70, height: 23, decimalDigits: 1 });
+ $("#eq_batch_size").jqxTooltip({ content: 'Berekende batch grootte in liters aan het eind van de kook.' });
+ $("#eq_batch_size").jqxNumberInput({ inputMode: 'simple', readOnly: true, theme: theme, width: 70, height: 23, decimalDigits: 1 });
+ $("#eq_tun_volume").jqxTooltip({ content: 'Maisch ketel volume.' });
+ $("#eq_tun_volume").jqxNumberInput({ inputMode: 'simple', readOnly: true, theme: theme, width: 70, height: 23, decimalDigits: 1 });
+ $("#eq_tun_weight").jqxTooltip({ content: 'Maisch ketel gewicht.' });
+ $("#eq_tun_weight").jqxNumberInput({ inputMode: 'simple', readOnly: true, theme: theme, width: 70, height: 23, decimalDigits: 1 });
+ $("#eq_tun_height").jqxTooltip({ content: 'Maisch ketel hoogte.' });
+ $("#eq_tun_height").jqxNumberInput({ inputMode: 'simple', readOnly: true, theme: theme, width: 70, height: 23, decimalDigits: 1 });
+ $("#eq_tun_material").jqxTooltip({ content: 'Maisch ketel materiaal.' });
+ $("#eq_tun_material").jqxInput({ theme: theme, width: 120, height: 23 });
+ $("#eq_tun_specific_heat").jqxTooltip({ content: 'Maisch ketel warmte geleiding.' });
+ $("#eq_tun_specific_heat").jqxNumberInput({ inputMode: 'simple', readOnly: true, theme: theme, width: 70, height: 23, decimalDigits: 1 });
+ $("#eq_top_up_water").jqxTooltip({ content: 'Extra water in het gistvat.' });
+ $("#eq_top_up_water").jqxNumberInput({ inputMode: 'simple', readOnly: true, theme: theme, width: 70, height: 23, decimalDigits: 1 });
+ $("#eq_trub_chiller_loss").jqxTooltip({ content: 'Standaard verlies bij het overbrengen naar het gistvat.' });
+ $("#eq_trub_chiller_loss").jqxNumberInput({ inputMode: 'simple', readOnly: true, theme: theme, width: 70, height: 23, decimalDigits: 1 });
+ $("#eq_evap_rate").jqxTooltip({ content: 'Verdamping in liters per uur.' });
+ $("#eq_evap_rate").jqxNumberInput({ inputMode: 'simple', readOnly: true, theme: theme, width: 70, height: 23, decimalDigits: 2, });
+ $("#eq_boil_time").jqxTooltip({ content: 'Normale kooktijd in minuten.' });
+ $("#eq_boil_time").jqxNumberInput({ inputMode: 'simple', readOnly: true, theme: theme, width: 70, height: 23, decimalDigits: 0 });
+ $("#eq_top_up_kettle").jqxTooltip({ content: 'Extra water toevoegen tijdens de kook.' });
+ $("#eq_top_up_kettle").jqxNumberInput({ inputMode: 'simple', readOnly: true, theme: theme, width: 70, height: 23, decimalDigits: 1 });
+ $("#eq_hop_utilization").jqxTooltip({ content: '100% voor kleine installaties, hoger voor grote brouwerijen.' });
+ $("#eq_hop_utilization").jqxNumberInput({ inputMode: 'simple', readOnly: true, theme: theme, width: 70, height: 23, decimalDigits: 0 });
+ $("#eq_notes").jqxTooltip({ content: 'Opmerkingen over deze apparatuur.' });
+ $("#eq_notes").jqxInput({ theme: theme, width: 960, height: 100 });
+ $("#eq_lauter_volume").jqxTooltip({ content: 'Filterkuip volume.' });
+ $("#eq_lauter_volume").jqxNumberInput({ inputMode: 'simple', readOnly: true, theme: theme, width: 70, height: 23, decimalDigits: 1 });
+ $("#eq_lauter_height").jqxTooltip({ content: 'Filterkuip hoogte.' });
+ $("#eq_lauter_height").jqxNumberInput({ inputMode: 'simple', readOnly: true, theme: theme, width: 70, height: 23, decimalDigits: 1 });
+ $("#eq_lauter_deadspace").jqxTooltip({ content: 'Filterkuip verlies in liters.' });
+ $("#eq_lauter_deadspace").jqxNumberInput({ inputMode: 'simple', readOnly: true, theme: theme, width: 70, height: 23, decimalDigits: 1 });
+ $("#eq_kettle_volume").jqxTooltip({ content: 'Kook ketel volume in liters.' });
+ $("#eq_kettle_volume").jqxNumberInput({ inputMode: 'simple', readOnly: true, theme: theme, width: 70, height: 23, decimalDigits: 1 });
+ $("#eq_kettle_height").jqxTooltip({ content: 'Kook ketel hoogte in cm.' });
+ $("#eq_kettle_height").jqxNumberInput({ inputMode: 'simple', readOnly: true, theme: theme, width: 70, height: 23, decimalDigits: 1 });
+ $("#eq_mash_volume").jqxTooltip({ content: 'Maisch water voor de eerste stap.' });
+ $("#eq_mash_volume").jqxNumberInput({ inputMode: 'simple', readOnly: true, theme: theme, width: 70, height: 23, decimalDigits: 1 });
+ $("#eq_mash_max").jqxTooltip({ content: 'De maximale moutstort in Kg.' });
+ $("#eq_mash_max").jqxNumberInput({ inputMode: 'simple', readOnly: true, theme: theme, width: 70, height: 23, decimalDigits: 1 });
+ $("#eq_efficiency").jqxTooltip({ content: 'Gemiddeld brouwzaal rendement.' });
+ $("#eq_efficiency").jqxNumberInput({ inputMode: 'simple', readOnly: true, theme: theme, width: 70, height: 23, decimalDigits: 1 });
+
+ // Default values
+ $("#type").val('All Grain');
+
+ $("#styleSelect").jqxDropDownList({
+ placeHolder: "Kies bierstijl:",
+ theme: theme,
+ source: styleslist,
+ displayMember: "name",
+ width: 150,
+ height: 27,
+ dropDownWidth: 500,
+ dropDownHeight: 500,
+ 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 index = event.args.index;
+ var 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(datarecord.type);
+ $("#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_max").val(datarecord.carb_max);
+ $("#st_abv_min").val(datarecord.abv_min);
+ $("#st_abv_max").val(datarecord.abv_max);
+ $("#st_notes").val(datarecord.notes);
+ $("#st_profile").val(datarecord.profile);
+ $("#st_ingredients").val(datarecord.ingredients);
+ $("#st_examples").val(datarecord.examples);
+ }
+ });
+
+ // Equipemnt dropdown list
+ $("#equipmentSelect").jqxDropDownList({
+ placeHolder: "Kies apparatuur:",
+ theme: theme,
+ source: equipmentlist,
+ displayMember: "name",
+ width: 150,
+ height: 27,
+ dropDownWidth: 300,
+ renderer: function (index, label, value) {
+ var datarecord = equipmentlist.records[index];
+ return datarecord.batch_size + " liter " + datarecord.name;
+ }
+ });
+ $("#equipmentSelect").on('select', function (event) {
+ if (event.args) {
+ var index = event.args.index;
+ var datarecord = equipmentlist.records[index];
+ $("#eq_name").val(datarecord.name);
+ $("#eq_boil_size").val(datarecord.boil_size);
+ $("#eq_batch_size").val(datarecord.batch_size);
+ $("#eq_tun_volume").val(datarecord.tun_volume);
+ $("#eq_tun_weight").val(datarecord.tun_weight);
+ $("#eq_tun_specific_heat").val(datarecord.tun_specific_heat);
+ $("#eq_tun_material").val(datarecord.tun_material);
+ $("#eq_tun_height").val(datarecord.tun_height);
+ $("#eq_top_up_water").val(datarecord.top_up_water);
+ $("#eq_trub_chiller_loss").val(datarecord.trub_chiller_loss);
+ $("#eq_evap_rate").val(datarecord.evap_rate);
+ $("#eq_boil_time").val(datarecord.boil_time);
+ $("#eq_calc_boil_volume").val(datarecord.calc_boil_volume);
+ $("#eq_top_up_kettle").val(datarecord.top_up_kettle);
+ $("#eq_hop_utilization").val(datarecord.hop_utilization);
+ $("#eq_notes").val(datarecord.notes);
+ $("#eq_lauter_volume").val(datarecord.lauter_volume);
+ $("#eq_lauter_height").val(datarecord.lauter_height);
+ $("#eq_lauter_deadspace").val(datarecord.lauter_deadspace);
+ $("#eq_kettle_volume").val(datarecord.kettle_volume);
+ $("#eq_kettle_height").val(datarecord.kettle_height);
+ $("#eq_mash_volume").val(datarecord.mash_volume);
+ $("#eq_mash_max").val(datarecord.mash_max);
+ $("#eq_efficiency").val(datarecord.efficiency);
+ }
+ });
//Creating wizard module
var wizard = (function () {
@@ -38,13 +204,25 @@
//Adding event listeners
var _addHandlers = function () {
$('#name').on('change', function (event) { wizard.validate(true); });
+ $('#code').on('change', function (event) { wizard.validate(true); });
+ $('#type').on('change', function (event) { wizard.validate(true); });
+ $('#styleSelect').on('change', function (event) { wizard.validate(true); });
+ $('#equipmentSelect').on('change', function (event) { wizard.validate(true); });
$('#nextButtonCompleted').click(function () {
- console.log("insert start");
+ var d = new Date();
+ var m = d.getMonth() + 1;
+ var b = d.getFullYear() + '-';
+ if (m < 10)
+ b = b + '0';
+ b = b + m + '-';
+ if (d.getDate() < 10)
+ b = b + '0';
+ b = b + d.getDate();
var newrow = {
record: -1,
name: $("#name").val(),
code: $("#code").val(),
- birth: $("#birth").val(),
+ birth: b,
stage: 'Plan',
notes: $("#notes").val(),
log_brew: false,
@@ -55,36 +233,36 @@
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_tun_weight: parseFloat($("#eq_tun_weight").jqxNumberInput('decimal')),
+ eq_tun_specific_heat: parseFloat($("#eq_tun_specific_heat").jqxNumberInput('decimal')),
+ eq_tun_material: $("#eq_tun_material").val(),
+ eq_tun_height: parseFloat($("#eq_tun_height").jqxNumberInput('decimal')),
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_calc_boil_volume: $("#eq_calc_boil_volume").val(),
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_height: parseFloat($("#eq_lauter_height").jqxNumberInput('decimal')),
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_kettle_height: parseFloat($("#eq_kettle_height").jqxNumberInput('decimal')),
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_mash_ph: 0.0,
brew_mash_sg: 1.000,
- brew_sparge_temperature: 85,
- brew_sparge_volume: parseFloat($("#eq_mash_volume").jqxNumberInput('decimal')),
+ brew_sparge_temperature: 0,
+ brew_sparge_volume: 0,
brew_sparge_ph: 0.0,
- brew_preboil_volume: parseFloat($("#eq_boil_size").jqxNumberInput('decimal')),
+ brew_preboil_volume: 0,
brew_preboil_sg: 1.000,
brew_preboil_ph: 0.0,
- brew_aboil_volume: parseFloat($("#eq_boil_size").jqxNumberInput('decimal')) * 0.9,
+ brew_aboil_volume: 0,
brew_aboil_sg: 1.000,
brew_aboil_ph: 0.0,
brew_aboil_efficiency: 0,
@@ -95,7 +273,7 @@
brew_whirlpool7: 0,
brew_whirlpool6: 0,
brew_whirlpool2: 0,
- brew_fermenter_volume: parseFloat($("#eq_batch_size").jqxNumberInput('decimal')),
+ brew_fermenter_volume: 0,
brew_fermenter_extrawater: 0,
brew_aeration_time: 0,
brew_aeration_speed: 0,
@@ -156,11 +334,12 @@
st_abv_min: parseFloat($("#st_abv_min").jqxNumberInput('decimal')),
st_abv_max: parseFloat($("#st_abv_max").jqxNumberInput('decimal')),
type: $("#type").val(),
- batch_size: 20.0,
- boil_time: parseFloat($("#boil_time").jqxNumberInput('decimal')),
- efficiency: parseFloat($("#efficiency").jqxNumberInput('decimal')),
- est_og: parseFloat($("#est_og").jqxNumberInput('decimal')),
- est_fg: 1.000,
+ batch_size: parseFloat($("#eq_batch_size").jqxNumberInput('decimal')),
+ boil_size: parseFloat($("#eq_boil_size").jqxNumberInput('decimal')),
+ boil_time: parseFloat($("#eq_boil_time").jqxNumberInput('decimal')),
+ efficiency: parseFloat($("#eq_efficiency").jqxNumberInput('decimal')),
+ est_og: 0.000,
+ est_fg: 0.000,
est_color: 0,
est_abv: 0.0,
est_carb: 0.0,
@@ -169,7 +348,14 @@
ibu_method: "Tinseth",
mash_name: "",
mash_ph: 5.4,
- mash_sparge_temp: 78.0
+ sparge_temp: 78.0,
+ sparge_volume: parseFloat($("#eq_boil_size").jqxNumberInput('decimal')) / 2,
+ sparge_ph: 5.8,
+ sparge_source: 'Bron 1',
+ sparge_acid_type: 'Melkzuur',
+ sparge_acid_perc: 80,
+ sparge_acid_amount: 0,
+ calc_acid: true
};
var data = "insert=true&return=" + my_return + "&" + $.param(newrow);
$.ajax({
@@ -210,6 +396,8 @@
$('#nextButtonBase').jqxButton({ theme: theme, width: 150 });
$('#nextButtonStyle').jqxButton({ theme: theme, width: 150});
$('#backButtonStyle').jqxButton({ theme: theme, width: 150});
+ $('#nextButtonEq').jqxButton({ theme: theme, width: 150});
+ $('#backButtonEq').jqxButton({ theme: theme, width: 150});
$('#nextButtonCompleted').jqxButton({ theme: theme, width: 150});
$('#backButtonCompleted').jqxButton({ theme: theme, width: 150});
_addHandlers();
@@ -222,16 +410,24 @@
if (!this.firstTab(notify)) {
$('#jqxTabs').jqxTabs('disableAt', 1);
$('#jqxTabs').jqxTabs('disableAt', 2);
+ $('#jqxTabs').jqxTabs('disableAt', 3);
return;
} else {
$('#jqxTabs').jqxTabs('enableAt', 1);
}
if (!this.secondTab(notify)) {
$('#jqxTabs').jqxTabs('disableAt', 2);
+ $('#jqxTabs').jqxTabs('disableAt', 3);
return;
} else {
$('#jqxTabs').jqxTabs('enableAt', 2);
}
+ if (!this.thirdTab(notify)) {
+ $('#jqxTabs').jqxTabs('disableAt', 3);
+ return;
+ } else {
+ $('#jqxTabs').jqxTabs('enableAt', 3);
+ }
},
//Displaying message to the user
@@ -247,21 +443,14 @@
//Validating the first tab
firstTab: function (notify) {
- var name = $('#name').val(),
- message = '';
+ var name = $('#name').val(), code = $('#code').val(), message = '';
if (name.length < 3) {
- message += 'Je moet een recept naam invullen.
';
+ message += 'Je moet een brouw project naam invullen.
';
}
- // Check if name already exists.
- //if ((boil_time < 4) || (boil_time > 360)) {
- // message += 'De kooktijd moet tussen 4 en 360 minuten zijn.
';
- //}
- //if ((est_og < 1.010) || (est_og > 1.200)) {
- // message += 'Het OG moet tussen 1.010 en 1.500 zijn.
';
- //}
- //if ((efficiency < 35) || (efficiency > 95)) {
- // message += 'Het brouwzaal rendement moet tussen 35 en 95 zijn.
';
- //}
+ if (code.length < 3) {
+ message += 'Je moet een brouw project code invullen.
';
+ }
+ // Check if code already exists.
if (message !== '') {
if (notify) {
this.showHint(message, '#hintBase');
@@ -287,6 +476,23 @@
}
this.showHint('Ok, je mag doorgaan.', '#hintStyle');
return true;
+ },
+
+ //Validating the third tab
+ thirdTab: function (notify) {
+ var equipsel = $('#equipmentSelect').val(),
+ message = '';
+ if (equipsel.length < 3) {
+ message += 'Je moet een brouw installatie kiezen.
';
+ }
+ if (message !== '') {
+ if (notify) {
+ this.showHint(message, '#hintEq');
+ }
+ return false;
+ }
+ this.showHint('Ok, je mag doorgaan.', '#hintEq');
+ return true;
}
}
} ());