# HG changeset patch # User Michiel Broek # Date 1543699486 -3600 # Node ID ae5e8d74017314e26746f8df814b0c918b39c79a # Parent 07daa505d3094b294988c102e45bc29e5779a029 Renamed some fields in prod_main to prevent ambigous names with the join. Delete product also deletes the corresponding recipe. Fixed equipment load and save. Read data from the product main joined with prod_recipes completed. The brewday page is now almost complete, the calculations must be added. diff -r 07daa505d309 -r ae5e8d740173 www/import/from_brouwhulp.php --- a/www/import/from_brouwhulp.php Fri Nov 30 22:11:47 2018 +0100 +++ b/www/import/from_brouwhulp.php Sat Dec 01 22:24:46 2018 +0100 @@ -974,18 +974,18 @@ $stage = "Plan"; // Default value. $uuid = str_replace("\n", "", file_get_contents('/proc/sys/kernel/random/uuid')); - $psql = "INSERT INTO prod_main SET uuid='" . $uuid; // So we can link the records. + $psql = "INSERT INTO prod_main SET puuid='" . $uuid; // So we can link the records. $rsql = "INSERT INTO prod_recipes SET uuid='" . $uuid; - $psql .= "', name='" . mysqli_real_escape_string($db, $recipe->NAME); + $psql .= "', pname='" . mysqli_real_escape_string($db, $recipe->NAME); $rsql .= "', name='" . mysqli_real_escape_string($db, $recipe->NAME); if ($recipe->NOTES) { $rsql .= "', notes='" . mysqli_real_escape_string($db, $recipe->NOTES); // Duplicate the notes - $psql .= "', notes='" . mysqli_real_escape_string($db, $recipe->NOTES); + $psql .= "', pnotes='" . mysqli_real_escape_string($db, $recipe->NOTES); } else { $rsql .= "', notes='"; - $psql .= "', notes='"; + $psql .= "', pnotes='"; } if ($recipe->TYPE) $rsql .= "', type='" . mysqli_real_escape_string($db, $recipe->TYPE); @@ -1321,11 +1321,11 @@ ($recipe->INVENTORY_REDUCED == 'TRUE') ? $psql .= "', inventory_reduced='1" : $psql .= "', inventory_reduced='0"; if (($recipe->LOCKED == 'TRUE') && ($stage == 'Ready')) { - $psql .= "', locked='1"; + $psql .= "', plocked='1"; $rsql .= "', locked='1"; $stage = "Closed"; } else { - $psql .= "', locked='0"; + $psql .= "', plocked='0"; $rsql .= "', locked='0"; } diff -r 07daa505d309 -r ae5e8d740173 www/includes/db_product.php --- a/www/includes/db_product.php Fri Nov 30 22:11:47 2018 +0100 +++ b/www/includes/db_product.php Sat Dec 01 22:24:46 2018 +0100 @@ -22,32 +22,23 @@ $sql = "UPDATE `prod_main` SET "; } // Basic settings - $sql .= "uuid='" . $_POST['uuid']; - $sql .= "', name='" . mysqli_real_escape_string($connect, $_POST['name']); + $sql .= "puuid='" . $_POST['puuid']; + $sql .= "', pname='" . mysqli_real_escape_string($connect, $_POST['pname']); $sql .= "', birth='" . $_POST['birth']; $sql .= "', stage='" . $_POST['stage']; - $sql .= "', notes='" . mysqli_real_escape_string($connect, $_POST['notes']); + $sql .= "', pnotes='" . mysqli_real_escape_string($connect, $_POST['pnotes']); ($_POST['log_brew'] == 'true') ? $sql .= "', log_brew='1" : $sql .= "', log_brew='0"; ($_POST['log_fermentation'] == 'true') ? $sql .= "', log_fermentation='1" : $sql .= "', log_fermentation='0"; ($_POST['inventory_reduced'] == 'true') ? $sql .= "', inventory_reduced='1" : $sql .= "', inventory_reduced='0"; - ($_POST['locked'] == 'true') ? $sql .= "', locked='1" : $sql .= "', locked='0"; + ($_POST['plocked'] == 'true') ? $sql .= "', plocked='1" : $sql .= "', plocked='0"; // Equipment $sql .= "', eq_name='" . mysqli_real_escape_string($connect, $_POST['eq_name']); $sql .= "', eq_boil_size='" . $_POST['eq_boil_size']; $sql .= "', eq_batch_size='" . $_POST['eq_batch_size']; $sql .= "', eq_tun_volume='" . $_POST['eq_tun_volume']; $sql .= "', eq_tun_weight='" . $_POST['eq_tun_weight']; - $material = mysqli_real_escape_string($connect, $_GET['tun_material']); - $sql .= "', eq_tun_material='" . $material; - if ($material == "RVS") { - $sql .= "', eq_tun_specific_heat='0.11"; - } else if ($material == "Aluminium") { - $sql .= "', eq_tun_specific_heat='0.22"; - } else if ($material == "Kunststof") { - $sql .= "', eq_tun_specific_heat='0.46"; - } else if ($material == "Koper") { - $sql .= "', eq_tun_specific_heat='0.092"; - } + $sql .= "', eq_tun_specific_heat='" . $_POST['eq_tun_specific_heat']; + $sql .= "', eq_tun_material='" . mysqli_real_escape_string($connect, $_POST['eq_tun_material']); $sql .= "', eq_tun_height='" . $_POST['eq_tun_height']; $sql .= "', eq_top_up_water='" . $_POST['eq_top_up_water']; $sql .= "', eq_trub_chiller_loss='" . $_POST['eq_trub_chiller_loss']; @@ -56,6 +47,7 @@ $sql .= "', eq_calc_boil_volume='" . $_POST['eq_calc_boil_volume']; $sql .= "', eq_top_up_kettle='" . $_POST['eq_top_up_kettle']; $sql .= "', eq_hop_utilization='" . $_POST['eq_hop_utilization']; + $sql .= "', eq_notes='" . mysqli_real_escape_string($connect, $_POST['eq_notes']); $sql .= "', eq_lauter_volume='" . $_POST['eq_lauter_volume']; $sql .= "', eq_lauter_height='" . $_POST['eq_lauter_height']; $sql .= "', eq_lauter_deadspace='" . $_POST['eq_lauter_deadspace']; @@ -63,7 +55,6 @@ $sql .= "', eq_kettle_height='" . $_POST['eq_kettle_height']; $sql .= "', eq_mash_volume='" . $_POST['eq_mash_volume']; $sql .= "', eq_efficiency='" . $_POST['eq_efficiency']; - $sql .= "', eq_top_up_water='" . $_POST['eq_top_up_water']; syslog(LOG_NOTICE, $sql); if (isset($_POST['insert'])) { @@ -76,7 +67,9 @@ // $result = mysqli_query($connect, $sql); // if (! $result) { -// syslog(LOG_NOTICE, "db_product: result: ".mysqli_error($connect)); + // syslog(LOG_NOTICE, "db_product: result: ".mysqli_error($connect)); + // echo $result; + // return; // } else { // if (isset($_POST['update'])) { // syslog(LOG_NOTICE, "db_product: updated record ".$_POST['record']); @@ -88,30 +81,37 @@ // echo $result; } else if (isset($_POST['delete'])) { - // DELETE COMMAND - $sql = "DELETE FROM `prod_main` WHERE record='".$_POST['record']."';"; - syslog(LOG_NOTICE, $sql); -// $result = mysqli_query($connect, $sql); -// if (! $result) { -// syslog(LOG_NOTICE, "db_product: result: ".mysqli_error($connect)); -// } else { -// syslog(LOG_NOTICE, "db_product: deleted record ".$_POST['record']); -// } -// echo $result; + /* + * DELETE command, first delete the recipe and then the product. + */ + $sql = "DELETE FROM `prod_recipes` WHERE uuid='".$_POST['uuid']."';"; + $result = mysqli_query($connect, $sql); + if (! $result) { + syslog(LOG_NOTICE, "db_product: ".$sql." result: ".mysqli_error($connect)); + } else { + syslog(LOG_NOTICE, "db_product: deleted recipe uuid ".$_POST['uuid']); + } + + $sql = "DELETE FROM `prod_main` WHERE puuid='".$_POST['uuid']."';"; + $result = mysqli_query($connect, $sql); + if (! $result) { + syslog(LOG_NOTICE, "db_product: ".$sql." result: ".mysqli_error($connect)); + } else { + syslog(LOG_NOTICE, "db_product: deleted product uuid ".$_POST['uuid']); + } + echo $result; } else { -// syslog(LOG_NOTICE, "db_product: select"); -// if (isset($_GET['select'])) { -// syslog(LOG_NOTICE, "db_product: select isset ".$_GET['select']); -// } - // SELECT COMMAND + /* + * SELECT, produce a list of products that are not yet Closed. + */ if (isset($_GET['select']) && ($_GET['select'] == "inprod")) { - $query = "SELECT record,name,code,birth,stage FROM prod_main WHERE stage != 'Closed' ORDER BY birth,code;"; + $query = "SELECT record,pname,code,birth,stage FROM prod_main WHERE stage != 'Closed' ORDER BY birth,code;"; $result = mysqli_query($connect, $query) or die("SQL Error 1: " . mysqli_error($connect)); while ($row = mysqli_fetch_array($result, MYSQLI_ASSOC)) { $brews[] = array( 'record' => $row['record'], - 'name' => $row['name'], + 'pname' => $row['pname'], 'code' => $row['code'], 'birth' => $row['birth'], 'stage' => $row['stage'] @@ -122,16 +122,14 @@ } /* - * Default, select all + * Default, select all or a given record. */ if (isset($_GET['record'])) { - syslog(LOG_NOTICE, "Request record GET " . $_GET['record']); - } else if (isset($_POST['record'])) { - syslog(LOG_NOTICE, "Request record POST " . $_POST['record']); + $query = "SELECT * FROM prod_main LEFT JOIN prod_recipes ON puuid = uuid WHERE prod_main.record='"; + $query .= $_GET['record'] . "';"; } else { - syslog(LOG_NOTICE, "No record requested"); + $query = "SELECT * FROM prod_main LEFT JOIN prod_recipes ON puuid = uuid ORDER BY birth,code;"; } - $query = "SELECT * FROM prod_main LEFT JOIN prod_recipes ON prod_main.uuid = prod_recipes.uuid ORDER BY birth,code;"; $result = mysqli_query($connect, $query) or die("SQL Error 1: " . mysqli_error($connect)); $brews = '['; $comma = FALSE; @@ -141,16 +139,16 @@ $brews .= ','; $comma = TRUE; $brew = '{"record":' . $row['record']; - $brew .= ',"uuid":"' . str_replace($escapers, $replacements, $row['uuid']); - $brew .= '","name":"' . str_replace($escapers, $replacements, $row['name']); + $brew .= ',"puuid":"' . str_replace($escapers, $replacements, $row['puuid']); + $brew .= '","pname":"' . str_replace($escapers, $replacements, $row['pname']); $brew .= '","code":"' . str_replace($escapers, $replacements, $row['code']); $brew .= '","birth":"' . str_replace($escapers, $replacements, $row['birth']); $brew .= '","stage":"' . str_replace($escapers, $replacements, $row['stage']); - $brew .= '","notes":"' . str_replace($escapers, $replacements, $row['notes']); + $brew .= '","pnotes":"' . str_replace($escapers, $replacements, $row['pnotes']); $brew .= '","log_brew":' . $row['log_brew']; $brew .= ',"log_fermentation":' . $row['log_fermentation']; $brew .= ',"inventory_reduced":' . $row['inventory_reduced']; - $brew .= ',"locked":' . $row['locked']; + $brew .= ',"plocked":' . $row['plocked']; $brew .= ',"eq_name":"' . str_replace($escapers, $replacements, $row['eq_name']); $brew .= '","eq_notes":"' . str_replace($escapers, $replacements, $row['eq_notes']); $brew .= '","eq_boil_size":' . floatval($row['eq_boil_size']); @@ -199,8 +197,8 @@ $brew .= ',"brew_fermenter_extrawater":' . floatval($row['brew_fermenter_extrawater']); $brew .= ',"brew_aeration_time":' . floatval($row['brew_aeration_time']); $brew .= ',"brew_aeration_speed":' . floatval($row['brew_aeration_speed']); - $brew .= ',"brew_aeration_type":' . floatval($row['brew_aeration_type']); - $brew .= ',"brew_fermenter_sg":' . floatval($row['brew_fermenter_sg']); + $brew .= ',"brew_aeration_type":"' . $row['brew_aeration_type']; + $brew .= '","brew_fermenter_sg":' . floatval($row['brew_fermenter_sg']); $brew .= ',"brew_fermenter_ibu":' . floatval($row['brew_fermenter_ibu']); $brew .= ',"brew_date_end":"' . $row['brew_date_end']; $brew .= '","brew_log_available":' . $row['brew_log_available']; @@ -254,7 +252,7 @@ $brew .= ',"st_carb_max":' . floatval($row['st_carb_max']); $brew .= ',"st_abv_min":' . floatval($row['st_abv_min']); $brew .= ',"st_abv_max":' . floatval($row['st_abv_max']); - $brew .= ',"r_notes":"' . str_replace($escapers, $replacements, $row['notes']); + $brew .= ',"notes":"' . str_replace($escapers, $replacements, $row['notes']); $brew .= '","type":"' . $row['type']; $brew .= '","batch_size":' . floatval($row['batch_size']); $brew .= ',"boil_size":' . floatval($row['boil_size']); @@ -278,12 +276,9 @@ $brew .= ',"waters":' . $row['json_waters']; $brew .= ',"mashs":' . $row['json_mashs']; $brew .= '}'; -// syslog(LOG_NOTICE, $brew); $brews .= $brew; -// syslog(LOG_NOTICE, 'Size: '.strlen($brews).PHP_EOL); } $brews .= ']'; -// syslog(LOG_NOTICE, $brews); header("Content-type: application/json"); echo $brews; } diff -r 07daa505d309 -r ae5e8d740173 www/js/prod_edit.js --- a/www/js/prod_edit.js Fri Nov 30 22:11:47 2018 +0100 +++ b/www/js/prod_edit.js Sat Dec 01 22:24:46 2018 +0100 @@ -130,11 +130,11 @@ var dataReecord = {}; var url = "includes/db_product.php"; // tooltips - $("#name").jqxTooltip({ content: 'De naam voor dit product.' }); + $("#pname").jqxTooltip({ content: 'De naam voor dit product.' }); $("#code").jqxTooltip({ content: 'Product code nummer.' }); $("#birth").jqxTooltip({ content: 'De ontwerp datum van dit product.' }); $("#stage").jqxTooltip({ content: 'De productie fase van dit product.' }); - $("#notes").jqxTooltip({ content: 'De uitgebreide opmerkingen over dit product.' }); + $("#pnotes").jqxTooltip({ content: 'De uitgebreide opmerkingen over dit product.' }); $("#eq_name").jqxTooltip({ content: 'De naam van deze brouw apparatuur.' }); $("#eq_notes").jqxTooltip({ content: 'Opmerkingen over deze apparatuur.' }); $("#eq_tun_volume").jqxTooltip({ content: 'Maisch ketel volume.' }); @@ -161,17 +161,18 @@ datatype: "json", cache: false, datafields: [ + // From prod_main { name: 'record', type: 'number' }, - { name: 'uuid', type: 'string' }, - { name: 'name', type: 'string' }, + { name: 'puuid', type: 'string' }, + { name: 'pname', type: 'string' }, { name: 'code', type: 'string' }, { name: 'birth', type: 'string' }, { name: 'stage', type: 'string' }, - { name: 'notes', type: 'string' }, + { name: 'pnotes', type: 'string' }, { name: 'log_brew', type: 'bool' }, { name: 'log_fermentation', type: 'bool' }, { name: 'inventory_reduced', type: 'bool' }, - { name: 'locked', type: 'bool' }, + { name: 'plocked', type: 'bool' }, { name: 'eq_name', type: 'string' }, { name: 'eq_boil_size', type: 'float' }, { name: 'eq_batch_size', type: 'float' }, @@ -198,13 +199,111 @@ { name: 'brew_date_start', type: 'string' }, { name: 'brew_mash_ph', type: 'float' }, { name: 'brew_mash_sg', type: 'float' }, - - { name: 'brew_date_end', type: 'string' } + { name: 'brew_sparge_temperature', type: 'float' }, + { name: 'brew_sparge_volume', type: 'float' }, + { name: 'brew_preboil_volume', type: 'float' }, + { name: 'brew_preboil_sg', type: 'float' }, + { name: 'brew_preboil_ph', type: 'float' }, + { name: 'brew_aboil_volume', type: 'float' }, + { name: 'brew_aboil_sg', type: 'float' }, + { name: 'brew_aboil_ph', type: 'float' }, + { name: 'brew_aboil_efficiency', type: 'float' }, + { name: 'brew_cooling_method', type: 'string' }, + { name: 'brew_cooling_time', type: 'float' }, + { name: 'brew_cooling_to', type: 'float' }, + { name: 'brew_whirlpool9', type: 'float' }, + { name: 'brew_whirlpool7', type: 'float' }, + { name: 'brew_whirlpool6', type: 'float' }, + { name: 'brew_whirlpool2', type: 'float' }, + { name: 'brew_fermenter_volume', type: 'float' }, + { name: 'brew_fermenter_extrawater', type: 'float' }, + { name: 'brew_aeration_time', type: 'float' }, + { name: 'brew_aeration_speed', type: 'float' }, + { name: 'brew_aeration_type', type: 'string' }, + { name: 'brew_fermenter_sg', type: 'float' }, + { name: 'brew_fermenter_ibu', type: 'float' }, + { name: 'brew_date_end', type: 'string' }, + { name: 'brew_log_available', type: 'bool' }, + { name: 'primary_start_temp', type: 'float' }, + { name: 'primary_max_temp', type: 'float' }, + { name: 'primary_end_temp', type: 'float' }, + { name: 'primary_end_sg', type: 'float' }, + { name: 'primary_end_date', type: 'string' }, + { name: 'secondary_temp', type: 'float' }, + { name: 'secondary_end_date', type: 'string' }, + { name: 'tertiary_temp', type: 'float' }, + { name: 'package_date', type: 'string' }, + { name: 'bottle_amount', type: 'float' }, + { name: 'bottle_carbonation', type: 'float' }, + { name: 'bottle_priming_sugar', type: 'string' }, + { name: 'bottle_priming_amount', type: 'float' }, + { name: 'bottle_carbonation_temp', type: 'float' }, + { name: 'keg_amount', type: 'float' }, + { name: 'keg_carbonation', type: 'float' }, + { name: 'keg_priming_sugar', type: 'string' }, + { name: 'keg_priming_amount', type: 'float' }, + { name: 'keg_carbonation_temp', type: 'float' }, + { name: 'keg_forced_carb', type: 'bool' }, + { name: 'keg_pressure', type: 'float' }, + { name: 'keg_priming_factor', type: 'float' }, + { name: 'taste_notes', type: 'string' }, + { name: 'taste_rate', type: 'float' }, + { name: 'taste_date', type: 'string' }, + { name: 'taste_color', type: 'string' }, + { name: 'taste_transparency', type: 'string' }, + { name: 'taste_head', type: 'string' }, + { name: 'taste_aroma', type: 'string' }, + { name: 'taste_taste', type: 'string' }, + { name: 'taste_mouthfeel', type: 'string' }, + { name: 'taste_aftertaste', type: 'string' }, + // From prod_recipes + { name: 'uuid', type: 'string' }, + { name: 'locked', type: 'bool' }, + { name: 'st_name', type: 'string' }, + { name: 'st_letter', type: 'string' }, + { name: 'st_guide', type: 'string' }, + { name: 'st_category', type: 'string' }, + { name: 'st_category_number', type: 'float' }, + { name: 'st_type', type: 'string' }, + { name: 'st_og_min', type: 'float' }, + { name: 'st_og_max', type: 'float' }, + { name: 'st_fg_min', type: 'float' }, + { name: 'st_fg_max', type: 'float' }, + { name: 'st_ibu_min', type: 'float' }, + { name: 'st_ibu_max', type: 'float' }, + { name: 'st_color_min', type: 'float' }, + { name: 'st_color_max', type: 'float' }, + { name: 'st_carb_min', type: 'float' }, + { name: 'st_carb_max', type: 'float' }, + { name: 'st_abv_min', type: 'float' }, + { name: 'st_abv_max', type: 'float' }, + { name: 'name', type: 'string' }, + { name: 'notes', type: 'string' }, + { name: 'type', type: 'string' }, + { name: 'batch_size', type: 'float' }, + { name: 'boil_size', type: 'float' }, + { name: 'boil_time', type: 'float' }, + { name: 'efficiency', type: 'float' }, + { name: 'est_og', type: 'float' }, + { name: 'est_fg', type: 'float' }, + { name: 'est_abv', type: 'float' }, + { name: 'est_color', type: 'float' }, + { name: 'color_method', type: 'string' }, + { name: 'est_ibu', type: 'float' }, + { name: 'ibu_method', type: 'string' }, + { name: 'est_carb', type: 'float' }, + { name: 'mash_sparge_temp', type: 'float' }, + { name: 'mash_ph', type: 'float' }, + { name: 'mash_name', type: 'string' }, + { name: 'fermentables', type: 'array' }, + { name: 'hops', type: 'string' }, + { name: 'miscs', type: 'string' }, + { name: 'yeasts', type: 'string' }, + { name: 'waters', type: 'array' }, + { name: 'mashs', type: 'string' } ], id: 'record', -// data: "record=" + my_record, - url: url - // url: url + '?record=' + my_record, + url: url + '?record=' + my_record }; // Load data and select one record. var dataAdapter = new $.jqx.dataAdapter(source, { @@ -212,16 +311,16 @@ var records = dataAdapter.records; dataRecord = records[0]; // Hidden record uuid - this_uuid = dataRecord.uuid; - $("#name").val(dataRecord.name); + this_uuid = dataRecord.puuid; + $("#pname").val(dataRecord.pname); $("#code").val(dataRecord.code); $("#birth").val(dataRecord.birth); $("#stage").val(dataRecord.stage); - $("#notes").val(dataRecord.notes); + $("#pnotes").val(dataRecord.pnotes); $("#log_brew").val(dataRecord.log_brew); $("#log_fermentation").val(dataRecord.log_fermentation); $("#inventory_reduced").val(dataRecord.inventory_reduced); - $("#locked").val(dataRecord.locked); + $("#plocked").val(dataRecord.plocked); $("#eq_name").val(dataRecord.eq_name); $("#eq_notes").val(dataRecord.eq_notes); $("#eq_boil_size").val(dataRecord.eq_boil_size); @@ -245,9 +344,48 @@ $("#eq_kettle_height").val(dataRecord.eq_kettle_height); $("#eq_mash_volume").val(dataRecord.eq_mash_volume); $("#eq_efficiency").val(dataRecord.eq_efficiency); + // Brewdate $("#brew_date_start").val(dataRecord.brew_date_start); + $("#brew_mash_ph").val(dataRecord.brew_mash_ph); $("#brew_mash_sg").val(dataRecord.brew_mash_sg); + // brew_mash_efficiency to calculate on th fly. + // Header Spoelen en filteren + $("#brew_sparge_temperature").val(dataRecord.brew_sparge_temperature); + $("#brew_sparge_volume").val(dataRecord.brew_sparge_volume); + //$("#brew_sparge_ph").val(dataRecord.brew_sparge_ph); + // Header Beluchten + $("#brew_aeration_type").val(dataRecord.brew_aeration_type); + $("#brew_aeration_time").val(dataRecord.brew_aeration_time); + $("#brew_aeration_speed").val(dataRecord.brew_aeration_speed); + + $("#brew_preboil_ph").val(dataRecord.brew_preboil_ph); + $("#brew_preboil_sg").val(dataRecord.brew_preboil_sg); + $("#brew_preboil_volume").val(dataRecord.brew_preboil_volume); + //$("#brew_preboil_efficiency").val(dataRecord.brew_preboil_efficiency); + // Header Koelen en whirlpoolen + $("#brew_whirlpool9").val(dataRecord.brew_whirlpool9); + $("#brew_whirlpool7").val(dataRecord.brew_whirlpool7); + $("#brew_whirlpool6").val(dataRecord.brew_whirlpool6); + $("#brew_whirlpool2").val(dataRecord.brew_whirlpool2); + // Header Naar gistvat + $("#brew_fermenter_volume").val(dataRecord.brew_fermenter_volume); + $("#brew_fermenter_sg").val(dataRecord.brew_fermenter_sg); + $("#brew_fermenter_ibu").val(dataRecord.brew_fermenter_ibu); + + $("#brew_aboil_ph").val(dataRecord.brew_aboil_ph); + $("#brew_aboil_sg").val(dataRecord.brew_aboil_sg); + $("#brew_aboil_volume").val(dataRecord.brew_aboil_volume); + $("#brew_aboil_efficiency").val(dataRecord.brew_aboil_efficiency); + // Header Koelen en whirlpoolen + $("#brew_cooling_to").val(dataRecord.brew_cooling_to); + $("#brew_cooling_method").val(dataRecord.brew_cooling_method); + $("#brew_cooling_time").val(dataRecord.brew_cooling_time); + // Niks + // Header Naar gistvat + $("#brew_fermenter_extrawater").val(dataRecord.brew_fermenter_extrawater); + $("#brew_fermenter_extrasugar").val(dataRecord.brew_fermenter_extrasugar); + $("#brew_fermenter_color").val(dataRecord.brew_fermenter_color); $("#brew_date_end").val(dataRecord.brew_date_end); @@ -263,10 +401,10 @@ case 'Mature': brewstage = 8; break; case 'Taste': brewstage = 9; break; case 'Ready': brewstage = 10; - $("#locked").jqxCheckBox({ disabled:false }); + $("#plocked").jqxCheckBox({ disabled:false }); break; case 'Closed': brewstage = 11; - $("#locked").jqxCheckBox({ disabled:false }); + $("#plocked").jqxCheckBox({ disabled:false }); break; } // Enable or Disable settings depending on the stage. @@ -291,26 +429,20 @@ $("#inventory_reduced").jqxCheckBox({ disabled : true }); }, loadError: function (jqXHR, status, error) { - }, - beforeLoadComplete: function (records) { - var filteredRecords = []; - for (var i = 0; i < records.length; i++) { - if (records[i].record == my_record) { - filteredRecords.push(records[i]); - } - } - return filteredRecords; } }); dataAdapter.dataBind(); // initialize the input fields. var srcMaterial= [ "RVS", "Aluminium", "Kunststof", "Koper" ]; - $("#name").jqxInput({ theme: theme, width: 640, height: 23 }); + var srcAeration= [ 'None', 'Air', 'Oxygen' ]; + var srcCooling= [ '-', 'Emersion chiller', 'Counterflow chiller', 'Au bain marie', 'Natural' ]; + // '-', 'Dompelkoeler', 'Tegenstroomkoeler', 'Au bain marie', 'Laten afkoelen' + $("#pname").jqxInput({ theme: theme, width: 640, height: 23 }); $("#code").jqxInput({ theme: theme, width: 100, height: 23 }); $("#birth").jqxDateTimeInput({ theme: theme, width: 150, height: 23, formatString: 'yyyy-MM-dd' }); $("#stage").jqxInput({ theme: theme, width: 100, height: 23 }); - $("#notes").jqxInput({ theme: theme, width: 960, height: 200 }); + $("#pnotes").jqxInput({ theme: theme, width: 960, height: 200 }); $("#log_brew").jqxCheckBox({ theme: theme, width: 120, height: 23, disabled : true }); $("#log_fermentation").jqxCheckBox({ theme: theme, width: 120, height: 23, disabled : true }); $("#inventory_reduced").jqxCheckBox({ theme: theme, width: 120, height: 23 }); @@ -320,14 +452,18 @@ // Call the script with the uuid. $("#inventory_reduced").jqxCheckBox({ disabled : true }); }); - $("#locked").jqxCheckBox({ theme: theme, width: 120, height: 23, disabled : true }); - $('#locked').on('checked', function (event) { - $("#stage").val('Closed'); - brewstage = 11; + $("#plocked").jqxCheckBox({ theme: theme, width: 120, height: 23, disabled : true }); + $('#plocked').on('checked', function (event) { + if (brewstage >= 10) { + $("#stage").val('Closed'); + brewstage = 11; + } }); - $('#locked').on('unchecked', function (event) { - $("#stage").val('Ready'); - brewstage = 10; + $('#plocked').on('unchecked', function (event) { + if (brewstage >= 10) { + $("#stage").val('Ready'); + brewstage = 10; + } }); $("#eq_name").jqxInput({ theme: theme, width: 250, height: 23 }); $("#eq_boil_size").jqxNumberInput({ inputMode: 'simple', readOnly: true, theme: theme, width: 70, height: 23, decimalDigits: 1 }); @@ -352,12 +488,42 @@ $("#eq_kettle_height").jqxNumberInput({ inputMode: 'simple', readOnly: true, theme: theme, width: 70, height: 23, decimalDigits: 1 }); $("#eq_mash_volume").jqxNumberInput({ inputMode: 'simple', readOnly: true, theme: theme, width: 70, height: 23, decimalDigits: 1 }); $("#eq_efficiency").jqxNumberInput({ inputMode: 'simple', readOnly: true, theme: theme, width: 70, height: 23, decimalDigits: 1 }); - + // Brewday $("#brew_date_start").jqxDateTimeInput({ theme: theme, width: 230, height: 23, formatString: 'yyyy-MM-dd HH:mm:ss', showTimeButton: true }); - $("#brew_mash_ph").jqxNumberInput({ inputMode: 'simple', spinMode: 'simple', theme: theme, width: 70, height: 23, min: 0, decimalDigits: 1, spinButtons: true, spinButtonsStep: 0.1 }); + $("#brew_mash_ph").jqxNumberInput({ inputMode: 'simple', spinMode: 'simple', theme: theme, width: 90, height: 23, min: 0, decimalDigits: 1, spinButtons: true, spinButtonsStep: 0.1 }); $("#brew_mash_sg").jqxNumberInput({ inputMode: 'simple', spinMode: 'simple', theme: theme, width: 90, height: 23, min: 0, decimalDigits: 3, spinButtons: true, spinButtonsStep: 0.001 }); - + $("#brew_mash_efficiency").jqxNumberInput({ inputMode: 'simple', readOnly: true, theme: theme, width: 70, height: 23, decimalDigits: 1 }); + $("#brew_sparge_temperature").jqxNumberInput({ inputMode: 'simple', spinMode: 'simple', theme: theme, width: 90, height: 23, min: 0, decimalDigits: 1, spinButtons: true, spinButtonsStep: 0.1 }); + $("#brew_sparge_volume").jqxNumberInput({ inputMode: 'simple', spinMode: 'simple', theme: theme, width: 90, height: 23, min: 0, decimalDigits: 1, spinButtons: true, spinButtonsStep: 0.1 }); + $("#brew_sparge_ph").jqxNumberInput({ inputMode: 'simple', spinMode: 'simple', theme: theme, width: 90, height: 23, min: 0, decimalDigits: 1, spinButtons: true, spinButtonsStep: 0.1 }); + $("#brew_preboil_volume").jqxNumberInput({ inputMode: 'simple', spinMode: 'simple', theme: theme, width: 90, height: 23, min: 0, decimalDigits: 1, spinButtons: true, spinButtonsStep: 0.1 }); + $("#brew_preboil_sg").jqxNumberInput({ inputMode: 'simple', spinMode: 'simple', theme: theme, width: 90, height: 23, min: 0, decimalDigits: 3, spinButtons: true, spinButtonsStep: 0.001 }); + $("#brew_preboil_ph").jqxNumberInput({ inputMode: 'simple', spinMode: 'simple', theme: theme, width: 90, height: 23, min: 0, decimalDigits: 1, spinButtons: true, spinButtonsStep: 0.1 }); + $("#brew_preboil_efficiency").jqxNumberInput({ inputMode: 'simple', readOnly: true, theme: theme, width: 70, height: 23, decimalDigits: 1 }); + $("#brew_aboil_volume").jqxNumberInput({ inputMode: 'simple', spinMode: 'simple', theme: theme, width: 90, height: 23, min: 0, decimalDigits: 1, spinButtons: true, spinButtonsStep: 0.1 }); + $("#brew_aboil_sg").jqxNumberInput({ inputMode: 'simple', spinMode: 'simple', theme: theme, width: 90, height: 23, min: 0, decimalDigits: 3, spinButtons: true, spinButtonsStep: 0.001 }); + $("#brew_aboil_ph").jqxNumberInput({ inputMode: 'simple', spinMode: 'simple', theme: theme, width: 90, height: 23, min: 0, decimalDigits: 1, spinButtons: true, spinButtonsStep: 0.1 }); + $("#brew_aboil_efficiency").jqxNumberInput({ inputMode: 'simple', readOnly: true, theme: theme, width: 70, height: 23, decimalDigits: 1 }); + $("#brew_whirlpool9").jqxNumberInput({ inputMode: 'simple', spinMode: 'simple', theme: theme, width: 90, height: 23, min: 0, max: 120, decimalDigits: 0, spinButtons: true }); + $("#brew_whirlpool7").jqxNumberInput({ inputMode: 'simple', spinMode: 'simple', theme: theme, width: 90, height: 23, min: 0, max: 120, decimalDigits: 0, spinButtons: true }); + $("#brew_whirlpool6").jqxNumberInput({ inputMode: 'simple', spinMode: 'simple', theme: theme, width: 90, height: 23, min: 0, max: 120, decimalDigits: 0, spinButtons: true }); + $("#brew_whirlpool2").jqxNumberInput({ inputMode: 'simple', spinMode: 'simple', theme: theme, width: 90, height: 23, min: 0, max: 120, decimalDigits: 0, spinButtons: true }); + $("#brew_cooling_method").jqxDropDownList({ theme: theme, source: srcCooling, width: 170, height: 23, dropDownHeight: 153 }); + $("#brew_cooling_to").jqxNumberInput({ inputMode: 'simple', spinMode: 'simple', theme: theme, width: 90, height: 23, min: 0, decimalDigits: 1, spinButtons: true, spinButtonsStep: 0.1 }); + $("#brew_cooling_time").jqxNumberInput({ inputMode: 'simple', spinMode: 'simple', theme: theme, width: 90, height: 23, min: 0, max: 1440, decimalDigits: 0, spinButtons: true }); + $("#brew_aeration_type").jqxDropDownList({ theme: theme, source: srcAeration, width: 100, height: 23, dropDownHeight: 95 }); + $("#brew_aeration_time").jqxNumberInput({ inputMode: 'simple', spinMode: 'simple', theme: theme, width: 90, height: 23, min: 0, max: 1440, decimalDigits: 0, spinButtons: true }); + $("#brew_aeration_speed").jqxNumberInput({ inputMode: 'simple', spinMode: 'simple', theme: theme, width: 90, height: 23, min: 0, max: 1440, decimalDigits: 0, spinButtons: true }); + $("#brew_fermenter_volume").jqxNumberInput({ inputMode: 'simple', spinMode: 'simple', theme: theme, width: 90, height: 23, min: 0, decimalDigits: 1, spinButtons: true, spinButtonsStep: 0.1 }); + $("#brew_fermenter_extrawater").jqxNumberInput({ inputMode: 'simple', spinMode: 'simple', theme: theme, width: 90, height: 23, min: 0, decimalDigits: 1, spinButtons: true, spinButtonsStep: 0.1 }); + $("#brew_fermenter_extrasugar").jqxNumberInput({ inputMode: 'simple', spinMode: 'simple', theme: theme, width: 90, height: 23, min: 0, decimalDigits: 1, spinButtons: true, spinButtonsStep: 0.1 }); + $("#brew_fermenter_sg").jqxNumberInput({ inputMode: 'simple', readOnly: true, theme: theme, width: 70, height: 23, decimalDigits: 3 }); + $("#brew_fermenter_ibu").jqxNumberInput({ inputMode: 'simple', readOnly: true, theme: theme, width: 70, height: 23, decimalDigits: 0 }); + $("#brew_fermenter_color").jqxNumberInput({ inputMode: 'simple', readOnly: true, theme: theme, width: 70, height: 23, decimalDigits: 0 }); $("#brew_date_end").jqxDateTimeInput({ theme: theme, width: 230, height: 23, formatString: 'yyyy-MM-dd HH:mm:ss', showTimeButton: true }); + // Vergisting + // Packaging + // Tasting $('#jqxTabs').jqxTabs({ theme: theme, @@ -378,7 +544,7 @@ // Open a popup to confirm this action. $('#eventWindow').jqxWindow('open'); $("#delOk").click(function () { - var data = "delete=true&" + $.param({ record: my_record }); + var data = "delete=true&" + $.param({ uuid: this_uuid }); $.ajax({ dataType: 'json', url: url, @@ -404,16 +570,16 @@ $("#Save").click(function () { var row = { record: my_record, - uuid: this_uuid, - name: $("#name").val(), + puuid: this_uuid, + pname: $("#pname").val(), code: $("#code").val(), birth: $("#birth").val(), stage: $("#stage").val(), - notes: $("#notes").val(), + pnotes: $("#pnotes").val(), log_brew: $("#log_brew").val(), log_fermentation: $("#log_fermentation").val(), inventory_reduced: $("#inventory_reduced").val(), - locked: $("#locked").val(), + plocked: $("#plocked").val(), eq_name: $("#eq_name").val(), eq_boil_size: parseFloat($("#eq_boil_size").jqxNumberInput('decimal')), eq_batch_size: parseFloat($("#eq_batch_size").jqxNumberInput('decimal')), diff -r 07daa505d309 -r ae5e8d740173 www/js/prod_inprod.js --- a/www/js/prod_inprod.js Fri Nov 30 22:11:47 2018 +0100 +++ b/www/js/prod_inprod.js Sat Dec 01 22:24:46 2018 +0100 @@ -27,7 +27,7 @@ cache: false, datafields: [ { name: 'record', type: 'number' }, - { name: 'name', type: 'string' }, + { name: 'pname', type: 'string' }, { name: 'code', type: 'string' }, { name: 'birth', type: 'string' }, { name: 'stage', type: 'string' }, @@ -61,7 +61,7 @@ columns: [ { text: 'Datum', datafield: 'birth', width: 120 }, { text: 'Code', datafield: 'code', width: 120 }, - { text: 'Naam', datafield: 'name' }, + { text: 'Naam', datafield: 'pname' }, { text: 'Fase', datafield: 'stage', width: 150 }, { text: 'Wijzig', datafield: 'Edit', width: 120, align: 'center', columntype: 'button', cellsrenderer: function () { return "Wijzig"; diff -r 07daa505d309 -r ae5e8d740173 www/prod_edit.php --- a/www/prod_edit.php Fri Nov 30 22:11:47 2018 +0100 +++ b/www/prod_edit.php Sat Dec 01 22:24:46 2018 +0100 @@ -18,7 +18,7 @@ - + @@ -38,11 +38,11 @@ - + - +
Brouw naam:
Brouw code:
Afgesloten:
Opmerkingen:
@@ -158,9 +158,12 @@ - + - + + + + @@ -191,13 +194,17 @@ - + - + + + + + @@ -212,27 +219,31 @@ - + - + - + - - + + + + + + @@ -248,7 +259,7 @@ - +
Brouwdag start:
Brouwdag eind:
Maischen
Spoelen en filteren Rendement voor koken:
Rendement na koken:
Spoelen en filteren
Spoelwater temperatuur:
Koelen en whirlpoolen
Spoelwater pH:
Whirlpool 72..79°C:
Koelen met:
Beluchten Whirlpool 60..66°C:
Koelen tijd:
Beluchten met:
Beluchten Whirlpool koud:
Beluchten met:
Beluchten tijd:
Naar gistvat
SG in gistvat:
Extra suiker: