# HG changeset patch # User Michiel Broek # Date 1571424547 -7200 # Node ID 8bbc5730aaa8399f6d11f1d46c20608a5f4e5b66 # Parent 55a2460855228ad784c31b5f9fddb40dd5222c66 Code cleanup and manual compress diff -r 55a246085522 -r 8bbc5730aaa8 www/js/prod_archive_code.js --- a/www/js/prod_archive_code.js Fri Oct 18 20:04:40 2019 +0200 +++ b/www/js/prod_archive_code.js Fri Oct 18 20:49:07 2019 +0200 @@ -21,46 +21,46 @@ *****************************************************************************/ -$(document).ready(function () { - var source = { - datatype: "json", - cache: false, - datafields: [ - { name: 'record', type: 'number' }, - { name: 'name', type: 'string' }, - { name: 'code', type: 'string' }, - { name: 'date', type: 'string' }, - { name: 'style', type: 'string' }, - { name: 'og', type: 'float' }, - { name: 'fg', type: 'float' }, - { name: 'batch_size', type: 'float' }, - ], - id: 'record', - url: "includes/db_product.php?select=archcode" - }, - dataAdapter = new $.jqx.dataAdapter(source); +$(document).ready(function() { + var source = { + datatype: 'json', + cache: false, + datafields: [ + { name: 'record', type: 'number' }, + { name: 'name', type: 'string' }, + { name: 'code', type: 'string' }, + { name: 'date', type: 'string' }, + { name: 'style', type: 'string' }, + { name: 'og', type: 'float' }, + { name: 'fg', type: 'float' }, + { name: 'batch_size', type: 'float' }, + ], + id: 'record', + url: 'includes/db_product.php?select=archcode' + }, + dataAdapter = new $.jqx.dataAdapter(source); - // initialize jqxGrid - $("#jqxgrid").jqxGrid({ - width: 1280, - height: 630, - source: dataAdapter, - theme: theme, - columns: [ - { text: 'Code', datafield: 'code', width: 100 }, - { text: 'Naam', datafield: 'name' }, - { text: 'Stijl', datafield: 'style', width: 250 }, - { text: 'OG', datafield: 'og', width: 80, cellsformat: 'f3' }, - { text: 'FG', datafield: 'fg', width: 80, cellsformat: 'f3' }, - { text: 'Datum', datafield: 'date', width: 120 }, - { text: 'Liters', datafield: 'batch_size', width: 80, align: 'right', cellsalign: 'right', cellsformat: 'f1' }, - { text: '', datafield: 'Edit', width: 80, align: 'center', columntype: 'button', cellsrenderer: function () { - return "Bekijk"; - }, buttonclick: function (row) { - var datarecord = dataAdapter.records[row]; - window.location.href = "prod_edit.php?record=" + datarecord.record + "&select=archcode&return=prod_archive_code.php"; - } - } - ], - }); + // initialize jqxGrid + $('#jqxgrid').jqxGrid({ + width: 1280, + height: 630, + source: dataAdapter, + theme: theme, + columns: [ + { text: 'Code', datafield: 'code', width: 100 }, + { text: 'Naam', datafield: 'name' }, + { text: 'Stijl', datafield: 'style', width: 250 }, + { text: 'OG', datafield: 'og', width: 80, cellsformat: 'f3' }, + { text: 'FG', datafield: 'fg', width: 80, cellsformat: 'f3' }, + { text: 'Datum', datafield: 'date', width: 120 }, + { text: 'Liters', datafield: 'batch_size', width: 80, align: 'right', cellsalign: 'right', cellsformat: 'f1' }, + { text: '', datafield: 'Edit', width: 80, align: 'center', columntype: 'button', cellsrenderer: function() { + return 'Bekijk'; + }, buttonclick: function(row) { + var datarecord = dataAdapter.records[row]; + window.location.href = 'prod_edit.php?record=' + datarecord.record + '&select=archcode&return=prod_archive_code.php'; + } + } + ], + }); }); diff -r 55a246085522 -r 8bbc5730aaa8 www/js/prod_archive_date.js --- a/www/js/prod_archive_date.js Fri Oct 18 20:04:40 2019 +0200 +++ b/www/js/prod_archive_date.js Fri Oct 18 20:49:07 2019 +0200 @@ -21,50 +21,50 @@ *****************************************************************************/ -$(document).ready(function () { - var source = { - datatype: "json", - cache: false, - datafields: [ - { name: 'record', type: 'number' }, - { name: 'name', type: 'string' }, - { name: 'code', type: 'string' }, - { name: 'year', type: 'string' }, - { name: 'date', type: 'string' }, - { name: 'style', type: 'string' }, - { name: 'og', type: 'float' }, - { name: 'fg', type: 'float' }, - { name: 'batch_size', type: 'float' }, - ], - id: 'record', - url: "includes/db_product.php?select=archdate" - }, - dataAdapter = new $.jqx.dataAdapter(source); +$(document).ready(function() { + var source = { + datatype: 'json', + cache: false, + datafields: [ + { name: 'record', type: 'number' }, + { name: 'name', type: 'string' }, + { name: 'code', type: 'string' }, + { name: 'year', type: 'string' }, + { name: 'date', type: 'string' }, + { name: 'style', type: 'string' }, + { name: 'og', type: 'float' }, + { name: 'fg', type: 'float' }, + { name: 'batch_size', type: 'float' }, + ], + id: 'record', + url: 'includes/db_product.php?select=archdate' + }, + dataAdapter = new $.jqx.dataAdapter(source); - // initialize jqxGrid - $("#jqxgrid").jqxGrid({ - width: 1280, - height: 630, - source: dataAdapter, - groupable: true, - theme: theme, - columns: [ - { text: 'Jaar', datafield: 'year', width: 80 }, - { text: 'Datum', datafield: 'date', width: 120, menu: false }, - { text: 'Naam', datafield: 'name', menu: false }, - { text: 'Stijl', datafield: 'style', width: 250 }, - { text: 'OG', datafield: 'og', width: 80, cellsformat: 'f3', menu: false }, - { text: 'FG', datafield: 'fg', width: 80, cellsformat: 'f3', menu: false }, - { text: 'Code', datafield: 'code', width: 100, menu: false }, - { text: 'Liters', datafield: 'batch_size', width: 80, align: 'right', cellsalign: 'right', cellsformat: 'f1', menu: false }, - { text: '', datafield: 'Edit', width: 80, align: 'center', columntype: 'button', cellsrenderer: function () { - return "Bekijk"; - }, buttonclick: function (row) { - var datarecord = dataAdapter.records[row]; - window.location.href = "prod_edit.php?record=" + datarecord.record + "&select=archdate&return=prod_archive_date.php"; - } - } - ], - groups: ['year'] - }); + // initialize jqxGrid + $('#jqxgrid').jqxGrid({ + width: 1280, + height: 630, + source: dataAdapter, + groupable: true, + theme: theme, + columns: [ + { text: 'Jaar', datafield: 'year', width: 80 }, + { text: 'Datum', datafield: 'date', width: 120, menu: false }, + { text: 'Naam', datafield: 'name', menu: false }, + { text: 'Stijl', datafield: 'style', width: 250 }, + { text: 'OG', datafield: 'og', width: 80, cellsformat: 'f3', menu: false }, + { text: 'FG', datafield: 'fg', width: 80, cellsformat: 'f3', menu: false }, + { text: 'Code', datafield: 'code', width: 100, menu: false }, + { text: 'Liters', datafield: 'batch_size', width: 80, align: 'right', cellsalign: 'right', cellsformat: 'f1', menu: false }, + { text: '', datafield: 'Edit', width: 80, align: 'center', columntype: 'button', cellsrenderer: function() { + return 'Bekijk'; + }, buttonclick: function(row) { + var datarecord = dataAdapter.records[row]; + window.location.href = 'prod_edit.php?record=' + datarecord.record + '&select=archdate&return=prod_archive_date.php'; + } + } + ], + groups: ['year'] + }); }); diff -r 55a246085522 -r 8bbc5730aaa8 www/js/prod_archive_name.js --- a/www/js/prod_archive_name.js Fri Oct 18 20:04:40 2019 +0200 +++ b/www/js/prod_archive_name.js Fri Oct 18 20:49:07 2019 +0200 @@ -21,46 +21,46 @@ *****************************************************************************/ -$(document).ready(function () { - var source = { - datatype: "json", - cache: false, - datafields: [ - { name: 'record', type: 'number' }, - { name: 'name', type: 'string' }, - { name: 'code', type: 'string' }, - { name: 'date', type: 'string' }, - { name: 'style', type: 'string' }, - { name: 'og', type: 'float' }, - { name: 'fg', type: 'float' }, - { name: 'batch_size', type: 'float' }, - ], - id: 'record', - url: "includes/db_product.php?select=archname" - }, - dataAdapter = new $.jqx.dataAdapter(source); +$(document).ready(function() { + var source = { + datatype: 'json', + cache: false, + datafields: [ + { name: 'record', type: 'number' }, + { name: 'name', type: 'string' }, + { name: 'code', type: 'string' }, + { name: 'date', type: 'string' }, + { name: 'style', type: 'string' }, + { name: 'og', type: 'float' }, + { name: 'fg', type: 'float' }, + { name: 'batch_size', type: 'float' }, + ], + id: 'record', + url: 'includes/db_product.php?select=archname' + }, + dataAdapter = new $.jqx.dataAdapter(source); - // initialize jqxGrid - $("#jqxgrid").jqxGrid({ - width: 1280, - height: 630, - source: dataAdapter, - theme: theme, - columns: [ - { text: 'Naam', datafield: 'name' }, - { text: 'Stijl', datafield: 'style', width: 250 }, - { text: 'OG', datafield: 'og', width: 80, cellsformat: 'f3' }, - { text: 'FG', datafield: 'fg', width: 80, cellsformat: 'f3' }, - { text: 'Datum', datafield: 'date', width: 120 }, - { text: 'Code', datafield: 'code', width: 100 }, - { text: 'Liters', datafield: 'batch_size', width: 80, align: 'right', cellsalign: 'right', cellsformat: 'f1' }, - { text: '', datafield: 'Edit', width: 80, align: 'center', columntype: 'button', cellsrenderer: function () { - return "Bekijk"; - }, buttonclick: function (row) { - var datarecord = dataAdapter.records[row]; - window.location.href = "prod_edit.php?record=" + datarecord.record + "&select=archname&return=prod_archive_name.php"; - } - } - ], - }); + // initialize jqxGrid + $('#jqxgrid').jqxGrid({ + width: 1280, + height: 630, + source: dataAdapter, + theme: theme, + columns: [ + { text: 'Naam', datafield: 'name' }, + { text: 'Stijl', datafield: 'style', width: 250 }, + { text: 'OG', datafield: 'og', width: 80, cellsformat: 'f3' }, + { text: 'FG', datafield: 'fg', width: 80, cellsformat: 'f3' }, + { text: 'Datum', datafield: 'date', width: 120 }, + { text: 'Code', datafield: 'code', width: 100 }, + { text: 'Liters', datafield: 'batch_size', width: 80, align: 'right', cellsalign: 'right', cellsformat: 'f1' }, + { text: '', datafield: 'Edit', width: 80, align: 'center', columntype: 'button', cellsrenderer: function() { + return 'Bekijk'; + }, buttonclick: function(row) { + var datarecord = dataAdapter.records[row]; + window.location.href = 'prod_edit.php?record=' + datarecord.record + '&select=archname&return=prod_archive_name.php'; + } + } + ], + }); }); diff -r 55a246085522 -r 8bbc5730aaa8 www/js/prod_divide.js --- a/www/js/prod_divide.js Fri Oct 18 20:04:40 2019 +0200 +++ b/www/js/prod_divide.js Fri Oct 18 20:49:07 2019 +0200 @@ -21,7 +21,7 @@ *****************************************************************************/ -$(document).ready(function () { +$(document).ready(function() { $('#divide_type').jqxDropDownList({ theme: theme, @@ -298,7 +298,7 @@ for (i = 0; i < SplitData.length; i++) { console.log('i:' + i + ' ok:' + SplitData[i].ok + ' stage:' + dataRecord.stage); if (SplitData[i].ok < dataRecord.stage) - $("#divide_type").jqxDropDownList('disableAt', i); + $('#divide_type').jqxDropDownList('disableAt', i); } }, loadError: function(jqXHR, status, error) { @@ -396,23 +396,23 @@ { text: 'Splits code', datafield: 'split_code', width: 120, editable: false }, { text: 'Splits naam', datafield: 'split_name' }, { text: 'Splits volume', datafield: 'split_size', width: 120, align: 'right', cellsalign: 'right', cellsformat: 'f1', columntype: 'numberinput', - validation: function (cell, value) { + validation: function(cell, value) { if (value < 0 || value > maxvolume) { return { result: false, message: 'Volume should be between 0 and ' + maxvolume + ' liter' }; } return true; }, - createeditor: function (row, cellvalue, editor) { + createeditor: function(row, cellvalue, editor) { editor.jqxNumberInput({ decimalDigits: 1, digits: 3 }); } } ] }); - $('#splitGrid').on('cellbeginedit', function (event) { + $('#splitGrid').on('cellbeginedit', function(event) { var args = event.args; calcRoom(args.rowindex); // Make maxvolume available. }); - $('#splitGrid').on('cellvaluechanged', function (event) { + $('#splitGrid').on('cellvaluechanged', function(event) { var args = event.args; //console.log("cellvaluechanged, Column: " + args.datafield + ", Row: " + (1 + args.rowindex) + ", Value: " + args.value); calcLeftover(); @@ -493,8 +493,8 @@ url: durl, cache: false, data: data, - type: "POST", - success: function (data, status, xhr) { + type: 'POST', + success: function(data, status, xhr) { console.log('insert divides: 0'); }, error: function(jqXHR, textStatus, errorThrown) { @@ -519,8 +519,8 @@ url: durl, cache: false, data: data, - type: "POST", - success: function (data, status, xhr) { + type: 'POST', + success: function(data, status, xhr) { console.log('insert divides: ' + i); }, error: function(jqXHR, textStatus, errorThrown) { @@ -540,8 +540,8 @@ url: url, cache: false, data: data, - type: "POST", - success: function (data, status, xhr) { + type: 'POST', + success: function(data, status, xhr) { console.log('updated products'); }, error: function(jqXHR, textStatus, errorThrown) { diff -r 55a246085522 -r 8bbc5730aaa8 www/js/prod_edit.js --- a/www/js/prod_edit.js Fri Oct 18 20:04:40 2019 +0200 +++ b/www/js/prod_edit.js Fri Oct 18 20:49:07 2019 +0200 @@ -793,10 +793,10 @@ } ] }); - }, + }; // Inline hops editor - editHop = function(data) { + var editHop = function(data) { var hopSource = { localdata: data.hops, datatype: 'local', @@ -1006,10 +1006,10 @@ } ] }); - }, + }; // Inline miscs editor - editMisc = function(data) { + var editMisc = function(data) { var miscSource = { localdata: data.miscs, datatype: 'local', @@ -1250,10 +1250,10 @@ } ] }); - }, + }; // Inline yeasts editor - editYeast = function(data) { + var editYeast = function(data) { var yeastSource = { localdata: data.yeasts, datatype: 'local', @@ -1462,10 +1462,10 @@ } ] }); - }, + }; // inline mash editor - editMash = function(data) { + var editMash = function(data) { var mashSource = { localdata: data.mashs, datatype: 'local', @@ -5335,7 +5335,9 @@ }); $('#starter_sg').jqxTooltip({ content: 'Het ideale starter SG moet tussen de 1.030 en 1.040 zijn. Optimaal is 1.037.' }); $('#starter_sg').jqxNumberInput(SGopts); - $('#starter_viability').jqxTooltip({ content: 'De gist conditie te berekenen vanaf de productie datum. Vloeibare gist verlist iedere maand ongeveer 20% active cellen.' }); + $('#starter_viability').jqxTooltip({ + content: 'De gist conditie te berekenen vanaf de productie datum. Vloeibare gist verlist iedere maand ongeveer 20% active cellen.' + }); $('#starter_viability').jqxNumberInput(Perc0); $('#starter_try').jqxButton({ template: 'primary', width: '100px', height: 23, theme: theme }); diff -r 55a246085522 -r 8bbc5730aaa8 www/js/prod_export.js --- a/www/js/prod_export.js Fri Oct 18 20:04:40 2019 +0200 +++ b/www/js/prod_export.js Fri Oct 18 20:49:07 2019 +0200 @@ -21,73 +21,73 @@ *****************************************************************************/ -$(document).ready(function () { +$(document).ready(function() { - var choice = 0; + var choice = 0; - $("#name").html(my_name); - $("#code").html(my_code); - $("#jqxRadioButton1").jqxRadioButton({ theme: theme, width: 250, height: 23 }); - $("#jqxRadioButton2").jqxRadioButton({ theme: theme, width: 250, height: 23 }); - $("#jqxRadioButton3").jqxRadioButton({ theme: theme, width: 250, height: 23 }); - $("#jqxRadioButton4").jqxRadioButton({ theme: theme, width: 250, height: 23 }); - $("#jqxRadioButton5").jqxRadioButton({ theme: theme, width: 250, height: 23 }); - $("#jqxRadioButton6").jqxRadioButton({ theme: theme, width: 250, height: 23 }); - $("#jqxRadioButton7").jqxRadioButton({ theme: theme, width: 250, height: 23 }); - if ((my_split != 0) || (my_stage >= 6)) { - $("#jqxRadioButton3").jqxRadioButton({ disabled: true }); - document.getElementById("pmpt3").style.color = "red"; - } + $('#name').html(my_name); + $('#code').html(my_code); + $('#jqxRadioButton1').jqxRadioButton({ theme: theme, width: 250, height: 23 }); + $('#jqxRadioButton2').jqxRadioButton({ theme: theme, width: 250, height: 23 }); + $('#jqxRadioButton3').jqxRadioButton({ theme: theme, width: 250, height: 23 }); + $('#jqxRadioButton4').jqxRadioButton({ theme: theme, width: 250, height: 23 }); + $('#jqxRadioButton5').jqxRadioButton({ theme: theme, width: 250, height: 23 }); + $('#jqxRadioButton6').jqxRadioButton({ theme: theme, width: 250, height: 23 }); + $('#jqxRadioButton7').jqxRadioButton({ theme: theme, width: 250, height: 23 }); + if ((my_split != 0) || (my_stage >= 6)) { + $('#jqxRadioButton3').jqxRadioButton({ disabled: true }); + document.getElementById('pmpt3').style.color = 'red'; + } - $('#jqxRadioButton1').on('checked', function (event) { - $('#Start').jqxButton({ disabled: false }); - choice = 1; - }); - $('#jqxRadioButton2').on('checked', function (event) { - $('#Start').jqxButton({ disabled: false }); - choice = 2; - }); - $('#jqxRadioButton3').on('checked', function (event) { - $('#Start').jqxButton({ disabled: false }); - choice = 3; - }); - $('#jqxRadioButton4').on('checked', function (event) { - $('#Start').jqxButton({ disabled: false }); - choice = 4; - }); - $('#jqxRadioButton5').on('checked', function (event) { - $('#Start').jqxButton({ disabled: false }); - choice = 5; - }); - $('#jqxRadioButton6').on('checked', function (event) { - $('#Start').jqxButton({ disabled: false }); - choice = 6; - }); - $('#jqxRadioButton7').on('checked', function (event) { - $('#Start').jqxButton({ disabled: false }); - choice = 7; - }); + $('#jqxRadioButton1').on('checked', function(event) { + $('#Start').jqxButton({ disabled: false }); + choice = 1; + }); + $('#jqxRadioButton2').on('checked', function(event) { + $('#Start').jqxButton({ disabled: false }); + choice = 2; + }); + $('#jqxRadioButton3').on('checked', function(event) { + $('#Start').jqxButton({ disabled: false }); + choice = 3; + }); + $('#jqxRadioButton4').on('checked', function(event) { + $('#Start').jqxButton({ disabled: false }); + choice = 4; + }); + $('#jqxRadioButton5').on('checked', function(event) { + $('#Start').jqxButton({ disabled: false }); + choice = 5; + }); + $('#jqxRadioButton6').on('checked', function(event) { + $('#Start').jqxButton({ disabled: false }); + choice = 6; + }); + $('#jqxRadioButton7').on('checked', function(event) { + $('#Start').jqxButton({ disabled: false }); + choice = 7; + }); - $('#Start').jqxButton({ template: "success", width: '100px', theme: theme, disabled: true }); - $('#Start').click(function () { - if (choice == 1) { - window.open('prod_beerxml.php?record=' + my_record); - } else if (choice == 2) { - window.open('prod_duplicate.php?record=' + my_record); - } else if (choice == 3) { - window.location.href = 'prod_divide.php?record=' + my_record + '&return=' + my_return; - } else if (choice == 4) { - window.open('prod_torecipe.php?record=' + my_record); - } else if (choice == 5) { - window.open('prod_print.php?record=' + my_record); - } else if (choice == 6) { - window.open('prod_checklist.php?record=' + my_record); - } else if (choice == 7) { - window.open('prod_forum.php?record=' + my_record); - } - // Return to the original product - if (choice != 3) - window.location.href = "prod_edit.php?record=" + my_record + "&return=" + my_return; - }); + $('#Start').jqxButton({ template: 'success', width: '100px', theme: theme, disabled: true }); + $('#Start').click(function() { + if (choice == 1) { + window.open('prod_beerxml.php?record=' + my_record); + } else if (choice == 2) { + window.open('prod_duplicate.php?record=' + my_record); + } else if (choice == 3) { + window.location.href = 'prod_divide.php?record=' + my_record + '&return=' + my_return; + } else if (choice == 4) { + window.open('prod_torecipe.php?record=' + my_record); + } else if (choice == 5) { + window.open('prod_print.php?record=' + my_record); + } else if (choice == 6) { + window.open('prod_checklist.php?record=' + my_record); + } else if (choice == 7) { + window.open('prod_forum.php?record=' + my_record); + } + // Return to the original product + if (choice != 3) + window.location.href = 'prod_edit.php?record=' + my_record + '&return=' + my_return; + }); }); diff -r 55a246085522 -r 8bbc5730aaa8 www/js/prod_impbrew.js --- a/www/js/prod_impbrew.js Fri Oct 18 20:04:40 2019 +0200 +++ b/www/js/prod_impbrew.js Fri Oct 18 20:49:07 2019 +0200 @@ -21,36 +21,36 @@ *****************************************************************************/ -$(document).ready(function () { +$(document).ready(function() { - $('#jqxFileUpload').jqxFileUpload({ - width: 300, - browseTemplate: 'success', - cancelTemplate: 'inverse', - uploadTemplate: 'primary', - theme: theme, - multipleFilesUpload: false, - accept: 'application/json', - uploadUrl: 'upl_brew.php', - fileInputName: 'fileToUpload' - }); - $('#eventsPanel').jqxPanel({ - width: 800, - height: 200, - theme: theme - }); - $('#jqxFileUpload').on('select', function (event) { - var fileName, fileSize, args = event.args; - fileName = args.file; - fileSize = args.size; - $('#eventsPanel').jqxPanel('clearcontent'); - $('#eventsPanel').jqxPanel('append', '' + event.type + ': ' + fileName + ' size: ' + fileSize + '
'); - }); - $('#jqxFileUpload').on('uploadEnd', function (event) { - var fileName, serverResponce, args = event.args; - fileName = args.file; - serverResponce = args.response; - $('#eventsPanel').jqxPanel('append', '' + event.type + ': ontvangen ' + fileName + '
' + serverResponce + '
'); - }); + $('#jqxFileUpload').jqxFileUpload({ + width: 300, + browseTemplate: 'success', + cancelTemplate: 'inverse', + uploadTemplate: 'primary', + theme: theme, + multipleFilesUpload: false, + accept: 'application/json', + uploadUrl: 'upl_brew.php', + fileInputName: 'fileToUpload' + }); + $('#eventsPanel').jqxPanel({ + width: 800, + height: 200, + theme: theme + }); + $('#jqxFileUpload').on('select', function(event) { + var fileName, fileSize, args = event.args; + fileName = args.file; + fileSize = args.size; + $('#eventsPanel').jqxPanel('clearcontent'); + $('#eventsPanel').jqxPanel('append', '' + event.type + ': ' + fileName + ' size: ' + fileSize + '
'); + }); + $('#jqxFileUpload').on('uploadEnd', function(event) { + var fileName, serverResponce, args = event.args; + fileName = args.file; + serverResponce = args.response; + $('#eventsPanel').jqxPanel('append', '' + event.type + ': ontvangen ' + fileName + '
' + serverResponce + '
'); + }); }); diff -r 55a246085522 -r 8bbc5730aaa8 www/js/prod_inprod.js --- a/www/js/prod_inprod.js Fri Oct 18 20:04:40 2019 +0200 +++ b/www/js/prod_inprod.js Fri Oct 18 20:49:07 2019 +0200 @@ -21,84 +21,85 @@ *****************************************************************************/ -$(document).ready(function () { - var source = { - datatype: "json", - cache: false, - datafields: [ - { name: 'record', type: 'number' }, - { name: 'name', type: 'string' }, - { name: 'code', type: 'string' }, - { name: 'birth', type: 'string' }, - { name: 'stage', type: 'int' }, - { name: 'brew_date', type: 'string' }, - { name: 'package_date', type: 'string' }, - ], - id: 'record', - url: "includes/db_product.php?select=inprod" - }, - dataAdapter = new $.jqx.dataAdapter(source); +$(document).ready(function() { + var source = { + datatype: 'json', + cache: false, + datafields: [ + { name: 'record', type: 'number' }, + { name: 'name', type: 'string' }, + { name: 'code', type: 'string' }, + { name: 'birth', type: 'string' }, + { name: 'stage', type: 'int' }, + { name: 'brew_date', type: 'string' }, + { name: 'package_date', type: 'string' }, + ], + id: 'record', + url: 'includes/db_product.php?select=inprod' + }, + dataAdapter = new $.jqx.dataAdapter(source); - // initialize jqxGrid - $("#jqxgrid").jqxGrid({ - width: 1280, - height: 630, - source: dataAdapter, - theme: theme, - showstatusbar: true, - renderstatusbar: function (statusbar) { - var container, addButton; - container = $("
"); - addButton = $("
Add
"); - container.append(addButton); - statusbar.append(container); - addButton.jqxButton({ theme: theme, width: 90, height: 20 }); - // add new recipe. - addButton.click(function (event) { - window.location.href = "prod_new.php?return=prod_inprod.php"; - }); - }, - columns: [ - { text: 'Datum', datafield: 'birth', width: 120 }, - { text: 'Code', datafield: 'code', width: 120 }, - { text: 'Naam', datafield: 'name' }, - { text: 'Fase', datafield: 'stage', width: 200, - cellsrenderer: function (index, datafield, value, defaultvalue, column, rowdata) { - var fase, d, date1, date2, date1_unixtime, date2_unixtime, timeDifference, timeDifferenceInDays; - // 2 = brew, 6 = package, 7 = carbonation, 8 = mature, 9 = taste - fase = StageData[value].nl; - if (value == 2) { - fase = StageData[value].nl + " op " + rowdata.brew_date; - } - if (value == 7 || value == 8) { - d = new Date(); - date2 = rowdata.package_date; - date2 = date2.split('-'); - // Now we convert the array to a Date object - date1 = new Date(d.getFullYear(), d.getMonth(), d.getDate()); - date2 = new Date(date2[0], date2[1]-1, date2[2]); - // We use the getTime() method and get the unixtime - date1_unixtime = parseInt(date1.getTime() / 1000); - date2_unixtime = parseInt(date2.getTime() / 1000); - // This is the calculated difference in seconds - timeDifference = date1_unixtime - date2_unixtime; - // Round the result for brews that overlap summer/wintertime changes. - timeDifferenceInDays = Math.round(timeDifference / 60 / 60 / 24); - if (timeDifferenceInDays >= 14) - fase = StageData[value].nl + " dag " + (timeDifferenceInDays - 14) + " van 28"; - else - fase = StageData[value].nl + " dag " + timeDifferenceInDays + " van 14"; - } - return "" + fase + ""; - } - }, - { text: '', datafield: 'Edit', width: 100, align: 'center', columntype: 'button', cellsrenderer: function () { - return "Wijzig"; - }, buttonclick: function (row) { - var datarecord = dataAdapter.records[row]; - window.location.href = "prod_edit.php?record=" + datarecord.record + "&select=inprod&return=prod_inprod.php"; - } - } - ], - }); + // initialize jqxGrid + $('#jqxgrid').jqxGrid({ + width: 1280, + height: 630, + source: dataAdapter, + theme: theme, + showstatusbar: true, + renderstatusbar: function(statusbar) { + var container, addButton; + container = $('
'); + addButton = $('
Add
'); + container.append(addButton); + statusbar.append(container); + addButton.jqxButton({ theme: theme, width: 90, height: 20 }); + // add new recipe. + addButton.click(function(event) { + window.location.href = 'prod_new.php?return=prod_inprod.php'; + }); + }, + columns: [ + { text: 'Datum', datafield: 'birth', width: 120 }, + { text: 'Code', datafield: 'code', width: 120 }, + { text: 'Naam', datafield: 'name' }, + { text: 'Fase', datafield: 'stage', width: 200, + cellsrenderer: function(index, datafield, value, defaultvalue, column, rowdata) { + var fase, d, date1, date2, date1_unixtime, date2_unixtime, timeDifference, timeDifferenceInDays; + // 2 = brew, 6 = package, 7 = carbonation, 8 = mature, 9 = taste + fase = StageData[value].nl; + if (value == 2) { + fase = StageData[value].nl + ' op ' + rowdata.brew_date; + } + if (value == 7 || value == 8) { + d = new Date(); + date2 = rowdata.package_date; + date2 = date2.split('-'); + // Now we convert the array to a Date object + date1 = new Date(d.getFullYear(), d.getMonth(), d.getDate()); + date2 = new Date(date2[0], date2[1] - 1, date2[2]); + // We use the getTime() method and get the unixtime + date1_unixtime = parseInt(date1.getTime() / 1000); + date2_unixtime = parseInt(date2.getTime() / 1000); + // This is the calculated difference in seconds + timeDifference = date1_unixtime - date2_unixtime; + // Round the result for brews that overlap summer/wintertime changes. + timeDifferenceInDays = Math.round(timeDifference / 60 / 60 / 24); + if (timeDifferenceInDays >= 14) + fase = StageData[value].nl + ' dag ' + (timeDifferenceInDays - 14) + ' van 28'; + else + fase = StageData[value].nl + ' dag ' + timeDifferenceInDays + ' van 14'; + } + return '' + fase + ''; + } + }, + { text: '', datafield: 'Edit', width: 100, align: 'center', columntype: 'button', cellsrenderer: function() { + return 'Wijzig'; + }, buttonclick: function(row) { + var datarecord = dataAdapter.records[row]; + window.location.href = 'prod_edit.php?record=' + datarecord.record + '&select=inprod&return=prod_inprod.php'; + } + } + ], + }); }); diff -r 55a246085522 -r 8bbc5730aaa8 www/js/prod_new.js --- a/www/js/prod_new.js Fri Oct 18 20:04:40 2019 +0200 +++ b/www/js/prod_new.js Fri Oct 18 20:49:07 2019 +0200 @@ -21,560 +21,555 @@ *****************************************************************************/ -$(document).ready(function () { +$(document).ready(function() { - // Tab 1, base - $("#name").jqxTooltip({ content: 'De naam voor dit brouw project.' }); - $("#name").jqxInput({ theme: theme, width: 640, height: 23 }); - $("#code").jqxTooltip({ content: 'Het unieke code nummer van dit brouw project.' }); - $("#code").jqxInput({ theme: theme, width: 100, height: 23 }); - $("#notes").jqxTooltip({ content: 'De uitgebreide opmerkingen over dit project.' }); - $("#notes").jqxInput({ theme: theme, width: 960, height: 200 }); - $("#type").jqxDropDownList({ - theme: theme, - source: RecipeTypeAdapter, - valueMember: 'id', - displayMember: 'nl', - width: 180, - height: 23, - autoDropDownHeight: true - }); - $("#type").jqxDropDownList('selectItem', 2); - $("#type").on('select', function (event) { - if (event.args) { - recipe_type = event.args.index; - } - }); + // Tab 1, base + $('#name').jqxTooltip({ content: 'De naam voor dit brouw project.' }); + $('#name').jqxInput({ theme: theme, width: 640, height: 23 }); + $('#code').jqxTooltip({ content: 'Het unieke code nummer van dit brouw project.' }); + $('#code').jqxInput({ theme: theme, width: 100, height: 23 }); + $('#notes').jqxTooltip({ content: 'De uitgebreide opmerkingen over dit project.' }); + $('#notes').jqxInput({ theme: theme, width: 960, height: 200 }); + $('#type').jqxDropDownList({ + theme: theme, + source: RecipeTypeAdapter, + valueMember: 'id', + displayMember: 'nl', + width: 180, + height: 23, + autoDropDownHeight: true + }); + $('#type').jqxDropDownList('selectItem', 2); + $('#type').on('select', function(event) { + if (event.args) { + recipe_type = event.args.index; + } + }); - // Tab 2, style - $("#st_name").jqxTooltip({ content: 'De bierstijl naam voor dit recept.'}); - $("#st_name").jqxInput({ theme: theme, width: 250, height: 23 }); - $("#st_category").jqxTooltip({ content: 'De Amerikaanse bierstijl categorie.'}); - $("#st_category").jqxInput({ theme: theme, width: 250, height: 23 }); - $("#st_category_number").jqxTooltip({ content: 'De Amerikaanse bierstijl categorie sub nummer.'}); - $("#st_category_number").jqxInput({ theme: theme, width: 70, height: 23 }); - $("#st_letter").jqxTooltip({ content: 'De bierstijl letter voor dit recept.'}); - $("#st_letter").jqxInput({ theme: theme, width: 250, height: 23 }); - $("#st_guide").jqxTooltip({ content: 'De bierstijl gids voor dit recept.'}); - $("#st_guide").jqxInput({ theme: theme, width: 250, height: 23 }); - $("#st_notes").jqxInput({ theme: theme, width: 800, height: 100 }); - $("#st_type").jqxTooltip({ content: 'Het bierstijl type.'}); - $("#st_type").jqxInput({ theme: theme, width: 250, height: 23 }); - $("#st_og_min").jqxTooltip({ content: 'Het minimum begin SG voor deze bierstijl.'}); - $("#st_og_min").jqxNumberInput({ inputMode: 'simple', theme: theme, width: 90, height: 23, decimalDigits: 3, readOnly: true }); - $("#st_og_max").jqxTooltip({ content: 'Het maximum begin SG voor deze bierstijl.'}); - $("#st_og_max").jqxNumberInput({ inputMode: 'simple', theme: theme, width: 90, height: 23, decimalDigits: 3, readOnly: true }); - $("#st_fg_min").jqxTooltip({ content: 'Het minimum eind SG voor deze bierstijl.'}); - $("#st_fg_min").jqxNumberInput({ inputMode: 'simple', theme: theme, width: 90, height: 23, decimalDigits: 3, readOnly: true }); - $("#st_fg_max").jqxTooltip({ content: 'Het maximum eind SG voor deze bierstijl.'}); - $("#st_fg_max").jqxNumberInput({ inputMode: 'simple', theme: theme, width: 90, height: 23, decimalDigits: 3, readOnly: true }); - $("#st_ibu_min").jqxTooltip({ content: 'De minimum bitterheid voor deze bierstijl.'}); - $("#st_ibu_min").jqxNumberInput({ inputMode: 'simple', theme: theme, width: 90, height: 23, decimalDigits: 0, readOnly: true }); - $("#st_ibu_max").jqxTooltip({ content: 'De maximum bitterheid voor deze bierstijl.'}); - $("#st_ibu_max").jqxNumberInput({ inputMode: 'simple', theme: theme, width: 90, height: 23, decimalDigits: 0, readOnly: true }); - $("#st_color_min").jqxTooltip({ content: 'De minimum kleur voor deze bierstijl.'}); - $("#st_color_min").jqxNumberInput({ inputMode: 'simple', theme: theme, width: 90, height: 23, decimalDigits: 0, readOnly: true }); - $("#st_color_max").jqxTooltip({ content: 'De maximum kleur voor deze bierstijl.'}); - $("#st_color_max").jqxNumberInput({ inputMode: 'simple', theme: theme, width: 90, height: 23, decimalDigits: 0, readOnly: true }); - $("#st_carb_min").jqxTooltip({ content: 'Het minimum koolzuur volume voor deze bierstijl.'}); - $("#st_carb_min").jqxNumberInput({ inputMode: 'simple', theme: theme, width: 90, height: 23, decimalDigits: 1, readOnly: true }); - $("#st_carb_max").jqxTooltip({ content: 'Het maximum koolzuur volume voor deze bierstijl.'}); - $("#st_carb_max").jqxNumberInput({ inputMode: 'simple', theme: theme, width: 90, height: 23, decimalDigits: 1, readOnly: true }); - $("#st_abv_min").jqxTooltip({ content: 'Het minimum alcohol volume % voor deze bierstijl.'}); - $("#st_abv_min").jqxNumberInput({ inputMode: 'simple', theme: theme, width: 90, height: 23, decimalDigits: 1, readOnly: true }); - $("#st_abv_max").jqxTooltip({ content: 'Het maximum alcohol volume % voor deze bierstijl.'}); - $("#st_abv_max").jqxNumberInput({ inputMode: 'simple', theme: theme, width: 90, 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 }); - $("#styleSelect").jqxDropDownList({ - placeHolder: "Kies bierstijl:", - theme: theme, - source: styleslist, - displayMember: "name", - width: 250, - 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, - 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); - style_type = datarecord.type; - $("#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_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); - } - }); + // Tab 2, style + $('#st_name').jqxTooltip({ content: 'De bierstijl naam voor dit recept.'}); + $('#st_name').jqxInput({ theme: theme, width: 250, height: 23 }); + $('#st_category').jqxTooltip({ content: 'De Amerikaanse bierstijl categorie.'}); + $('#st_category').jqxInput({ theme: theme, width: 250, height: 23 }); + $('#st_category_number').jqxTooltip({ content: 'De Amerikaanse bierstijl categorie sub nummer.'}); + $('#st_category_number').jqxInput({ theme: theme, width: 70, height: 23 }); + $('#st_letter').jqxTooltip({ content: 'De bierstijl letter voor dit recept.'}); + $('#st_letter').jqxInput({ theme: theme, width: 250, height: 23 }); + $('#st_guide').jqxTooltip({ content: 'De bierstijl gids voor dit recept.'}); + $('#st_guide').jqxInput({ theme: theme, width: 250, height: 23 }); + $('#st_notes').jqxInput({ theme: theme, width: 800, height: 100 }); + $('#st_type').jqxTooltip({ content: 'Het bierstijl type.'}); + $('#st_type').jqxInput({ theme: theme, width: 250, height: 23 }); + $('#st_og_min').jqxTooltip({ content: 'Het minimum begin SG voor deze bierstijl.'}); + $('#st_og_min').jqxNumberInput({ inputMode: 'simple', theme: theme, width: 90, height: 23, decimalDigits: 3, readOnly: true }); + $('#st_og_max').jqxTooltip({ content: 'Het maximum begin SG voor deze bierstijl.'}); + $('#st_og_max').jqxNumberInput({ inputMode: 'simple', theme: theme, width: 90, height: 23, decimalDigits: 3, readOnly: true }); + $('#st_fg_min').jqxTooltip({ content: 'Het minimum eind SG voor deze bierstijl.'}); + $('#st_fg_min').jqxNumberInput({ inputMode: 'simple', theme: theme, width: 90, height: 23, decimalDigits: 3, readOnly: true }); + $('#st_fg_max').jqxTooltip({ content: 'Het maximum eind SG voor deze bierstijl.'}); + $('#st_fg_max').jqxNumberInput({ inputMode: 'simple', theme: theme, width: 90, height: 23, decimalDigits: 3, readOnly: true }); + $('#st_ibu_min').jqxTooltip({ content: 'De minimum bitterheid voor deze bierstijl.'}); + $('#st_ibu_min').jqxNumberInput({ inputMode: 'simple', theme: theme, width: 90, height: 23, decimalDigits: 0, readOnly: true }); + $('#st_ibu_max').jqxTooltip({ content: 'De maximum bitterheid voor deze bierstijl.'}); + $('#st_ibu_max').jqxNumberInput({ inputMode: 'simple', theme: theme, width: 90, height: 23, decimalDigits: 0, readOnly: true }); + $('#st_color_min').jqxTooltip({ content: 'De minimum kleur voor deze bierstijl.'}); + $('#st_color_min').jqxNumberInput({ inputMode: 'simple', theme: theme, width: 90, height: 23, decimalDigits: 0, readOnly: true }); + $('#st_color_max').jqxTooltip({ content: 'De maximum kleur voor deze bierstijl.'}); + $('#st_color_max').jqxNumberInput({ inputMode: 'simple', theme: theme, width: 90, height: 23, decimalDigits: 0, readOnly: true }); + $('#st_carb_min').jqxTooltip({ content: 'Het minimum koolzuur volume voor deze bierstijl.'}); + $('#st_carb_min').jqxNumberInput({ inputMode: 'simple', theme: theme, width: 90, height: 23, decimalDigits: 1, readOnly: true }); + $('#st_carb_max').jqxTooltip({ content: 'Het maximum koolzuur volume voor deze bierstijl.'}); + $('#st_carb_max').jqxNumberInput({ inputMode: 'simple', theme: theme, width: 90, height: 23, decimalDigits: 1, readOnly: true }); + $('#st_abv_min').jqxTooltip({ content: 'Het minimum alcohol volume % voor deze bierstijl.'}); + $('#st_abv_min').jqxNumberInput({ inputMode: 'simple', theme: theme, width: 90, height: 23, decimalDigits: 1, readOnly: true }); + $('#st_abv_max').jqxTooltip({ content: 'Het maximum alcohol volume % voor deze bierstijl.'}); + $('#st_abv_max').jqxNumberInput({ inputMode: 'simple', theme: theme, width: 90, 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 }); + $('#styleSelect').jqxDropDownList({ + placeHolder: 'Kies bierstijl:', + theme: theme, + source: styleslist, + displayMember: 'name', + width: 250, + 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, + 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); + style_type = datarecord.type; + $('#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_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); + } + }); - // Tab 3, equipment - $("#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: 90, 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: 90, height: 23, decimalDigits: 1 }); - $("#eq_tun_volume").jqxTooltip({ content: 'Maisch ketel volume.' }); - $("#eq_tun_volume").jqxNumberInput({ inputMode: 'simple', readOnly: true, theme: theme, width: 90, height: 23, decimalDigits: 1 }); - $("#eq_tun_weight").jqxTooltip({ content: 'Maisch ketel gewicht.' }); - $("#eq_tun_weight").jqxNumberInput({ inputMode: 'simple', readOnly: true, theme: theme, width: 90, height: 23, decimalDigits: 1 }); - $("#eq_tun_height").jqxTooltip({ content: 'Maisch ketel hoogte.' }); - $("#eq_tun_height").jqxNumberInput({ inputMode: 'simple', readOnly: true, theme: theme, width: 90, height: 23, decimalDigits: 1 }); - $("#eq_tun_material").jqxTooltip({ content: 'Maisch ketel materiaal.' }); - $("#eq_tun_material").jqxInput({ theme: theme, width: 180, height: 23 }); - $("#eq_tun_specific_heat").jqxTooltip({ content: 'Maisch ketel warmte geleiding.' }); - $("#eq_tun_specific_heat").jqxNumberInput({ inputMode: 'simple', readOnly: true, theme: theme, width: 90, height: 23, decimalDigits: 3 }); - $("#eq_top_up_water").jqxTooltip({ content: 'Extra water in het gistvat.' }); - $("#eq_top_up_water").jqxNumberInput({ inputMode: 'simple', readOnly: true, theme: theme, width: 90, 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: 90, 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: 90, height: 23, decimalDigits: 2, }); - $("#eq_boil_time").jqxTooltip({ content: 'Normale kooktijd in minuten.' }); - $("#eq_boil_time").jqxNumberInput({ inputMode: 'simple', readOnly: true, theme: theme, width: 90, 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: 90, 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: 90, 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: 90, height: 23, decimalDigits: 1 }); - $("#eq_lauter_height").jqxTooltip({ content: 'Filterkuip hoogte.' }); - $("#eq_lauter_height").jqxNumberInput({ inputMode: 'simple', readOnly: true, theme: theme, width: 90, height: 23, decimalDigits: 1 }); - $("#eq_lauter_deadspace").jqxTooltip({ content: 'Filterkuip verlies in liters.' }); - $("#eq_lauter_deadspace").jqxNumberInput({ inputMode: 'simple', readOnly: true, theme: theme, width: 90, 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: 90, 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: 90, 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: 90, 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: 90, height: 23, decimalDigits: 1 }); - $("#eq_efficiency").jqxTooltip({ content: 'Gemiddeld brouwzaal rendement.' }); - $("#eq_efficiency").jqxNumberInput({ inputMode: 'simple', readOnly: true, theme: theme, width: 90, height: 23, decimalDigits: 1 }); - $("#equipmentSelect").jqxDropDownList({ - placeHolder: "Kies apparatuur:", - theme: theme, - source: equipmentlist, - displayMember: "name", - width: 250, - 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, - 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); - tun_material = datarecord.tun_material; - $("#eq_tun_material").val(MaterialData[datarecord.tun_material].nl); - $("#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); - } - }); + // Tab 3, equipment + $('#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: 90, 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: 90, height: 23, decimalDigits: 1 }); + $('#eq_tun_volume').jqxTooltip({ content: 'Maisch ketel volume.' }); + $('#eq_tun_volume').jqxNumberInput({ inputMode: 'simple', readOnly: true, theme: theme, width: 90, height: 23, decimalDigits: 1 }); + $('#eq_tun_weight').jqxTooltip({ content: 'Maisch ketel gewicht.' }); + $('#eq_tun_weight').jqxNumberInput({ inputMode: 'simple', readOnly: true, theme: theme, width: 90, height: 23, decimalDigits: 1 }); + $('#eq_tun_height').jqxTooltip({ content: 'Maisch ketel hoogte.' }); + $('#eq_tun_height').jqxNumberInput({ inputMode: 'simple', readOnly: true, theme: theme, width: 90, height: 23, decimalDigits: 1 }); + $('#eq_tun_material').jqxTooltip({ content: 'Maisch ketel materiaal.' }); + $('#eq_tun_material').jqxInput({ theme: theme, width: 180, height: 23 }); + $('#eq_tun_specific_heat').jqxTooltip({ content: 'Maisch ketel warmte geleiding.' }); + $('#eq_tun_specific_heat').jqxNumberInput({ inputMode: 'simple', readOnly: true, theme: theme, width: 90, height: 23, decimalDigits: 3 }); + $('#eq_top_up_water').jqxTooltip({ content: 'Extra water in het gistvat.' }); + $('#eq_top_up_water').jqxNumberInput({ inputMode: 'simple', readOnly: true, theme: theme, width: 90, 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: 90, 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: 90, height: 23, decimalDigits: 2 }); + $('#eq_boil_time').jqxTooltip({ content: 'Normale kooktijd in minuten.' }); + $('#eq_boil_time').jqxNumberInput({ inputMode: 'simple', readOnly: true, theme: theme, width: 90, 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: 90, 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: 90, 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: 90, height: 23, decimalDigits: 1 }); + $('#eq_lauter_height').jqxTooltip({ content: 'Filterkuip hoogte.' }); + $('#eq_lauter_height').jqxNumberInput({ inputMode: 'simple', readOnly: true, theme: theme, width: 90, height: 23, decimalDigits: 1 }); + $('#eq_lauter_deadspace').jqxTooltip({ content: 'Filterkuip verlies in liters.' }); + $('#eq_lauter_deadspace').jqxNumberInput({ inputMode: 'simple', readOnly: true, theme: theme, width: 90, 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: 90, 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: 90, 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: 90, 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: 90, height: 23, decimalDigits: 1 }); + $('#eq_efficiency').jqxTooltip({ content: 'Gemiddeld brouwzaal rendement.' }); + $('#eq_efficiency').jqxNumberInput({ inputMode: 'simple', readOnly: true, theme: theme, width: 90, height: 23, decimalDigits: 1 }); + $('#equipmentSelect').jqxDropDownList({ + placeHolder: 'Kies apparatuur:', + theme: theme, + source: equipmentlist, + displayMember: 'name', + width: 250, + 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, + 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); + tun_material = datarecord.tun_material; + $('#eq_tun_material').val(MaterialData[datarecord.tun_material].nl); + $('#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); + } + }); - var recipe_type = 2, - style_type = 0, - tun_material = 0, - wizard = (function() { // Creating wizard module + var recipe_type = 2, + style_type = 0, + tun_material = 0, + wizard = (function() { // Creating wizard module - //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 () { - var d = new Date(), - m = d.getMonth() + 1, - b = d.getFullYear() + '-', - newrow, data; - if (m < 10) - b = b + '0'; - b = b + m + '-'; - if (d.getDate() < 10) - b = b + '0'; - b = b + d.getDate(); - newrow = { - record: -1, - name: $("#name").val(), - code: $("#code").val(), - birth: b, - stage: 0, - notes: $("#notes").val(), - log_brew: 0, - log_fermentation: 0, - inventory_reduced: 0, - locked: 0, - 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: parseFloat($("#eq_tun_weight").jqxNumberInput('decimal')), - eq_tun_specific_heat: parseFloat($("#eq_tun_specific_heat").jqxNumberInput('decimal')), - eq_tun_material: tun_material, - eq_tun_height: parseFloat($("#eq_tun_height").jqxNumberInput('decimal')) / 100, - 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: $("#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: parseFloat($("#eq_lauter_height").jqxNumberInput('decimal')) / 100, - eq_lauter_deadspace: parseFloat($("#eq_lauter_deadspace").jqxNumberInput('decimal')), - eq_kettle_volume: parseFloat($("#eq_kettle_volume").jqxNumberInput('decimal')), - eq_kettle_height: parseFloat($("#eq_kettle_height").jqxNumberInput('decimal')) / 100, - 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_mash_efficiency: 0, - brew_sparge_ph: 0.0, - brew_sparge_temperature: 85, - brew_sparge_est: 0, - brew_preboil_volume: 0, - brew_preboil_sg: 0, - brew_preboil_ph: 0.0, - brew_preboil_efficiency: 0, - brew_aboil_volume: 0, - brew_aboil_sg: 0, - brew_aboil_ph: 0.0, - brew_aboil_efficiency: 0, - brew_cooling_method: 0, - brew_cooling_time: 0, - brew_cooling_to: 20, - brew_whirlpool9: 0, - brew_whirlpool7: 0, - brew_whirlpool6: 0, - brew_whirlpool2: 0, - brew_fermenter_volume: parseFloat($("#eq_batch_size").jqxNumberInput('decimal')) - - parseFloat($("#eq_trub_chiller_loss").jqxNumberInput('decimal')) + - parseFloat($("#eq_top_up_water").jqxNumberInput('decimal')), - brew_fermenter_extrawater: parseFloat($("#eq_top_up_water").jqxNumberInput('decimal')), - brew_fermenter_tcloss: parseFloat($("#eq_trub_chiller_loss").jqxNumberInput('decimal')), - brew_aeration_time: 0, - brew_aeration_speed: 0, - brew_aeration_type: 0, - brew_fermenter_sg: 0, - brew_fermenter_ibu: 0, - brew_fermenter_color: 0, - brew_date_end: '', - og: 0, - fg: 0, - primary_start_temp: 0, - primary_max_temp: 0, - primary_end_temp: 0, - primary_end_sg: 0, - primary_end_date: '', - secondary_temp: 0, - secondary_end_date: '', - tertiary_temp: 0, - package_date: '', - package_volume: 0, - package_infuse_amount: 0, - package_infuse_abv: 0, - package_infuse_notes: '', - package_abv: 0, - package_ph: 0, - bottle_amount: 0, - bottle_carbonation: 0, - bottle_priming_water: 0, - bottle_priming_amount: 0, - bottle_carbonation_temp: 23, - keg_amount: 0, - keg_carbonation: 0, - keg_priming_water: 0, - keg_priming_amount: 0, - keg_carbonation_temp: 23, - keg_forced_carb: 1, - keg_pressure: 0, - taste_notes: '', - taste_rate: 0, - taste_date: '', - taste_color: '', - taste_transparency: '', - taste_head: '', - taste_aroma: '', - taste_taste: '', - taste_mouthfeel: '', - taste_aftertaste: '', - st_name: $('#st_name').val(), - st_letter: $('#st_letter').val(), - st_guide: $('#st_guide').val(), - st_type: style_type, - st_category: $('#st_category').val(), - st_category_number: parseFloat($("#st_category_number").jqxNumberInput('decimal')), - 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: recipe_type, - 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, - color_method: 0, - est_ibu: 0, - ibu_method: 0, - mash_name: "", - mash_ph: 5.4, - sparge_temp: 85.0, - sparge_volume: parseFloat($("#eq_boil_size").jqxNumberInput('decimal')) / 2, - sparge_ph: 5.8, - sparge_source: 0, - sparge_acid_type: 0, - sparge_acid_perc: 80, - sparge_acid_amount: 0, - calc_acid: 1, - w1_name: 'Tap water', - w1_amount: parseFloat($("#eq_mash_volume").jqxNumberInput('decimal')), - w1_calcium: 0, - w1_sulfate: 0, - w1_chloride: 0, - w1_sodium: 0, - w1_magnesium: 0, - w1_total_alkalinity: 0, - w1_ph: 7.0, - w1_cost: 0.0, - wa_acid_name: 0, // Lactic acid - wa_acid_perc: 80, - wa_base_name: 0, - wg_amount: parseFloat($("#eq_mash_volume").jqxNumberInput('decimal')), - wg_calcium: 0, - wg_sulfate: 0, - wg_chloride: 0, - wg_sodium: 0, - wg_magnesium: 0, - wg_total_alkalinity: 0, - wg_ph: 7.0, - wb_calcium: 0, - wb_sulfate: 0, - wb_sodium: 0, - wb_chloride: 0, - wb_magnesium: 0, - wb_total_alkalinity: 0, - wb_ph: 0, - starter_enable: 0, - divide_type: 0, - divide_size: 0, - divide_parts: 0 - }; - data = "insert=true&return=" + my_return + "&" + $.param(newrow); - $.ajax({ - dataType: 'json', - url: "includes/db_product.php", - cache: false, - data: data, - type: "POST", - success: function (data, status, xhr) { - // update command is executed. - window.location.href = my_return; - }, - error: function(jqXHR, textStatus, errorThrown) { - } - }); - }); - $('.nextButton').click(function () { - wizard.validate(true); - $('#jqxTabs').jqxTabs('next'); - }); - $('.backButton').click(function () { - wizard.validate(true); - $('#jqxTabs').jqxTabs('previous'); - }); - }; + //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() { + var d = new Date(), + m = d.getMonth() + 1, + b = d.getFullYear() + '-', + newrow, data; + if (m < 10) + b = b + '0'; + b = b + m + '-'; + if (d.getDate() < 10) + b = b + '0'; + b = b + d.getDate(); + newrow = { + record: -1, + name: $('#name').val(), + code: $('#code').val(), + birth: b, + stage: 0, + notes: $('#notes').val(), + log_brew: 0, + log_fermentation: 0, + inventory_reduced: 0, + locked: 0, + 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: parseFloat($('#eq_tun_weight').jqxNumberInput('decimal')), + eq_tun_specific_heat: parseFloat($('#eq_tun_specific_heat').jqxNumberInput('decimal')), + eq_tun_material: tun_material, + eq_tun_height: parseFloat($('#eq_tun_height').jqxNumberInput('decimal')) / 100, + 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: $('#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: parseFloat($('#eq_lauter_height').jqxNumberInput('decimal')) / 100, + eq_lauter_deadspace: parseFloat($('#eq_lauter_deadspace').jqxNumberInput('decimal')), + eq_kettle_volume: parseFloat($('#eq_kettle_volume').jqxNumberInput('decimal')), + eq_kettle_height: parseFloat($('#eq_kettle_height').jqxNumberInput('decimal')) / 100, + 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_mash_efficiency: 0, + brew_sparge_ph: 0.0, + brew_sparge_temperature: 85, + brew_sparge_est: 0, + brew_preboil_volume: 0, + brew_preboil_sg: 0, + brew_preboil_ph: 0.0, + brew_preboil_efficiency: 0, + brew_aboil_volume: 0, + brew_aboil_sg: 0, + brew_aboil_ph: 0.0, + brew_aboil_efficiency: 0, + brew_cooling_method: 0, + brew_cooling_time: 0, + brew_cooling_to: 20, + brew_whirlpool9: 0, + brew_whirlpool7: 0, + brew_whirlpool6: 0, + brew_whirlpool2: 0, + brew_fermenter_volume: parseFloat($('#eq_batch_size').jqxNumberInput('decimal')) - + parseFloat($('#eq_trub_chiller_loss').jqxNumberInput('decimal')) + + parseFloat($('#eq_top_up_water').jqxNumberInput('decimal')), + brew_fermenter_extrawater: parseFloat($('#eq_top_up_water').jqxNumberInput('decimal')), + brew_fermenter_tcloss: parseFloat($('#eq_trub_chiller_loss').jqxNumberInput('decimal')), + brew_aeration_time: 0, + brew_aeration_speed: 0, + brew_aeration_type: 0, + brew_fermenter_sg: 0, + brew_fermenter_ibu: 0, + brew_fermenter_color: 0, + brew_date_end: '', + og: 0, + fg: 0, + primary_start_temp: 0, + primary_max_temp: 0, + primary_end_temp: 0, + primary_end_sg: 0, + primary_end_date: '', + secondary_temp: 0, + secondary_end_date: '', + tertiary_temp: 0, + package_date: '', + package_volume: 0, + package_infuse_amount: 0, + package_infuse_abv: 0, + package_infuse_notes: '', + package_abv: 0, + package_ph: 0, + bottle_amount: 0, + bottle_carbonation: 0, + bottle_priming_water: 0, + bottle_priming_amount: 0, + bottle_carbonation_temp: 23, + keg_amount: 0, + keg_carbonation: 0, + keg_priming_water: 0, + keg_priming_amount: 0, + keg_carbonation_temp: 23, + keg_forced_carb: 1, + keg_pressure: 0, + taste_notes: '', + taste_rate: 0, + taste_date: '', + taste_color: '', + taste_transparency: '', + taste_head: '', + taste_aroma: '', + taste_taste: '', + taste_mouthfeel: '', + taste_aftertaste: '', + st_name: $('#st_name').val(), + st_letter: $('#st_letter').val(), + st_guide: $('#st_guide').val(), + st_type: style_type, + st_category: $('#st_category').val(), + st_category_number: parseFloat($('#st_category_number').jqxNumberInput('decimal')), + 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: recipe_type, + 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, + color_method: 0, + est_ibu: 0, + ibu_method: 0, + mash_name: '', + mash_ph: 5.4, + sparge_temp: 85.0, + sparge_volume: parseFloat($('#eq_boil_size').jqxNumberInput('decimal')) / 2, + sparge_ph: 5.8, + sparge_source: 0, + sparge_acid_type: 0, + sparge_acid_perc: 80, + sparge_acid_amount: 0, + calc_acid: 1, + w1_name: 'Tap water', + w1_amount: parseFloat($('#eq_mash_volume').jqxNumberInput('decimal')), + w1_calcium: 0, + w1_sulfate: 0, + w1_chloride: 0, + w1_sodium: 0, + w1_magnesium: 0, + w1_total_alkalinity: 0, + w1_ph: 7.0, + w1_cost: 0.0, + wa_acid_name: 0, // Lactic acid + wa_acid_perc: 80, + wa_base_name: 0, + wg_amount: parseFloat($('#eq_mash_volume').jqxNumberInput('decimal')), + wg_calcium: 0, + wg_sulfate: 0, + wg_chloride: 0, + wg_sodium: 0, + wg_magnesium: 0, + wg_total_alkalinity: 0, + wg_ph: 7.0, + wb_calcium: 0, + wb_sulfate: 0, + wb_sodium: 0, + wb_chloride: 0, + wb_magnesium: 0, + wb_total_alkalinity: 0, + wb_ph: 0, + starter_enable: 0, + divide_type: 0, + divide_size: 0, + divide_parts: 0 + }; + data = 'insert=true&return=' + my_return + '&' + $.param(newrow); + $.ajax({ + dataType: 'json', + url: 'includes/db_product.php', + cache: false, + data: data, + type: 'POST', + success: function(data, status, xhr) { + window.location.href = my_return; + }, + error: function(jqXHR, textStatus, errorThrown) { + } + }); + }); + $('.nextButton').click(function() { + wizard.validate(true); + $('#jqxTabs').jqxTabs('next'); + }); + $('.backButton').click(function() { + wizard.validate(true); + $('#jqxTabs').jqxTabs('previous'); + }); + }; - return { - //Initializing the wizzard - creating all elements, adding event handlers and starting the validation - init: function () { - $('#jqxTabs').jqxTabs({ - theme: theme, - height: 630, - width: 1280, - autoHeight: false, - position: 'top', - keyboardNavigation: false - }); - $('#nextButtonBase').jqxButton({ theme: theme, width: 150 }); - $('#nextButtonStyle').jqxButton({ theme: theme, width: 150}); - $('#backButtonStyle').jqxButton({ theme: theme, template: 'success', width: 150}); - $('#nextButtonEq').jqxButton({ theme: theme, width: 150}); - $('#backButtonEq').jqxButton({ theme: theme, template: 'success', width: 150}); - $('#nextButtonCompleted').jqxButton({ theme: theme, template: 'success', width: 150}); - $('#backButtonCompleted').jqxButton({ theme: theme, template: 'success', width: 150}); - _addHandlers(); - this.validate(); - this.showHint('Validation hints.'); - }, + return { + //Initializing the wizzard - creating all elements, adding event handlers and starting the validation + init: function() { + $('#jqxTabs').jqxTabs({ + theme: theme, + height: 630, + width: 1280, + autoHeight: false, + position: 'top', + keyboardNavigation: false + }); + $('#nextButtonBase').jqxButton({ theme: theme, width: 150 }); + $('#nextButtonStyle').jqxButton({ theme: theme, width: 150}); + $('#backButtonStyle').jqxButton({ theme: theme, template: 'success', width: 150}); + $('#nextButtonEq').jqxButton({ theme: theme, width: 150}); + $('#backButtonEq').jqxButton({ theme: theme, template: 'success', width: 150}); + $('#nextButtonCompleted').jqxButton({ theme: theme, template: 'success', width: 150}); + $('#backButtonCompleted').jqxButton({ theme: theme, template: 'success', width: 150}); + _addHandlers(); + this.validate(); + this.showHint('Validation hints.'); + }, - //Validating all wizard tabs - validate: function (notify) { - 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); - } - }, + //Validating all wizard tabs + validate: function(notify) { + 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 - showHint: function (message, selector) { - if (typeof selector === 'undefined') { - selector = '.hint'; - } - if (message === '') { - message = 'Ok, je mag doorgaan.'; - } - $(selector).html('' + message + ''); - }, + //Displaying message to the user + showHint: function(message, selector) { + if (typeof selector === 'undefined') { + selector = '.hint'; + } + if (message === '') { + message = 'Ok, je mag doorgaan.'; + } + $(selector).html('' + message + ''); + }, - //Validating the first tab - firstTab: function (notify) { - var name = $('#name').val(), - code = $('#code').val(), - message = ''; - if (name.length < 3) { - message += 'Je moet een brouw project naam invullen.
'; - } - 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'); - } - return false; - } - this.showHint('Ok, je mag doorgaan.', '#hintBase'); - $('#nextButtonBase').jqxButton({ template: 'success' }); - return true; - }, + //Validating the first tab + firstTab: function(notify) { + var name = $('#name').val(), code = $('#code').val(), message = ''; + if (name.length < 3) { + message += 'Je moet een brouw project naam invullen.
'; + } + 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'); + } + return false; + } + this.showHint('Ok, je mag doorgaan.', '#hintBase'); + $('#nextButtonBase').jqxButton({ template: 'success' }); + return true; + }, - //Validating the second tab - secondTab: function (notify) { - var stylesel = $('#styleSelect').val(), - message = ''; - if (stylesel.length < 3) { - message += 'Je moet een bierstijl kiezen.
'; - } - if (message !== '') { - if (notify) { - this.showHint(message, '#hintStyle'); - } - return false; - } - this.showHint('Ok, je mag doorgaan.', '#hintStyle'); - $('#nextButtonStyle').jqxButton({ template: 'success' }); - return true; - }, + //Validating the second tab + secondTab: function(notify) { + var stylesel = $('#styleSelect').val(), message = ''; + if (stylesel.length < 3) { + message += 'Je moet een bierstijl kiezen.
'; + } + if (message !== '') { + if (notify) { + this.showHint(message, '#hintStyle'); + } + return false; + } + this.showHint('Ok, je mag doorgaan.', '#hintStyle'); + $('#nextButtonStyle').jqxButton({ template: 'success' }); + 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'); - $('#nextButtonEq').jqxButton({ template: 'success' }); - 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'); + $('#nextButtonEq').jqxButton({ template: 'success' }); + return true; + } + }; + } ()); - //Initializing the wizard - wizard.init(); + //Initializing the wizard + wizard.init(); });