Tue, 19 Jul 2022 13:44:52 +0200
Removed inventory list, yeastbank list and all profile table editors.
www/includes/global.inc.php | file | annotate | diff | comparison | revisions | |
www/inv_instock.php | file | annotate | diff | comparison | revisions | |
www/inv_yeastlab.php | file | annotate | diff | comparison | revisions | |
www/js/profile_fermentation.js | file | annotate | diff | comparison | revisions | |
www/js/profile_mash.js | file | annotate | diff | comparison | revisions | |
www/js/profile_styles.js | file | annotate | diff | comparison | revisions | |
www/js/profile_water.js | file | annotate | diff | comparison | revisions | |
www/profile_fermentation.php | file | annotate | diff | comparison | revisions | |
www/profile_mash.php | file | annotate | diff | comparison | revisions | |
www/profile_styles.php | file | annotate | diff | comparison | revisions | |
www/profile_water.php | file | annotate | diff | comparison | revisions |
--- a/www/includes/global.inc.php Mon Jul 11 15:46:18 2022 +0200 +++ b/www/includes/global.inc.php Tue Jul 19 13:44:52 2022 +0200 @@ -264,16 +264,6 @@ <li><img style='float: left; margin-right: 5px;' src='images/peper.png' /><a href="inv_miscs.php">Overige ingredienten</a></li> <li><img style='float: left; margin-left: 3px; margin-right: 9px;' src='images/water.png' /><a href="inv_waters.php">Brouwwater</a></li> <li><img style='float: left; margin-right: 5px;' src='images/mash.png' /><a href="inv_equipments.php">Brouw apparatuur</a></li> - <li><img style='float: left; margin-left: 3px; margin-right: 8px;' src='images/database.png' /><a href="inv_instock.php">Voorraad lijst</a></li> - <li><img style='float: left; margin-left: 3px; margin-right: 8px;' src='images/science.png' /><a href="inv_yeastlab.php">Gistbank lijst</a></li> - </ul> - </li> - <li style='width: 80px;'>Instellingen - <ul style='width: 200px;'> - <li><img style='float: left; margin-left: 3px; margin-right: 9px;' src='images/water.png' /><a href="profile_water.php">Water profielen</a></li> - <li><img style='float: left; margin-right: 5px;' src='images/mash.png' /><a href="profile_mash.php">Maisch schemas</a></li> - <li><img style='float: left; margin-right: 5px;' src='images/beerstyles.png' /><a href="profile_styles.php">Bierstijlen</a></li> - <li><img style='float: left; margin-right: 5px;' src='images/fermenter.png' /><a href="profile_fermentation.php">Vergisting profielen</a></li> </ul> </li> <li style='width: 80px;'>Over
--- a/www/inv_instock.php Mon Jul 11 15:46:18 2022 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,302 +0,0 @@ -<?php -require_once($_SERVER['DOCUMENT_ROOT'].'/includes/global.inc.php'); -require_once($_SERVER['DOCUMENT_ROOT'].'/includes/constants.php'); -require_once($_SERVER['DOCUMENT_ROOT'].'/fpdf/fpdf.php'); - -define('EURO', chr(128) ); - -$link = mysqli_connect(DBASE_HOST,DBASE_USER,DBASE_PASS,DBASE_NAME); -if (! $link) { - die('Connect Error (' . mysqli_connect_errno() . ') ' . mysqli_connect_error()); -} -if (! mysqli_set_charset($link, "utf8" )) { - echo "error"; - return 1; -} - -setlocale ( LC_ALL, 'nl_NL.UTF-8'); - -class PDF_MySQL_Table extends FPDF -{ - protected $ProcessingTable=false; - protected $aCols=array(); - protected $TableX; - protected $HeaderColor; - protected $RowColors; - protected $TotalColor; - protected $ColorIndex; - - function Header() { - // Print the table header if necessary - if ($this->ProcessingTable) - $this->TableHeader(); - } - - function TableHeader() { - $this->SetFont('Helvetica','B',9); - $this->SetX($this->TableX); - $this->SetFillColor($this->HeaderColor[0],$this->HeaderColor[1],$this->HeaderColor[2]); - foreach($this->aCols as $col) - $this->Cell($col['w'],5,$col['c'],0,0,$col['a'],true); - $this->Ln(); - } - - function CalcWidths($width, $align) { - // Compute the widths of the columns - $TableWidth=0; - foreach($this->aCols as $i=>$col) { - $w=$col['w']; - if($w==-1) - $w=$width/count($this->aCols); - elseif(substr($w,-1)=='%') - $w=$w/100*$width; - $this->aCols[$i]['w']=$w; - $TableWidth+=$w; - } - // Compute the abscissa of the table - if($align=='C') - $this->TableX=max(($this->w-$TableWidth)/2,0); - elseif($align=='R') - $this->TableX=max($this->w-$this->rMargin-$TableWidth,0); - else - $this->TableX=$this->lMargin; - } - - function AddCol($width=-1, $caption='', $align='L') { - $this->aCols[]=array('c'=>$caption,'w'=>$width,'a'=>$align); - } - - function TableFermentables($link,$prop) { - global $fermentabletype; - $this->AddCol( 26,'Type','L'); - $this->AddCol( 26,'Leverancier','L'); - $this->AddCol( 68,'Vergistbaar ingredient','L'); - $this->AddCol( 30,'Voorraad','R'); - $this->AddCol( 20, 'Prijs/kg', 'R'); - $this->AddCol( 20, 'Waarde', 'R'); - $prop['width']=$this->w-$this->lMargin-$this->rMargin; - $prop['align']='L'; - $cMargin=$this->cMargin; - $this->cMargin=$prop['padding']; - $this->HeaderColor=$prop['HeaderColor']; - $this->TotalColor=$prop['TotalColor']; - $this->RowColors=array($prop['color1'],$prop['color2']); - $this->CalcWidths($prop['width'],$prop['align']); - $this->TableHeader(); - $this->SetFont('Helvetica','',9); - $this->ColorIndex=0; - $this->ProcessingTable=true; - - $sql = "SELECT type,name,supplier,inventory,cost FROM inventory_fermentables WHERE inventory > 0 ORDER BY type,supplier,name"; - $result = mysqli_query($link, $sql); - $tot_fermentables = 0.0; - - while($row=mysqli_fetch_array($result)) { - $value = $row['inventory'] * $row['cost']; - $tot_fermentables += $value; - - $this->SetX($this->TableX); - $ci=$this->ColorIndex; - $this->SetFillColor($this->RowColors[$ci][0],$this->RowColors[$ci][1],$this->RowColors[$ci][2]); - $this->Cell(26,5,$fermentabletype[$row['type']],0,0,'L',true); - $this->Cell(26,5,iconv('UTF-8','windows-1252',$row['supplier']),0,0,'L',true); - $this->Cell(68,5,iconv('UTF-8','windows-1252',$row['name']),0,0,'L',true); - $this->Cell(30,5,sprintf("%10.3f kg",$row['inventory']),0,0,'R',true); - $this->Cell(20,5,sprintf("%8.2f ",$row['cost']).EURO,0,0,'R',true); - $this->Cell(20,5,sprintf("%8.2f ",$value).EURO,0,0,'R',true); - $this->Ln(); - $this->ColorIndex=1-$ci; - } - - $this->SetX($this->TableX); - $this->SetFillColor($this->TotalColor[0],$this->TotalColor[1],$this->TotalColor[2]); - $this->Cell(170,5,'Totaal',0,0,'L',true); - $this->Cell(20,5,sprintf("%8.2f ",$tot_fermentables).EURO,0,0,'R',true); - $this->Ln(); - - $this->ProcessingTable=false; - $this->cMargin=$cMargin; - $this->aCols=array(); - } - - function TableHops($link,$prop) { - global $hopform; - $this->AddCol( 30,'Land','L'); - $this->AddCol( 75,'Hoppen','L'); - $this->AddCol( 15,'Soort','L'); - $this->AddCol( 30,'Voorraad','R'); - $this->AddCol( 20, 'Prijs/kg', 'R'); - $this->AddCol( 20, 'Waarde', 'R'); - $prop['width']=$this->w-$this->lMargin-$this->rMargin; - $prop['align']='L'; - $cMargin=$this->cMargin; - $this->cMargin=$prop['padding']; - $this->CalcWidths($prop['width'],$prop['align']); - $this->TableHeader(); - $this->SetFont('Helvetica','',9); - $this->ColorIndex=0; - $this->ProcessingTable=true; - - $result = mysqli_query($link, "SELECT name,form,origin,inventory,cost FROM inventory_hops WHERE inventory > 0 ORDER BY origin,name"); - $tot_hops = 0.0; - - while($row=mysqli_fetch_array($result)) { - $value = $row['inventory'] * $row['cost']; - $tot_hops += $value; - $stock = floatval($row['inventory']) * 1000.0; - - $this->SetX($this->TableX); - $ci=$this->ColorIndex; - $this->SetFillColor($this->RowColors[$ci][0],$this->RowColors[$ci][1],$this->RowColors[$ci][2]); - $this->Cell(30,5,iconv('UTF-8','windows-1252',$row['origin']),0,0,'L',true); - $this->Cell(75,5,iconv('UTF-8','windows-1252',$row['name']),0,0,'L',true); - $this->Cell(15,5,$hopform[$row['form']],0,0,'L',true); - $this->Cell(30,5,sprintf("%10.1f gr",$stock),0,0,'R',true); - $this->Cell(20,5,sprintf("%8.2f ",$row['cost']).EURO,0,0,'R',true); - $this->Cell(20,5,sprintf("%8.2f ",$value).EURO,0,0,'R',true); - $this->Ln(); - $this->ColorIndex=1-$ci; - } - - $this->SetX($this->TableX); - $this->SetFillColor($this->TotalColor[0],$this->TotalColor[1],$this->TotalColor[2]); - $this->Cell(170,5,'Totaal',0,0,'L',true); - $this->Cell(20,5,sprintf("%8.2f ",$tot_hops).EURO,0,0,'R',true); - $this->Ln(); - - $this->ProcessingTable=false; - $this->cMargin=$cMargin; - $this->aCols=array(); - } - - function TableYeasts($link,$prop) { - $this->AddCol( 30,'Laboratorium','L'); - $this->AddCol( 20,'Product','L'); - $this->AddCol( 70,'Gist','L'); - $this->AddCol( 30,'Voorraad','R'); - $this->AddCol( 20, 'Prijs/kg', 'R'); - $this->AddCol( 20, 'Waarde', 'R'); - $prop['width']=$this->w-$this->lMargin-$this->rMargin; - $prop['align']='L'; - $cMargin=$this->cMargin; - $this->cMargin=$prop['padding']; - $this->CalcWidths($prop['width'],$prop['align']); - $this->TableHeader(); - $this->SetFont('Helvetica','',9); - $this->ColorIndex=0; - $this->ProcessingTable=true; - - $sql = "SELECT name,laboratory,product_id,form,inventory,cost FROM inventory_yeasts WHERE inventory > 0 ORDER BY laboratory,product_id"; - $result = mysqli_query($link, $sql); - $tot_yeasts = 0.0; - - while($row=mysqli_fetch_array($result)) { - $value = $row['inventory'] * $row['cost']; - $tot_yeasts += $value; - if ($row['form'] == 0) - $stock = floatval($row['inventory']); - else - $stock = floatval($row['inventory']) * 1000.0; - $form = array( 'pak', 'gr', 'ml', 'ml', 'ml', 'ml' ); - - $this->SetX($this->TableX); - $ci=$this->ColorIndex; - $this->SetFillColor($this->RowColors[$ci][0],$this->RowColors[$ci][1],$this->RowColors[$ci][2]); - $this->Cell(30,5,iconv('UTF-8','windows-1252',$row['laboratory']),0,0,'L',true); - $this->Cell(20,5,iconv('UTF-8','windows-1252',$row['product_id']),0,0,'L',true); - $this->Cell(70,5,iconv('UTF-8','windows-1252',$row['name']),0,0,'L',true); - $this->Cell(30,5,sprintf("%10.1f ",$stock).$form[$row['form']],0,0,'R',true); - $this->Cell(20,5,sprintf("%8.2f ",$row['cost']).EURO,0,0,'R',true); - $this->Cell(20,5,sprintf("%8.2f ",$value).EURO,0,0,'R',true); - $this->Ln(); - $this->ColorIndex=1-$ci; - } - - $this->SetX($this->TableX); - $this->SetFillColor($this->TotalColor[0],$this->TotalColor[1],$this->TotalColor[2]); - $this->Cell(170,5,'Totaal',0,0,'L',true); - $this->Cell(20,5,sprintf("%8.2f ",$tot_yeasts).EURO,0,0,'R',true); - $this->Ln(); - - $this->ProcessingTable=false; - $this->cMargin=$cMargin; - $this->aCols=array(); - } - - function TableMiscs($link,$prop) { - global $misctype; - $this->AddCol( 30,'Type','L'); - $this->AddCol( 90,'Ingredient','L'); - $this->AddCol( 30,'Voorraad','R'); - $this->AddCol( 20, 'Prijs/kg', 'R'); - $this->AddCol( 20, 'Waarde', 'R'); - $prop['width']=$this->w-$this->lMargin-$this->rMargin; - $prop['align']='L'; - $cMargin=$this->cMargin; - $this->cMargin=$prop['padding']; - $this->CalcWidths($prop['width'],$prop['align']); - $this->TableHeader(); - $this->SetFont('Helvetica','',9); - $this->ColorIndex=0; - $this->ProcessingTable=true; - - $result = mysqli_query($link, "SELECT name,type,amount_is_weight,inventory,cost FROM inventory_miscs WHERE inventory > 0 ORDER BY type,name"); - $tot_miscs = 0.0; - - while($row=mysqli_fetch_array($result)) { - $value = $row['inventory'] * $row['cost']; - $tot_miscs += $value; - $stock = floatval($row['inventory']) * 1000.0; - ($row['amount_is_weight']) ? $amount = "gr" : $amount = "ml"; - - $this->SetX($this->TableX); - $ci=$this->ColorIndex; - $this->SetFillColor($this->RowColors[$ci][0],$this->RowColors[$ci][1],$this->RowColors[$ci][2]); - $this->Cell(30,5,$misctype[$row['type']],0,0,'L',true); - $this->Cell(90,5,iconv('UTF-8','windows-1252',$row['name']),0,0,'L',true); - $this->Cell(30,5,sprintf("%10.1f ",$stock).$amount,0,0,'R',true); - $this->Cell(20,5,sprintf("%8.2f ",$row['cost']).EURO,0,0,'R',true); - $this->Cell(20,5,sprintf("%8.2f ",$value).EURO,0,0,'R',true); - $this->Ln(); - $this->ColorIndex=1-$ci; - } - - $this->SetX($this->TableX); - $this->SetFillColor($this->TotalColor[0],$this->TotalColor[1],$this->TotalColor[2]); - $this->Cell(170,5,'Totaal',0,0,'L',true); - $this->Cell(20,5,sprintf("%8.2f ",$tot_miscs).EURO,0,0,'R',true); - $this->Ln(); - - $this->ProcessingTable=false; - $this->cMargin=$cMargin; - $this->aCols=array(); - } -} - - - -class PDF extends PDF_MySQL_Table { - function Header() { - $this->Image('images/logo.png',10,6,30); - // Title - $this->SetFont('Helvetica','',18); - $this->Cell(0,10,'Inventaris',0,1,'C'); - $this->Ln(20); - // Ensure table header is printed - parent::Header(); - } -} - - -$pdf = new PDF(); -$pdf->AddPage(); -$prop = array('HeaderColor'=>array(255,150,100), 'color1'=>array(210,245,255), - 'color2'=>array(255,255,210), 'TotalColor'=>array(255,150,100), 'padding'=>2); -$pdf->TableFermentables($link,$prop); -$pdf->Ln(10); -$pdf->TableHops($link,$prop); -$pdf->AddPage(); -$pdf->TableYeasts($link,$prop); -$pdf->Ln(10); -$pdf->TableMiscs($link,$prop); -$pdf->Output();
--- a/www/inv_yeastlab.php Mon Jul 11 15:46:18 2022 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,162 +0,0 @@ -<?php -require_once($_SERVER['DOCUMENT_ROOT'].'/includes/global.inc.php'); -require_once($_SERVER['DOCUMENT_ROOT'].'/includes/constants.php'); -require_once($_SERVER['DOCUMENT_ROOT'].'/fpdf/fpdf.php'); - -define('EURO', chr(128) ); - -$link = mysqli_connect(DBASE_HOST,DBASE_USER,DBASE_PASS,DBASE_NAME); -if (! $link) { - die('Connect Error (' . mysqli_connect_errno() . ') ' . mysqli_connect_error()); -} -if (! mysqli_set_charset($link, "utf8" )) { - echo "error"; - return 1; -} - -setlocale ( LC_ALL, 'nl_NL.UTF-8'); -date_default_timezone_set('Europe/Amsterdam'); -$prdate = date(DATE_RFC2822); - -$sql = "SELECT brewery_name,my_yeastlab FROM profile_setup WHERE record = '1';"; -$result = mysqli_query($link, $sql); -if ($row=mysqli_fetch_array($result)) { - $my_brewery = iconv('UTF-8','windows-1252',$row['brewery_name']); - $my_lab = $row['my_yeastlab']; -} else { - $my_brewery = $my_lab = ''; -} - - -class PDF_MySQL_Table extends FPDF -{ - protected $ProcessingTable=false; - protected $aCols=array(); - protected $TableX; - protected $HeaderColor; - protected $RowColors; - protected $TotalColor; - protected $ColorIndex; - - function Header() { - // Print the table header if necessary - if ($this->ProcessingTable) - $this->TableHeader(); - } - - function TableHeader() { - $this->SetFont('Helvetica','B',9); - $this->SetX($this->TableX); - $this->SetFillColor($this->HeaderColor[0],$this->HeaderColor[1],$this->HeaderColor[2]); - foreach($this->aCols as $col) - $this->Cell($col['w'],5,$col['c'],0,0,$col['a'],true); - $this->Ln(); - } - - function CalcWidths($width, $align) { - // Compute the widths of the columns - $TableWidth=0; - foreach($this->aCols as $i=>$col) { - $w=$col['w']; - if($w==-1) - $w=$width/count($this->aCols); - elseif(substr($w,-1)=='%') - $w=$w/100*$width; - $this->aCols[$i]['w']=$w; - $TableWidth+=$w; - } - // Compute the abscissa of the table - if($align=='C') - $this->TableX=max(($this->w-$TableWidth)/2,0); - elseif($align=='R') - $this->TableX=max($this->w-$this->rMargin-$TableWidth,0); - else - $this->TableX=$this->lMargin; - } - - function AddCol($width=-1, $caption='', $align='L') { - $this->aCols[]=array('c'=>$caption,'w'=>$width,'a'=>$align); - } - - function TableYeasts($link,$prop) { - global $yeasttype; - global $yeastform; - global $my_lab; - $this->AddCol( 60,'Gist','L'); - $this->AddCol( 50,'Omschrijving','L'); - $this->AddCol( 18,'Soort','L'); - $this->AddCol( 18,'Vorm','L'); - $this->AddCol( 20,'Voorraad','R'); - $this->AddCol( 25,'Datum','L'); - $prop['width']=$this->w-$this->lMargin-$this->rMargin; - $prop['align']='L'; - $cMargin=$this->cMargin; - $this->cMargin=$prop['padding']; - $this->HeaderColor=$prop['HeaderColor']; - $this->TotalColor=$prop['TotalColor']; - $this->RowColors=array($prop['color1'],$prop['color2']); - $this->CalcWidths($prop['width'],$prop['align']); - $this->TableHeader(); - $this->SetFont('Helvetica','',9); - $this->ColorIndex=0; - $this->ProcessingTable=true; - - $sql = "SELECT name,type,form,inventory,production_date,short_desc FROM inventory_yeasts "; - $sql .= "WHERE inventory > 0 AND laboratory = '".$my_lab."' ORDER BY product_id"; - $result = mysqli_query($link, $sql); - - while ($row=mysqli_fetch_array($result)) { - if ($row['form'] == 0) - $stock = floatval($row['inventory']); - else - $stock = floatval($row['inventory']) * 1000.0; - $form = array( 'pak', 'gr', 'ml', 'ml', 'ml', 'ml', 'gr' ); - - $this->SetX($this->TableX); - $ci=$this->ColorIndex; - $this->SetFillColor($this->RowColors[$ci][0],$this->RowColors[$ci][1],$this->RowColors[$ci][2]); - $this->Cell(60,5,iconv('UTF-8','windows-1252',$row['name']),0,0,'L',true); - $this->Cell(50,5,iconv('UTF-8','windows-1252',$row['short_desc']),0,0,'L',true); - $this->Cell(18,5,iconv('UTF-8','windows-1252',$yeasttype[$row['type']]),0,0,'L',true); - $this->Cell(18,5,iconv('UTF-8','windows-1252',$yeastform[$row['form']]),0,0,'L',true); - $this->Cell(20,5,sprintf("%10.1f ",$stock).$form[$row['form']],0,0,'R',true); - $this->Cell(25,5,$row['production_date'],0,0,'L',true); - $this->Ln(); - $this->ColorIndex=1-$ci; - } - - $this->ProcessingTable=false; - $this->cMargin=$cMargin; - $this->aCols=array(); - } -} - - - -class PDF extends PDF_MySQL_Table { - function Header() { - global $prdate; - global $my_brewery; - $this->Image('images/logo.png',10,6,30); - // Title - $this->SetFont('Helvetica','',18); - $this->SetX(45); - $this->Cell(0,10,'Gistbank van '.$my_brewery,0,1,'L'); - $this->Ln(1); - $this->SetFont('Helvetica','',10); - $this->SetX(45); - $this->Cell(17,5,'Datum:',0,0,'L'); - $this->Cell(0,5,$prdate,0,1,'L'); - $this->Ln(18); - // Ensure table header is printed - parent::Header(); - } -} - - -$pdf = new PDF(); -$pdf->AddPage(); -$prop = array('HeaderColor'=>array(255,150,100), 'color1'=>array(210,245,255), - 'color2'=>array(255,255,210), 'TotalColor'=>array(255,150,100), 'padding'=>2); -$pdf->TableYeasts($link,$prop); -$pdf->Output();
--- a/www/js/profile_fermentation.js Mon Jul 11 15:46:18 2022 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,392 +0,0 @@ -/***************************************************************************** - * Copyright (C) 2019-2021 - * - * Michiel Broek <mbroek at mbse dot eu> - * - * This file is part of BMS - * - * This is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by the - * Free Software Foundation; either version 2, or (at your option) any - * later version. - * - * Brewery Management System is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with ThermFerm; see the file COPYING. If not, write to the Free - * Software Foundation, 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. - *****************************************************************************/ - - -function createDelElements() { - $('#eventWindow').jqxWindow({ - theme: theme, - position: { x: 490, y: 210 }, - width: 300, - height: 175, - resizable: false, - isModal: true, - modalOpacity: 0.4, - okButton: $('#delOk'), - cancelButton: $('#delCancel'), - initContent: function() { - $('#delOk').jqxButton({ template: 'danger', width: '65px', theme: theme }); - $('#delCancel').jqxButton({ template: 'success', width: '65px', theme: theme }); - $('#delCancel').focus(); - } - }); - $('#eventWindow').jqxWindow('hide'); -} - - -$(document).ready(function() { - - // tooltips - $('#name').jqxTooltip({ content: 'De naam voor dit vergisting profiel.' }); - $('#inittemp_lo').jqxTooltip({ content: 'De minimale begin temperatuur van dit profiel.' }); - $('#inittemp_hi').jqxTooltip({ content: 'De maximale begin temperatuur van dit profiel.' }); - - var dataRecord = {}, - url = 'includes/db_profile_fermentation.php', - source = { - datatype: 'json', - cache: false, - datafields: [ - { name: 'record', type: 'number' }, - { name: 'uuid', type: 'string' }, - { name: 'name', type: 'string' }, - { name: 'inittemp_lo', type: 'float' }, - { name: 'inittemp_hi', type: 'float' }, - { name: 'fridgemode', type: 'int' }, - { name: 'totalsteps', type: 'int' }, - { name: 'duration', type: 'int' }, - { name: 'steps', type: 'array' } - ], - id: 'record', - url: url, - deleterow: function(rowid, commit) { - var data = 'delete=true&' + $.param({ record: rowid }); - $.ajax({ - dataType: 'json', - url: url, - cache: false, - data: data, - type: 'POST', - success: function(data) { - if (data.error) { - console.log('delete: ' + data.msg); - alert('Fout: ' + data.msg); - } else { - console.log('delete: success'); - } - location.reload(true); - }, - error: function(jqXHR, textStatus, errorThrown) { commit(false); } - }); - }, - addrow: function(rowid, rowdata, position, commit) { - var data = 'insert=true&' + $.param(rowdata); - $.ajax({ - dataType: 'json', - url: url, - cache: false, - data: data, - type: 'POST', - success: function(data) { - if (data.error) { - console.log('insert: ' + data.msg); - alert('Fout: ' + data.msg); - } else { - console.log('insert: success'); - } - location.reload(true); - }, - error: function(jqXHR, textStatus, errorThrown) { commit(false); } - }); - }, - updaterow: function(rowid, rowdata, commit) { - var data = 'update=true&' + $.param(rowdata); - $.ajax({ - dataType: 'json', - url: url, - cache: false, - data: data, - type: 'POST', - success: function(data) { - if (data.error) { - console.log('updaterow: ' + data.msg); - alert('Fout: ' + data.msg); - } else { - console.log('updaterow: success'); - } - location.reload(true); - }, - error: function(jqXHR, textStatus, errorThrown) { commit(false); } - }); - } - }, - dataAdapter = new $.jqx.dataAdapter(source), - editrow = -1, - - // Inline steps editor - editsteps = function(data) { - var generaterow = function() { - var row = {}; - row['name'] = 'Stap 1'; - row['steptime'] = 12; - row['resttime'] = 24; - row['target_lo'] = 22.0; - row['target_hi'] = 23.0; - row['fridgemode'] = 0; - return row; - }; - var stepSource = { - localdata: data.steps, - datatype: 'local', - datafields: [ - { name: 'name', type: 'string' }, - { name: 'steptime', type: 'float' }, - { name: 'resttime', type: 'float' }, - { name: 'target_lo', type: 'float' }, - { name: 'target_hi', type: 'float' }, - { name: 'fridgemode', type: 'int' } - ], - addrow: function(rowid, rowdata, position, commit) { commit(true); }, - deleterow: function(rowid, commit) { commit(true); } - }, - stepAdapter = new $.jqx.dataAdapter(stepSource); - $('#grid').jqxGrid({ - width: 800, - height: 330, - source: stepAdapter, - theme: theme, - selectionmode: 'singlerow', - editmode: 'selectedcell', - editable: true, - showtoolbar: true, - rendertoolbar: function(toolbar) { - var container = $('<div style="margin: 5px;"></div>'); - toolbar.append(container); - container.append('<input style="margin-left: 100px;" id="addrowbutton" type="button" value="Nieuwe stap" />'); - container.append('<input style="margin-left: 290px;" id="deleterowbutton" type="button" value="Verwijder stap" />'); - $('#addrowbutton').jqxButton({ template: 'primary', theme: theme, width: 150 }); - $('#deleterowbutton').jqxButton({ template: 'danger', theme: theme, width: 150 }); - // create new row. - $('#addrowbutton').on('click', function() { - var datarow = generaterow(); - $('#grid').jqxGrid('addrow', null, datarow); - }); - // delete row. - $('#deleterowbutton').on('click', function() { - var selectedrowindex = $('#grid').jqxGrid('getselectedrowindex'), - rowscount = $('#grid').jqxGrid('getdatainformation').rowscount, - id; - if (selectedrowindex >= 0 && selectedrowindex < rowscount) { - id = $('#grid').jqxGrid('getrowid', selectedrowindex); - $('#grid').jqxGrid('deleterow', id); - } - }); - }, - columns: [ - { text: 'Stap naam', datafield: 'name' }, - { text: 'Min. °C', datafield: 'target_lo', width: 100, align: 'right', cellsalign: 'right', cellsformat: 'f1', - validation: function(cell, value) { - if (value < 0 || value > 45) { - return { result: false, message: 'De temperatuur moet tussen 0 en 45 zijn.' }; - } - return true; - } - }, - { text: 'Max. °C', datafield: 'target_hi', width: 100, align: 'right', cellsalign: 'right', cellsformat: 'f1', - validation: function(cell, value) { - if (value < 0 || value > 45) { - return { result: false, message: 'De temperatuur moet tussen 0 en 45 zijn.' }; - } - return true; - } - }, - { text: 'Koelkast', datafield: 'fridgemode', columntype: 'checkbox', width: 80 }, - { text: 'Stap tijd', datafield: 'steptime', width: 80, align: 'right', cellsalign: 'right', - validation: function(cell, value) { - if (value < 0 || value > 14400) { - return { result: false, message: 'De tijd moet tussen 0 en 14400 zijn.' }; - } - return true; - } - }, - { text: 'Rust tijd', datafield: 'resttime', width: 80, align: 'right', cellsalign: 'right', - validation: function(cell, value) { - if (value < 0 || value > 14400) { - return { result: false, message: 'De tijd moet tussen 0 en 14400 zijn.' }; - } - return true; - } - } - ] - }); - }; - - // initialize the input fields. - $('#name').jqxInput({ theme: theme, width: 640, height: 23 }); - $('#inittemp_lo').jqxNumberInput(Spin1dec); - $('#inittemp_lo').jqxNumberInput({ max: 45 }); - $('#inittemp_hi').jqxNumberInput(Spin1dec); - $('#inittemp_hi').jqxNumberInput({ max: 45 }); - $('#fridgemode').jqxCheckBox({ theme: theme, height: 23, enableContainerClick: false }); - - var localizationobj = {}; - localizationobj.filterchoosestring= "Keuze:"; - - // initialize jqxGrid - $('#jqxgrid').jqxGrid({ - width: 1280, - height: 630, - source: dataAdapter, - theme: theme, - showstatusbar: true, - renderstatusbar: function(statusbar) { - var rowCount = $("#jqxgrid").jqxGrid('getrows').length; - statusbar.append('<div style="float: left; margin: 8px; color: orange !important;">Aantal items: ' + rowCount + '</div>'); - var container = $('<div style="overflow: hidden; position: relative; margin: 5px;"></div>'); - var addButton = $('<div style="float: right; margin-right: 15px;"><img style="position: relative; margin-top: 2px;" ' + - 'src="images/add.png"/><span style="margin-left: 4px; position: relative; top: -4px;">Nieuw</span></div>'); - container.append(addButton); - statusbar.append(container); - addButton.jqxButton({ theme: theme, width: 90, height: 17 }); - // add new row. - addButton.click(function(event) { - editrow = -1; - $('#name').val('Nieuw vergist profiel'); - dataRecord.uuid = ''; - $('#inittemp_lo').val(20.0); - $('#inittemp_hi').val(20.0); - $('#fridgemode').val(0); - dataRecord.totalsteps = 0; - dataRecord.duration = 0; - editsteps(''); - $('#popupWindow').jqxWindow('open'); - }); - }, - ready: function () { - $("#jqxgrid").jqxGrid('localizestrings', localizationobj); - }, - filterable: true, - showfilterrow: true, - columns: [ - { text: 'Vergisting profiel', datafield: 'name', filtertype: 'textbox' }, - { text: 'Min. start °C', datafield: 'inittemp_lo', width: 120, align: 'right', cellsalign: 'right', cellsformat: 'f1', filtertype: 'number' }, - { text: 'Max. start °C', datafield: 'inittemp_hi', width: 120, align: 'right', cellsalign: 'right', cellsformat: 'f1', filtertype: 'number' }, - { text: 'Sensor', datafield: 'fridgemode', align: 'right', width: 80, filterable: false, - cellsrenderer: function(row, columnfield, value, defaulthtml, column) { - if (value == 0) - return '<span style="margin: 3px; margin-top: 6px; float: right;">Bier</span>'; - else - return '<span style="margin: 3px; margin-top: 6px; float: right;">Koelkast</span>'; - } - }, - { text: 'Stappen', datafield: 'totalsteps', width: 80, align: 'right', cellsalign: 'right', filterable: false }, - { text: 'Tijdsduur', datafield: 'duration', width: 150, align: 'right', filterable: false, - cellsrenderer: function(row, columnfield, value, defaulthtml, column) { - var show, days, hours; - if (value < 24) { - show = value + ' uur'; - } else { - days = Math.floor(value / 24); - hours = value % 24; - if (days == 1) - show = days + ' dag, ' + hours + ' uur'; - else - show = days + ' dagen, ' + hours + ' uur'; - } - return '<span style="margin: 3px; margin-top: 6px; float: right;">' + show + '</span>'; - } - }, - { text: '', datafield: 'Edit', width: 100, align: 'center', columntype: 'button', filterable: false, cellsrenderer: - function() { - return 'Wijzig'; - }, buttonclick: function(row) { - editrow = row; - // get the clicked row's data and initialize the input fields. - dataRecord = $('#jqxgrid').jqxGrid('getrowdata', editrow); - $('#name').val(dataRecord.name); - $('#inittemp_lo').val(parseFloat(dataRecord.inittemp_lo)); - $('#inittemp_hi').val(parseFloat(dataRecord.inittemp_hi)); - $('#fridgemode').val(parseFloat(dataRecord.fridgemode)); - editsteps(dataRecord); - // show the popup window. - $('#popupWindow').jqxWindow('open'); - } - } - ] - }); - // initialize the popup window and buttons. - $('#popupWindow').jqxWindow({ - width: 1050, - height: 550, - position: { x: 110, y: 30 }, - resizable: false, - theme: theme, - isModal: true, - autoOpen: false, - cancelButton: $('#Cancel'), - modalOpacity: 0.40 - }); - $('#popupWindow').on('open', function() { - $('#name').jqxInput('selectAll'); - }); - $('#Delete').jqxButton({ template: 'danger', width: '90px', theme: theme }); - $('#Delete').click(function() { - if (editrow >= 0) { - // Open a popup to confirm this action. - $('#eventWindow').jqxWindow('open'); - $('#delOk').click(function() { - var rowID = $('#jqxgrid').jqxGrid('getrowid', editrow); - $('#jqxgrid').jqxGrid('deleterow', rowID); - }); - } - $('#popupWindow').jqxWindow('hide'); - }); - $('#Cancel').jqxButton({ template: 'primary', width: '90px', theme: theme }); - $('#Clone').jqxButton({ template: 'warning', width: '90px', theme: theme }); - $('#Clone').click(function() { - var steprows = $('#grid').jqxGrid('getrows'); - var row = { - record: -1, - name: $('#name').val() + ' kopie', - inittemp_lo: parseFloat($('#inittemp_lo').jqxNumberInput('decimal')), - inittemp_hi: parseFloat($('#inittemp_hi').jqxNumberInput('decimal')), - fridgemode: $('#fridgemode').val(), - steps: steprows - }; - $('#jqxgrid').jqxGrid('addrow', null, row); - $('#popupWindow').jqxWindow('hide'); - }); - $('#Save').jqxButton({ template: 'success', width: '90px', theme: theme }); - // update the edited row when the user clicks the 'Save' button. - $('#Save').click(function() { - var row, rowID = -1, steprows = $('#grid').jqxGrid('getrows'); - if (editrow >= 0) { - rowID = $('#jqxgrid').jqxGrid('getrowid', editrow); - } - row = { - record: rowID, - uuid: dataRecord.uuid, - name: $('#name').val(), - inittemp_lo: parseFloat($('#inittemp_lo').jqxNumberInput('decimal')), - inittemp_hi: parseFloat($('#inittemp_hi').jqxNumberInput('decimal')), - fridgemode: $('#fridgemode').val(), - steps: steprows - }; - if (editrow >= 0) { - $('#jqxgrid').jqxGrid('updaterow', rowID, row); - } else { - $('#jqxgrid').jqxGrid('addrow', null, row); - } - $('#popupWindow').jqxWindow('hide'); - }); - createDelElements(); -}); -
--- a/www/js/profile_mash.js Mon Jul 11 15:46:18 2022 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,428 +0,0 @@ -/***************************************************************************** - * Copyright (C) 2014-2022 - * - * Michiel Broek <mbroek at mbse dot eu> - * - * This file is part of Brewery Management System - * - * This is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by the - * Free Software Foundation; either version 2, or (at your option) any - * later version. - * - * BrewCloud is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with ThermFerm; see the file COPYING. If not, write to the Free - * Software Foundation, 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. - *****************************************************************************/ - - -function createDelElements() { - $('#eventWindow').jqxWindow({ - theme: theme, - position: { x: 490, y: 210 }, - width: 300, - height: 175, - resizable: false, - isModal: true, - modalOpacity: 0.4, - okButton: $('#delOk'), - cancelButton: $('#delCancel'), - initContent: function() { - $('#delOk').jqxButton({ template: 'danger', width: '65px', theme: theme }); - $('#delCancel').jqxButton({ template: 'success', width: '65px', theme: theme }); - $('#delCancel').focus(); - } - }); - $('#eventWindow').jqxWindow('hide'); -} - - -$(document).ready(function() { - - // tooltips - $('#name').jqxTooltip({ content: 'De naam voor dit maisch profiel.' }); - $('#notes').jqxTooltip({ content: 'De uitgebreide opmerkingen over dit maisch profiel.' }); - - var steprow = 0, - stepData = {}, - dataRecord = {}, - url = 'includes/db_profile_mash.php', - source = { - datatype: 'json', - cache: false, - datafields: [ - { name: 'record', type: 'number' }, - { name: 'name', type: 'string' }, - { name: 'notes', type: 'string' }, - { name: 'steps', type: 'array' }, - { name: 'uuid', type: 'string' } - ], - id: 'record', - url: url, - deleterow: function(rowid, commit) { - var data = 'delete=true&' + $.param({ record: rowid }); - $.ajax({ - dataType: 'json', - url: url, - cache: false, - data: data, - type: 'POST', - success: function(data) { - if (data.error) { - console.log('delete: ' + data.msg); - alert('Fout: ' + data.msg); - } else { - console.log('delete: success'); - } - location.reload(true); - }, - error: function(jqXHR, textStatus, errorThrown) { - commit(false); - console.log('mash deleterow ' + textStatus); - } - }); - }, - addrow: function(rowid, rowdata, position, commit) { - var data = 'insert=true&' + $.param(rowdata); - $.ajax({ - dataType: 'json', - url: url, - cache: false, - data: data, - type: 'POST', - success: function(data) { - if (data.error) { - console.log('insert: ' + data.msg); - alert('Fout: ' + data.msg); - } else { - console.log('insert: success'); - } - location.reload(true); - }, - error: function(jqXHR, textStatus, errorThrown) { - commit(false); - console.log('mash addrow ' + textStatus); - } - }); - }, - updaterow: function(rowid, rowdata, commit) { - var data = 'update=true&' + $.param(rowdata); - $.ajax({ - dataType: 'json', - url: url, - cache: false, - data: data, - type: 'POST', - success: function(data) { - if (data.error) { - console.log('updaterow: ' + data.msg); - alert('Fout: ' + data.msg); - } else { - console.log('updaterow: success'); - } - location.reload(true); - }, - error: function(jqXHR, textStatus, errorThrown) { - commit(false); - console.log('mash updaterow ' + textStatus); - } - }); - } - }, - dataAdapter = new $.jqx.dataAdapter(source), - editrow = -1, - - // Inline steps editor - editsteps = function(data) { - var stepSource = { - localdata: data.steps, - datatype: 'local', - datafields: [ - { name: 'step_name', type: 'string' }, - { name: 'step_type', type: 'int' }, - { name: 'step_temp', type: 'float' }, - { name: 'step_time', type: 'float' }, - { name: 'ramp_time', type: 'float' }, - { name: 'end_temp', type: 'float' } - ], - addrow: function(rowid, rowdata, position, commit) { commit(true); }, - deleterow: function(rowid, commit) { commit(true); } - }, - stepAdapter = new $.jqx.dataAdapter(stepSource); - - $('#grid').jqxGrid({ - width: 1020, - height: 330, - source: stepAdapter, - theme: theme, - selectionmode: 'singlerow', - showtoolbar: true, - rendertoolbar: function(toolbar) { - var container = $('<div style="margin: 5px;"></div>'); - toolbar.append(container); - container.append('<input style="margin-left: 100px;" id="addrowbutton" type="button" value="Nieuwe stap" />'); - container.append('<input style="margin-left: 450px;" id="deleterowbutton" type="button" value="Verwijder stap" />'); - $('#addrowbutton').jqxButton({ template: 'primary', theme: theme, width: 150 }); - $('#deleterowbutton').jqxButton({ template: 'danger', theme: theme, width: 150 }); - // create new row. - $('#addrowbutton').on('click', function() { - var row = {}, rowscount = $('#grid').jqxGrid('getdatainformation').rowscount; - var temp = $('#grid').jqxGrid('getcell', rowscount -1, 'step_temp'); - row['step_name'] = 'Stap ' + (rowscount + 1); - if (rowscount > 0) { - row['step_type'] = 1; - row['step_temp'] = row['end_temp'] = temp.value + 2; - } else { - row['step_type'] = 0; - row['step_temp'] = row['end_temp'] = 62.0; - } - row['step_time'] = 20.0; - row['ramp_time'] = 1.0; - $('#grid').jqxGrid('addrow', null, row); - }); - // delete row. - $('#deleterowbutton').on('click', function() { - var rowscount, id, selectedrowindex = $('#grid').jqxGrid('getselectedrowindex'); - rowscount = $('#grid').jqxGrid('getdatainformation').rowscount; - if (selectedrowindex >= 0 && selectedrowindex < rowscount) { - id = $('#grid').jqxGrid('getrowid', selectedrowindex); - $('#grid').jqxGrid('deleterow', id); - } - }); - }, - columns: [ - { text: 'Stap naam', datafield: 'step_name' }, - { text: 'Stap type', datafield: 'step_type', width: 150, - cellsrenderer: function(index, datafield, value, defaultvalue, column, rowdata) { - return '<span style="margin: 4px; margin-top: 6px; float: left;">' + MashStepTypeData[value].nl + '</span>'; - } - }, - { text: 'Start °C', datafield: 'step_temp', width: 90, align: 'right', cellsalign: 'right', cellsformat: 'f1' }, - { text: 'Eind °C', datafield: 'end_temp', width: 90, align: 'right', cellsalign: 'right', cellsformat: 'f1' }, - { text: 'Rust min.', datafield: 'step_time', width: 90, align: 'right', cellsalign: 'right' }, - { text: 'Stap min.', datafield: 'ramp_time', width: 90, align: 'right', cellsalign: 'right' }, - { text: '', columntype: 'button', width: 15, align: 'center', - cellsrenderer: function(row) { - if (row < 2) - return ' '; - return 'â–´'; - }, buttonclick: function(row) { - if (row >= 2) { - swapMash(row, row-1); - } - } - }, - { text: '', columntype: 'button', width: 15, align: 'center', - cellsrenderer: function(row) { - rowscount = $('#grid').jqxGrid('getdatainformation').rowscount; - if (row < 1 || row > (rowscount -2)) - return ' '; - return 'â–¾'; - }, buttonclick: function(row) { - rowscount = $('#grid').jqxGrid('getdatainformation').rowscount; - if (row >= 1 && row <= (rowscount -2)) { - swapMash(row, row+1); - } - } - }, - { text: '', datafield: 'Edit', columntype: 'button', width: 80, align: 'center', - cellsrenderer: function() { - return 'Wijzig'; - }, buttonclick: function(row) { - steprow = row; - stepData = $('#grid').jqxGrid('getrowdata', steprow); - $('#m_step_name').val(stepData.step_name); - $('#m_step_type').val(stepData.step_type); - $('#m_step_temp').val(stepData.step_temp); - $('#m_end_temp').val(stepData.end_temp); - $('#m_step_time').val(stepData.step_time); - $('#m_ramp_time').val(stepData.ramp_time); - // show the popup window. - $('#popupStep').jqxWindow('open'); - } - } - ] - }); - }; - - // Initialize the input fields. - $('#m_step_name').jqxInput({ theme: theme, width: 320, height: 23 }); - $('#m_step_type').jqxDropDownList({ - theme: theme, - source: MashStepTypeAdapter, - valueMember: 'id', - displayMember: 'nl', - width: 180, - height: 23, - autoDropDownHeight: true - }); - $('#m_step_temp').jqxNumberInput(Spin1dec); - $('#m_step_temp').jqxNumberInput({ Min: 30, Max: 80 }); - $('#m_end_temp').jqxNumberInput(Spin1dec); - $('#m_end_temp').jqxNumberInput({ Min: 30, Max: 80 }); - $('#m_step_time').jqxNumberInput(PosInt); - $('#m_step_time').jqxNumberInput({ Min: 1, Max: 120 }); - $('#m_ramp_time').jqxNumberInput(PosInt); - $('#m_ramp_time').jqxNumberInput({ Min: 1, Max: 30 }); - - // initialize the input fields. - $('#name').jqxInput({ theme: theme, width: 480, height: 23 }); - $('#notes').jqxInput({ theme: theme, width: 800, height: 100 }); - - var localizationobj = {}; - localizationobj.filterchoosestring= "Keuze:"; - - // initialize jqxGrid - $('#jqxgrid').jqxGrid({ - width: 1280, - height: 630, - source: dataAdapter, - theme: theme, - showstatusbar: true, - renderstatusbar: function(statusbar) { - var rowCount = $("#jqxgrid").jqxGrid('getrows').length; - statusbar.append('<div style="float: left; margin: 8px; color: orange !important;">Aantal items: ' + rowCount + '</div>'); - var container = $('<div style="overflow: hidden; position: relative; margin: 5px;"></div>'); - var addButton = $('<div style="float: right; margin-right: 15px;"><img style="position: relative; margin-top: 2px;" ' + - 'src="images/add.png"/><span style="margin-left: 4px; position: relative; top: -4px;">Add</span></div>'); - var expButton = $('<div style="float: right; margin-right: 50px;"><img style="position: relative; margin-top: 2px;" ' + - 'src="images/database.png"/><span style="margin-left: 4px; position: relative; top: -10px;">Export</span></div>'); - container.append(addButton); - container.append(expButton); - statusbar.append(container); - addButton.jqxButton({ theme: theme, width: 90, height: 17 }); - expButton.jqxButton({ theme: theme, width: 90, height: 17 }); - // add new row. - addButton.click(function(event) { - editrow = -1; - $('#name').val('Nieuw maisch schema'); - $('#notes').val(''); - dataRecord.uuid = ''; - editsteps(''); - $('#popupWindow').jqxWindow('open'); - }); - expButton.click(function(event) { - window.open('export_mashs.php'); - }); - }, - ready: function () { - $("#jqxgrid").jqxGrid('localizestrings', localizationobj); - }, - filterable: true, - showfilterrow: true, - columns: [ - { text: 'Maish schema', datafield: 'name', width: 250, filtertype: 'textbox' }, - { text: 'Opmerkingen', datafield: 'notes', filtertype: 'textbox' }, - { text: '', datafield: 'Edit', width: 100, align: 'center', columntype: 'button', filterable: false, - cellsrenderer: function() { - return 'Wijzig'; - }, buttonclick: function(row) { - editrow = row; - // get the clicked row's data and initialize the input fields. - dataRecord = $('#jqxgrid').jqxGrid('getrowdata', editrow); - $('#name').val(dataRecord.name); - $('#notes').val(dataRecord.notes); - editsteps(dataRecord); - // show the popup window. - $('#popupWindow').jqxWindow('open'); - } - } - ] - }); - // initialize the popup window and buttons. - $('#popupWindow').jqxWindow({ - width: 1050, - height: 580, - position: { x: 110, y: 30 }, - resizable: false, - theme: theme, - isModal: true, - autoOpen: false, - cancelButton: $('#Cancel'), - modalOpacity: 0.40 - }); - $('#popupWindow').on('open', function() { - $('#name').jqxInput('selectAll'); - }); - $('#popupStep').jqxWindow({ - width: 800, - height: 300, - position: { x: 230, y: 100 }, - resizable: false, - theme: theme, - isModal: true, - autoOpen: false, - cancelButton: $('#Ready'), - modalOpacity: 0.40 - }); - - // step detail popup update values. - $('#Ready').jqxButton({ template: 'success', width: '90px', theme: theme }); - $('#Ready').click(function() { - $('#grid').jqxGrid('setcellvalue', steprow, 'step_name', $('#m_step_name').val()); - $('#grid').jqxGrid('setcellvalue', steprow, 'step_type', $('#m_step_type').val()); - $('#grid').jqxGrid('setcellvalue', steprow, 'step_temp', $('#m_step_temp').val()); - $('#grid').jqxGrid('setcellvalue', steprow, 'end_temp', $('#m_end_temp').val()); - $('#grid').jqxGrid('setcellvalue', steprow, 'step_time', $('#m_step_time').val()); - $('#grid').jqxGrid('setcellvalue', steprow, 'ramp_time', $('#m_ramp_time').val()); - $('#grid').jqxGrid('sortby', 'step_temp', 'asc'); - }); - - // mash profile popup. - $('#Delete').jqxButton({ template: 'danger', width: '90px', theme: theme }); - $('#Delete').click(function() { - if (editrow >= 0) { - // Open a popup to confirm this action. - $('#eventWindow').jqxWindow('open'); - $('#delOk').click(function() { - var rowID = $('#jqxgrid').jqxGrid('getrowid', editrow); - $('#jqxgrid').jqxGrid('deleterow', rowID); - }); - } - $('#popupWindow').jqxWindow('hide'); - }); - $('#Cancel').jqxButton({ template: 'primary', width: '90px', theme: theme }); - $('#Save').jqxButton({ template: 'success', width: '90px', theme: theme }); - $('#Save').click(function() { - var steprows = $('#grid').jqxGrid('getrows'), - rowID = -1, - row; - if (editrow >= 0) { - rowID = $('#jqxgrid').jqxGrid('getrowid', editrow); - } - row = { - record: rowID, - uuid: dataRecord.uuid, - name: $('#name').val(), - notes: $('#notes').val(), - steps: steprows - }; - if (editrow >= 0) { - $('#jqxgrid').jqxGrid('updaterow', rowID, row); - } else { - $('#jqxgrid').jqxGrid('addrow', null, row); - } - $('#popupWindow').jqxWindow('hide'); - }); - - function swapMash(r1, r2) { - - console.log('swap mash rows ' + r1 + ' ' + r2); - var row1 = $('#grid').jqxGrid('getrowdata', r1); - var row2 = $('#grid').jqxGrid('getrowdata', r2); - var obj1 = { step_name: row1.step_name, step_type: row1.step_type, step_temp: row1.step_temp, step_time: row1.step_time, - ramp_time: row1.ramp_time, end_temp: row1.end_temp }; - var obj2 = { step_name: row2.step_name, step_type: row2.step_type, step_temp: row2.step_temp, step_time: row2.step_time, - ramp_time: row2.ramp_time, end_temp: row2.end_temp }; - $("#grid").jqxGrid('updaterow', r1, obj2); - $("#grid").jqxGrid('updaterow', r2, obj1); - } - - createDelElements(); -}); -
--- a/www/js/profile_styles.js Mon Jul 11 15:46:18 2022 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,373 +0,0 @@ -/***************************************************************************** - * Copyright (C) 2014-2022 - * - * Michiel Broek <mbroek at mbse dot eu> - * - * This file is part of Brewery Management System - * - * This is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by the - * Free Software Foundation; either version 2, or (at your option) any - * later version. - * - * BrewCloud is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with ThermFerm; see the file COPYING. If not, write to the Free - * Software Foundation, 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. - *****************************************************************************/ - - -function createDelElements() { - $('#eventWindow').jqxWindow({ - theme: theme, - position: { x: 490, y: 210 }, - width: 300, - height: 175, - resizable: false, - isModal: true, - modalOpacity: 0.4, - okButton: $('#delOk'), - cancelButton: $('#delCancel'), - initContent: function() { - $('#delOk').jqxButton({ template: 'danger', width: '65px', theme: theme }); - $('#delCancel').jqxButton({ template: 'success', width: '65px', theme: theme }); - $('#delCancel').focus(); - } - }); - $('#eventWindow').jqxWindow('hide'); -} - - -$(document).ready(function() { - - var dataRecord = {}, - url = 'includes/db_profile_styles.php', - source = { - datatype: 'json', - cache: false, - datafields: [ - { name: 'record', type: 'number' }, - { name: 'uuid', type: 'string' }, - { name: 'name', type: 'string' }, - { name: 'category', type: 'string' }, - { name: 'category_number', type: 'number' }, - { name: 'style_letter', type: 'string' }, - { name: 'style_guide', type: 'string' }, - { name: 'type', type: 'int' }, - { name: 'og_min', type: 'float' }, - { name: 'og_max', type: 'float' }, - { name: 'fg_min', type: 'float' }, - { name: 'fg_max', type: 'float' }, - { name: 'ibu_min', type: 'float' }, - { name: 'ibu_max', type: 'float' }, - { name: 'color_min', type: 'float' }, - { name: 'color_max', type: 'float' }, - { name: 'carb_min', type: 'float' }, - { name: 'carb_max', type: 'float' }, - { name: 'abv_min', type: 'float' }, - { name: 'abv_max', type: 'float' }, - { name: 'notes', type: 'string' }, - { name: 'profile', type: 'string' }, - { name: 'ingredients', type: 'string' }, - { name: 'examples', type: 'string' } - ], - id: 'record', - url: url, - deleterow: function(rowid, commit) { - // synchronize with the server - send delete command - var data = 'delete=true&' + $.param({ record: rowid }); - $.ajax({ - dataType: 'json', - url: url, - cache: false, - data: data, - type: 'POST', - success: function(data) { - if (data.error) { - console.log('delete: ' + data.msg); - alert('Fout: ' + data.msg); - } else { - console.log('delete: success'); - } - location.reload(true); - }, - error: function(jqXHR, textStatus, errorThrown) { commit(false); } - }); - }, - addrow: function(rowid, rowdata, position, commit) { - var data = 'insert=true&' + $.param(rowdata); - $.ajax({ - dataType: 'json', - url: url, - cache: false, - data: data, - type: 'POST', - success: function(data) { - if (data.error) { - console.log('insert: ' + data.msg); - alert('Fout: ' + data.msg); - } else { - console.log('insert: success'); - } - location.reload(true); - }, - error: function(jqXHR, textStatus, errorThrown) { commit(false); } - }); - }, - updaterow: function(rowid, rowdata, commit) { - var data = 'update=true&' + $.param(rowdata); - $.ajax({ - dataType: 'json', - url: url, - cache: false, - data: data, - type: 'POST', - success: function(data) { - if (data.error) { - console.log('updaterow: ' + data.msg); - alert('Fout: ' + data.msg); - } else { - console.log('updaterow: success'); - } - location.reload(true); - }, - error: function(jqXHR, textStatus, errorThrown) { commit(false); } - }); - } - }, - dataAdapter = new $.jqx.dataAdapter(source), - editrow = -1; - - // initialize the input fields. - $('#name').jqxInput({ theme: theme, width: 320, height: 23 }); - $('#category').jqxInput({ theme: theme, width: 320, height: 23 }); - $('#category_number').jqxNumberInput(PosInt); - $('#style_letter').jqxInput({ theme: theme, width: 250, height: 23 }); - $('#style_guide').jqxInput({ theme: theme, width: 320, height: 23 }); - $('#type').jqxDropDownList({ - theme: theme, - source: StyleTypeAdapter, - valueMember: 'id', - displayMember: 'nl', - width: 180, - height: 23, - autoDropDownHeight: true - }); - $('#og_min').jqxNumberInput(SGopts); - $('#og_max').jqxNumberInput(SGopts); - $('#fg_min').jqxNumberInput(SGopts); - $('#fg_max').jqxNumberInput(SGopts); - $('#ibu_min').jqxNumberInput(PosInt); - $('#ibu_min').jqxNumberInput({ max: 200 }); - $('#ibu_max').jqxNumberInput(PosInt); - $('#ibu_max').jqxNumberInput({ max: 200 }); - $('#color_min').jqxNumberInput(PosInt); - $('#color_min').jqxNumberInput({ max: 200 }); - $('#color_max').jqxNumberInput(PosInt); - $('#color_max').jqxNumberInput({ max: 200 }); - $('#carb_min').jqxNumberInput(Spin1dec); - $('#carb_min').jqxNumberInput({ max: 5 }); - $('#carb_max').jqxNumberInput(Spin1dec); - $('#carb_max').jqxNumberInput({ max: 5 }); - $('#abv_min').jqxNumberInput(Spin1dec); - $('#abv_min').jqxNumberInput({ max: 20 }); - $('#abv_max').jqxNumberInput(Spin1dec); - $('#abv_max').jqxNumberInput({ max: 20 }); - $('#notes').jqxInput({ theme: theme, width: 800, height: 100 }); - $('#profile').jqxInput({ theme: theme, width: 800, height: 48 }); - $('#ingredients').jqxInput({ theme: theme, width: 800, height: 23 }); - $('#examples').jqxInput({ theme: theme, width: 800, height: 48 }); - - var localizationobj = {}; - localizationobj.filterchoosestring= "Keuze:"; - - // initialize jqxGrid - $('#jqxgrid').jqxGrid({ - width: 1280, - height: 630, - source: dataAdapter, - theme: theme, - showstatusbar: true, - renderstatusbar: function(statusbar) { - var rowCount = $("#jqxgrid").jqxGrid('getrows').length; - statusbar.append('<div style="float: left; margin: 8px; color: orange !important;">Aantal items: ' + rowCount + '</div>'); - var container, addButton, impButton; - container = $('<div style="overflow: hidden; position: relative; margin: 5px;"></div>'); - addButton = $('<div style="float: right; margin-right: 15px;"><img style="position: relative; margin-top: 2px;" ' + - 'src="images/add.png"/><span style="margin-left: 4px; position: relative; top: -4px;">Nieuw</span></div>'); - impButton = $('<div style="float: right; margin-right: 50px;"><img style="position: relative; margin-top: 2px;" ' + - 'src="images/add.png"/><span style="margin-left: 4px; position: relative; top: -4px;">Import</span></div>'); - expButton = $('<div style="float: right; margin-right: 50px;"><img style="position: relative; margin-top: 2px;" ' + - 'src="images/database.png"/><span style="margin-left: 4px; position: relative; top: -10px;">Export</span></div>'); - container.append(addButton); - container.append(impButton); - container.append(expButton); - statusbar.append(container); - addButton.jqxButton({ theme: theme, width: 90, height: 17 }); - impButton.jqxButton({ theme: theme, width: 90, height: 17 }); - expButton.jqxButton({ theme: theme, width: 90, height: 17 }); - // add new row. - addButton.click(function(event) { - editrow = -1; - $('#name').val('Nieuwe stijl'); - dataRecord.uuid = ''; - $('#category').val(''); - $('#category_number').val(''); - $('#style_letter').val(''); - $('#style_guide').val('BKG 2015'); - $('#type').val(0); - $('#og_min').val(1.030); - $('#og_max').val(1.050); - $('#fg_min').val(1.005); - $('#fg_max').val(1.010); - $('#ibu_min').val(20); - $('#ibu_max').val(30); - $('#color_min').val(52); - $('#color_max').val(79); - $('#carb_min').val(2.0); - $('#carb_max').val(2.5); - $('#abv_min').val(4.0); - $('#abv_max').val(5.0); - $('#notes').val(''); - $('#profile').val(''); - $('#ingredients').val(''); - $('#examples').val(''); - $('#popupWindow').jqxWindow('open'); - }); - impButton.click(function(event) { - window.location.href = 'import_ingredients.php?select=styles'; - }); - expButton.click(function(event) { - window.open('export_styles.php'); - }); - }, - ready: function () { - $("#jqxgrid").jqxGrid('localizestrings', localizationobj); - }, - filterable: true, - showfilterrow: true, - columns: [ - { text: 'Gids', datafield: 'style_guide', width: 100, filtertype: 'list' }, - { text: 'Groep', datafield: 'style_letter', width: 30, filtertype: 'list' }, - { text: 'Style Name', menu: false, datafield: 'name', filtertype: 'textbox' }, - { text: 'OG', menu: false, datafield: 'og_min', width: 60, align: 'right', cellsalign: 'right', cellsformat: 'f3', filterable: false }, - { text: 'OG', menu: false, datafield: 'og_max', width: 60, align: 'right', cellsalign: 'right', cellsformat: 'f3', filterable: false }, - { text: 'FG', menu: false, datafield: 'fg_min', width: 60, align: 'right', cellsalign: 'right', cellsformat: 'f3', filterable: false }, - { text: 'FG', menu: false, datafield: 'fg_max', width: 60, align: 'right', cellsalign: 'right', cellsformat: 'f3', filterable: false }, - { text: 'IBU', menu: false, datafield: 'ibu_min', width: 50, align: 'right', cellsalign: 'right', cellsformat: 'f0', filterable: false }, - { text: 'IBU', menu: false, datafield: 'ibu_max', width: 50, align: 'right', cellsalign: 'right', cellsformat: 'f0', filterable: false }, - { text: 'EBC', menu: false, datafield: 'color_min', width: 50, align: 'right', cellsalign: 'right', cellsformat: 'f0', filterable: false }, - { text: 'EBC', menu: false, datafield: 'color_max', width: 50, align: 'right', cellsalign: 'right', cellsformat: 'f0', filterable: false }, - { text: 'Co2', menu: false, datafield: 'carb_min', width: 50, align: 'right', cellsalign: 'right', cellsformat: 'f1', filterable: false }, - { text: 'Co2', menu: false, datafield: 'carb_max', width: 50, align: 'right', cellsalign: 'right', cellsformat: 'f1', filterable: false }, - { text: 'ABV', menu: false, datafield: 'abv_min', width: 50, align: 'right', cellsalign: 'right', cellsformat: 'f1', filterable: false }, - { text: 'ABV', menu: false, datafield: 'abv_max', width: 50, align: 'right', cellsalign: 'right', cellsformat: 'f1', filterable: false }, - { text: '', menu: false, datafield: 'Edit', width: 100, align: 'center', columntype: 'button', filterable: false, cellsrenderer: function() { - return 'Wijzig'; - }, buttonclick: function(row) { - // open the popup window when the user clicks a button. - editrow = row; - // get the clicked row's data and initialize the input fields. - dataRecord = $('#jqxgrid').jqxGrid('getrowdata', editrow); - $('#name').val(dataRecord.name); - $('#category').val(dataRecord.category); - $('#category_number').val(dataRecord.category_number); - $('#style_letter').val(dataRecord.style_letter); - $('#style_guide').val(dataRecord.style_guide); - $('#type').val(dataRecord.type); - $('#og_min').val(dataRecord.og_min); - $('#og_max').val(dataRecord.og_max); - $('#fg_min').val(dataRecord.fg_min); - $('#fg_max').val(dataRecord.fg_max); - $('#ibu_min').val(dataRecord.ibu_min); - $('#ibu_max').val(dataRecord.ibu_max); - $('#color_min').val(dataRecord.color_min); - $('#color_max').val(dataRecord.color_max); - $('#carb_min').val(dataRecord.carb_min); - $('#carb_max').val(dataRecord.carb_max); - $('#abv_min').val(dataRecord.abv_min); - $('#abv_max').val(dataRecord.abv_max); - $('#notes').val(dataRecord.notes); - $('#profile').val(dataRecord.profile); - $('#ingredients').val(dataRecord.ingredients); - $('#examples').val(dataRecord.examples); - // show the popup window. - $('#popupWindow').jqxWindow('open'); - } - } - ] - }); - // initialize the popup window and buttons. - $('#popupWindow').jqxWindow({ - width: 1050, - position: { x: 110, y: 30 }, - resizable: false, - theme: theme, - isModal: true, - autoOpen: false, - cancelButton: $('#Cancel'), - modalOpacity: 0.40 - }); - $('#popupWindow').on('open', function() { - $('#name').jqxInput('selectAll'); - }); - $('#Delete').jqxButton({ template: 'danger', width: '90px', theme: theme }); - $('#Delete').click(function() { - if (editrow >= 0) { - // Open a popup to confirm this action. - $('#eventWindow').jqxWindow('open'); - $('#delOk').click(function() { - var rowID = $('#jqxgrid').jqxGrid('getrowid', editrow); - $('#jqxgrid').jqxGrid('deleterow', rowID); - }); - } - $('#popupWindow').jqxWindow('hide'); - }); - $('#Cancel').jqxButton({ template: 'primary', width: '90px', theme: theme }); - $('#Save').jqxButton({ template: 'success', width: '90px', theme: theme }); - // update the edited row when the user clicks the 'Save' button. - $('#Save').click(function() { - var row, rowID = -1; - if (editrow >= 0) { - rowID = $('#jqxgrid').jqxGrid('getrowid', editrow); - } - row = { - record: rowID, - uuid: dataRecord.uuid, - name: $('#name').val(), - category: $('#category').val(), - category_number: parseFloat($('#category_number').jqxNumberInput('decimal')), - style_letter: $('#style_letter').val(), - style_guide: $('#style_guide').val(), - type: $('#type').val(), - og_min: parseFloat($('#og_min').jqxNumberInput('decimal')), - og_max: parseFloat($('#og_max').jqxNumberInput('decimal')), - fg_min: parseFloat($('#fg_min').jqxNumberInput('decimal')), - fg_max: parseFloat($('#fg_max').jqxNumberInput('decimal')), - ibu_min: parseFloat($('#ibu_min').jqxNumberInput('decimal')), - ibu_max: parseFloat($('#ibu_max').jqxNumberInput('decimal')), - color_min: parseFloat($('#color_min').jqxNumberInput('decimal')), - color_max: parseFloat($('#color_max').jqxNumberInput('decimal')), - carb_min: parseFloat($('#carb_min').jqxNumberInput('decimal')), - carb_max: parseFloat($('#carb_max').jqxNumberInput('decimal')), - abv_min: parseFloat($('#abv_min').jqxNumberInput('decimal')), - abv_max: parseFloat($('#abv_max').jqxNumberInput('decimal')), - notes: $('#notes').val(), - profile: $('#profile').val(), - ingredients: $('#ingredients').val(), - examples: $('#examples').val() - }; - if (editrow >= 0) { - $('#jqxgrid').jqxGrid('updaterow', rowID, row); - } else { - $('#jqxgrid').jqxGrid('addrow', null, row); - } - $('#popupWindow').jqxWindow('hide'); - }); - createDelElements(); -}); -
--- a/www/js/profile_water.js Mon Jul 11 15:46:18 2022 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,335 +0,0 @@ -/***************************************************************************** - * Copyright (C) 2014-2022 - * - * Michiel Broek <mbroek at mbse dot eu> - * - * This file is part of Brewery Management System - * - * This is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by the - * Free Software Foundation; either version 2, or (at your option) any - * later version. - * - * BrewCloud is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with ThermFerm; see the file COPYING. If not, write to the Free - * Software Foundation, 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. - *****************************************************************************/ - - -function createDelElements() { - $('#eventWindow').jqxWindow({ - theme: theme, - position: { x: 490, y: 210 }, - width: 300, - height: 175, - resizable: false, - isModal: true, - modalOpacity: 0.4, - okButton: $('#delOk'), - cancelButton: $('#delCancel'), - initContent: function() { - $('#delOk').jqxButton({ template: 'danger', width: '65px', theme: theme }); - $('#delCancel').jqxButton({ template: 'success', width: '65px', theme: theme }); - $('#delCancel').focus(); - } - }); - $('#eventWindow').jqxWindow('hide'); -} - - -$(document).ready(function() { - - var dataRecord = {}, - url = 'includes/db_profile_water.php', - source = { - datatype: 'json', - cache: false, - datafields: [ - { name: 'record', type: 'number' }, - { name: 'uuid', type: 'string' }, - { name: 'name', type: 'string' }, - { name: 'calcium', type: 'float' }, - { name: 'bicarbonate', type: 'float' }, - { name: 'sulfate', type: 'float' }, - { name: 'chloride', type: 'float' }, - { name: 'sodium', type: 'float' }, - { name: 'magnesium', type: 'float' }, - { name: 'ph', type: 'float' }, - { name: 'notes', type: 'string' }, - { name: 'total_alkalinity', type: 'float' } - ], - id: 'record', - url: url, - deleterow: function(rowid, commit) { - // synchronize with the server - send delete command - var data = 'delete=true&' + $.param({ record: rowid }); - $.ajax({ - dataType: 'json', - url: url, - cache: false, - data: data, - type: 'POST', - success: function(data) { - if (data.error) { - console.log('delete: ' + data.msg); - alert('Fout: ' + data.msg); - } else { - console.log('delete: success'); - } - location.reload(true); - }, - error: function(jqXHR, textStatus, errorThrown) { commit(false); } - }); - }, - addrow: function(rowid, rowdata, position, commit) { - var data = 'insert=true&' + $.param(rowdata); - $.ajax({ - dataType: 'json', - url: url, - cache: false, - data: data, - type: 'POST', - success: function(data) { - if (data.error) { - console.log('insert: ' + data.msg); - alert('Fout: ' + data.msg); - } else { - console.log('insert: success'); - } - location.reload(true); - }, - error: function(jqXHR, textStatus, errorThrown) { commit(false); } - }); - }, - updaterow: function(rowid, rowdata, commit) { - var data = 'update=true&' + $.param(rowdata); - $.ajax({ - dataType: 'json', - url: url, - cache: false, - data: data, - type: 'POST', - success: function(data) { - if (data.error) { - console.log('updaterow: ' + data.msg); - alert('Fout: ' + data.msg); - } else { - console.log('updaterow: success'); - } - location.reload(true); - }, - error: function(jqXHR, textStatus, errorThrown) { commit(false); } - }); - } - }, - dataAdapter = new $.jqx.dataAdapter(source), - editrow = -1; - - // tooltips - $('#name').jqxTooltip({ content: 'De unieke naam van dit water profiel.' }); - $('#notes').jqxTooltip({ content: 'Extra opmerkingen over dit water.' }); - $('#calcium').jqxTooltip({ content: 'Calcium (Ca).' }); - $('#bicarbonate').jqxTooltip({ content: 'Bicarbonaat (HCO3). Berekend meteen de Totale alkaliteit.' }); - $('#sulfate').jqxTooltip({ content: 'Calcium Sulfaat (CaSO4).' }); - $('#chloride').jqxTooltip({ content: 'Chloride (Cl).' }); - $('#sodium').jqxTooltip({ content: 'Natrium, oftewel keukenzout (Na). In berekeningen ook vaak als Sodium.' }); - $('#magnesium').jqxTooltip({ content: 'Magnesium (Mg).' }); - $('#ph').jqxTooltip({ content: 'De zuurgraad (pH).' }); - $('#total_alkalinity').jqxTooltip({ content: 'Totale alkaliniteit. Berekend meteen de Bicarbonaat.' }); - $('#balance').jqxTooltip({ content: 'De ionen balans van het water. Ideaal minder dan 0.1 verschil tussen kationen en anionen. Meer dan 0.5 is een fout in het waterraport.' }); - - // initialize the input fields. - $('#name').jqxInput({ theme: theme, width: 640, height: 23 }); - $('#notes').jqxInput({ theme: theme, width: 800, height: 100 }); - $('#calcium').jqxNumberInput(Spin1dec); - $('#bicarbonate').jqxNumberInput(Spin1dec); - $('#sulfate').jqxNumberInput(Spin1dec); - $('#chloride').jqxNumberInput(Spin1dec); - $('#sodium').jqxNumberInput(Spin1dec); - $('#magnesium').jqxNumberInput(Spin1dec); - $('#ph').jqxNumberInput(Spin2pH); - $('#total_alkalinity').jqxNumberInput(Spin1dec); - $('#balance').jqxNumberInput(Show2dec); - - // initialize jqxGrid - $('#jqxgrid').jqxGrid({ - width: 1280, - height: 630, - source: dataAdapter, - theme: theme, - showstatusbar: true, - renderstatusbar: function(statusbar) { - var rowCount = $("#jqxgrid").jqxGrid('getrows').length; - statusbar.append('<div style="float: left; margin: 8px; color: orange !important;">Aantal items: ' + rowCount + '</div>'); - var container = $('<div style="overflow: hidden; position: relative; margin: 5px;"></div>'), - addButton = $('<div style="float: right; margin-right: 15px;"><img style="position: relative; margin-top: 2px;" ' + - 'src="images/add.png"/><span style="margin-left: 4px; position: relative; top: -4px;">Nieuw</span></div>'); - container.append(addButton); - statusbar.append(container); - addButton.jqxButton({ theme: theme, width: 90, height: 17 }); - // add new row. - addButton.click(function(event) { - editrow = -1; - $('#popupWindow').jqxWindow({ position: { x: 110, y: 30 } }); - dataRecord.uuid = ''; - $('#name').val(''); - $('#calcium').val(0); - $('#bicarbonate').val(0); - $('#sulfate').val(0); - $('#chloride').val(0); - $('#sodium').val(0); - $('#magnesium').val(0); - $('#ph').val(7); - $('#notes').val(''); - $('#total_alkalinity').val(0); - $('#popupWindow').jqxWindow('open'); - }); - }, - filterable: false, - filtermode: 'excel', - columns: [ - { text: 'Water Profiel', datafield: 'name', width: 225 }, - { text: 'Opmerkingen', datafield: 'notes' }, - { text: 'Ca', datafield: 'calcium', width: 60, align: 'right', cellsalign: 'right', cellsformat: 'f1' }, - { text: 'Mg', datafield: 'magnesium', width: 60, align: 'right', cellsalign: 'right', cellsformat: 'f1' }, - { text: 'Na', datafield: 'sodium', width: 60, align: 'right', cellsalign: 'right', cellsformat: 'f1' }, - { text: 'CaCO3', datafield: 'total_alkalinity', width: 60, align: 'right', cellsalign: 'right', cellsformat: 'f1' }, - { text: 'Cl', datafield: 'chloride', width: 60, align: 'right', cellsalign: 'right', cellsformat: 'f1' }, - { text: 'SO4', datafield: 'sulfate', width: 60, align: 'right', cellsalign: 'right', cellsformat: 'f1' }, - { text: 'pH', datafield: 'ph', width: 60, align: 'right', cellsalign: 'right', cellsformat: 'f1' }, - { text: '', datafield: 'Edit', width: 100, columntype: 'button', - cellsrenderer: function() { - return 'Wijzig'; - }, buttonclick: function(row) { - // open the popup window when the user clicks a button. - editrow = row; - $('#popupWindow').jqxWindow({ position: { x: 110, y: 30 } }); - // get the clicked row's data and initialize the input fields. - dataRecord = $('#jqxgrid').jqxGrid('getrowdata', editrow); - $('#name').val(dataRecord.name); - $('#calcium').val(dataRecord.calcium); - $('#bicarbonate').val(dataRecord.bicarbonate); - $('#sulfate').val(dataRecord.sulfate); - $('#chloride').val(dataRecord.chloride); - $('#sodium').val(dataRecord.sodium); - $('#magnesium').val(dataRecord.magnesium); - $('#ph').val(dataRecord.ph); - $('#notes').val(dataRecord.notes); - $('#total_alkalinity').val(dataRecord.total_alkalinity); - calcBalance(); - // show the popup window. - $('#popupWindow').jqxWindow('open'); - } - } - ] - }); - - function calcBalance() { - var cations = (dataRecord.calcium / 20.039) + (dataRecord.magnesium / 12.1525) + (dataRecord.sodium / 22.989); - var anions = (dataRecord.bicarbonate / 61.016) + (dataRecord.sulfate / 48.031) + (dataRecord.chloride / 35.4527); - var balance = Round(cations - anions, 2); - $('#balance').val(balance); - if (balance <= 0.1 && balance >= -0.1) - $('#wr_balance').html("<img src='images/dialog-ok-apply.png'>"); - else if (balance <= 0.5 && balance >= -0.5) - $('#wr_balance').html("<img src='images/dialog-ok.png'>"); - else - $('#wr_balance').html("<img src='images/dialog-error.png'>"); - } - - $('#calcium').on('change', function(event) { - dataRecord.calcium = parseFloat(event.args.value); - calcBalance(); - }); - $('#magnesium').on('change', function(event) { - dataRecord.magnesium = parseFloat(event.args.value); - calcBalance(); - }); - $('#sodium').on('change', function(event) { - dataRecord.sodium = parseFloat(event.args.value); - calcBalance(); - }); - $('#total_alkalinity').on('change', function(event) { - dataRecord.total_alkalinity = parseFloat(event.args.value); - dataRecord.bicarbonate = parseFloat(event.args.value) * 1.22; - $('#bicarbonate').val(dataRecord.bicarbonate); - calcBalance(); - }); - $('#bicarbonate').on('change', function(event) { - dataRecord.bicarbonate = parseFloat(event.args.value); - dataRecord.total_alkalinity = parseFloat(event.args.value) * 50 / 61; - $('#total_alkalinity').val(dataRecord.total_alkalinity); - calcBalance(); - }); - $('#sulfate').on('change', function(event) { - dataRecord.sulfate = parseFloat(event.args.value); - calcBalance(); - }); - $('#chloride').on('change', function(event) { - dataRecord.chloride = parseFloat(event.args.value); - calcBalance(); - }); - - // initialize the popup window and buttons. - $('#popupWindow').jqxWindow({ - width: 1050, - height: 550, - resizable: false, - theme: theme, - isModal: true, - autoOpen: false, - cancelButton: $('#Cancel'), - modalOpacity: 0.40 - }); - $('#popupWindow').on('open', function() { - $('#name').jqxInput('selectAll'); - }); - $('#Delete').jqxButton({ template: 'danger', width: '90px', theme: theme }); - $('#Delete').click(function() { - if (editrow >= 0) { - // Open a popup to confirm this action. - $('#eventWindow').jqxWindow('open'); - $('#delOk').click(function() { - var rowID = $('#jqxgrid').jqxGrid('getrowid', editrow); - $('#jqxgrid').jqxGrid('deleterow', rowID); - }); - } - $('#popupWindow').jqxWindow('hide'); - }); - $('#Cancel').jqxButton({ template: 'primary', width: '90px', theme: theme }); - $('#Save').jqxButton({ template: 'success', width: '90px', theme: theme }); - // update the edited row when the user clicks the 'Save' button. - $('#Save').click(function() { - var row, rowID = -1; - if (editrow >= 0) { - rowID = $('#jqxgrid').jqxGrid('getrowid', editrow); - } - row = { - record: rowID, - uuid: dataRecord.uuid, - name: $('#name').val(), - calcium: parseFloat($('#calcium').jqxNumberInput('decimal')), - bicarbonate: parseFloat($('#bicarbonate').jqxNumberInput('decimal')), - sulfate: parseFloat($('#sulfate').jqxNumberInput('decimal')), - chloride: parseFloat($('#chloride').jqxNumberInput('decimal')), - sodium: parseFloat($('#sodium').jqxNumberInput('decimal')), - magnesium: parseFloat($('#magnesium').jqxNumberInput('decimal')), - ph: parseFloat($('#ph').jqxNumberInput('decimal')), - notes: $('#notes').val(), - total_alkalinity: parseFloat($('#total_alkalinity').jqxNumberInput('decimal')) - }; - if (editrow >= 0) { - $('#jqxgrid').jqxGrid('updaterow', rowID, row); - } else { - $('#jqxgrid').jqxGrid('addrow', null, row); - } - $('#popupWindow').jqxWindow('hide'); - }); - createDelElements(); -}); -
--- a/www/profile_fermentation.php Mon Jul 11 15:46:18 2022 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,51 +0,0 @@ -<?php -require_once($_SERVER['DOCUMENT_ROOT'].'/includes/global.inc.php'); -page_header('Vergisting profielen', 'profile_fermentation'); -?> - - <div id="jqxgrid"></div> - <div style="margin-top: 30px;"> - <div id="cellbegineditevent"></div> - <div style="margin-top: 10px;" id="cellendeditevent"></div> - </div> - - <!-- Popup editor window. --> - <div id="popupWindow"> - <div>Wijzig vergisting profiel.</div> - <div style="overflow: hidden;"> - <table style="width: 100%;"> - <tr> - <td align="right" style="vertical-align: top;">Profiel naam:</td> - <td align="left" colspan="3" style="vertical-align: top;"><input id="name" /></td> - </tr> - <tr> - <td align="right" style="vertical-align: top;">Begin laag °C:</td> - <td align="left"><div id="inittemp_lo"></div></td> - <td align="right" style="vertical-align: top;">Begin hoog °C:</td> - <td align="left"><div id="inittemp_hi"></div></td> - </tr> - <tr> - <td align="right" style="vertical-align: top;">Koelkast sensor:</td> - <td align="left" colspan="3"><div id="fridgemode"></div></td> - </tr> - <tr> - <td align="right" style="vertical-align: top;">Stappen:</td> - <td align="left" colspan="3"><div id="grid"></div></td> - </tr> - <tr> - <td style="padding-top: 40px;" align="right"><input type="button" id="Delete" value="Verwijder" /></td> - <td style="padding-top: 40px;" align="left"><input type="button" id="Clone" value="Kloon" /></td> - <td align="right"></td> - <td style="padding-top: 40px;" align="left"> - <input style="margin-right: 5px;" type="button" id="Save" value="Sla op" /> - <input id="Cancel" type="button" value="Annuleer" /> - </td> - </tr> - </table> - </div> - </div> - -<?php -confirm_delete(); -page_footer(); -?>
--- a/www/profile_mash.php Mon Jul 11 15:46:18 2022 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,85 +0,0 @@ -<?php -require_once($_SERVER['DOCUMENT_ROOT'].'/includes/global.inc.php'); -page_header('Maisch schemas', 'profile_mash'); -?> - - <div id="jqxgrid"></div> - <div style="margin-top: 30px;"> - <div id="cellbegineditevent"></div> - <div style="margin-top: 10px;" id="cellendeditevent"></div> - </div> - - <!-- Popup editor window. --> - <div id="popupWindow"> - <div>Wijzig maisch schema.</div> - <div style="overflow: hidden;"> - <table style="width: 100%;"> - <tr> - <td align="right" style="vertical-align: top;">Schema naam:</td> - <td align="left" colspan="2" style="vertical-align: top;"><input id="name" /></td> - <td style="width: 25%;"> </td> - </tr> - <tr> - <td align="right" style="vertical-align: top;">Opmerkingen:</td> - <td align="left" colspan="3"><textarea id="notes"></textarea></td> - </tr> - <tr> - <td colspan="4"> </td> - </tr> - <tr> - <td align="center" colspan="4"><div id="grid"></div></td> - </tr> - <tr> - <td style="padding-top: 10px;" align="right"><input type="button" id="Delete" value="Verwijder" /></td> - <td align="right"></td> - <td align="right"></td> - <td style="padding-top: 10px;" align="left"> - <input style="margin-right: 5px;" type="button" id="Save" value="Sla op" /> - <input id="Cancel" type="button" value="Annuleer" /> - </td> - </tr> - </table> - </div> - </div> - - <div id="popupStep"> - <div>Wijzig maisch stap details.</div> - <div style="overflow: hidden;"> - <table style="width: 100%;"> - <tr> - <td align="right" style="vertical-align: top;">Stap naam:</td> - <td align="left" style="vertical-align: top;"><input id="m_step_name" /></td> - </tr> - <tr> - <td align="right" style="vertical-align: top;">Stap type:</td> - <td align="left"><div id="m_step_type"></div></td> - </tr> - <tr> - <td align="right" style="vertical-align: top;">Begin temperatuur °C:</td> - <td align="left"><div id="m_step_temp"></div></td> - </tr> - <tr> - <td align="right" style="vertical-align: top;">Eind temperatuur °C:</td> - <td align="left"><div id="m_end_temp"></div></td> - </tr> - <tr> - <td align="right" style="vertical-align: top;">Rust tijd minuten:</td> - <td align="left"><div id="m_step_time"></div></td> - </tr> - <tr> - <td align="right" style="vertical-align: top;">Opwarm tijd minuten:</td> - <td align="left"><div id="m_ramp_time"></div></td> - </tr> - <tr> - <td style="padding-top: 50px;" colspan="2" align="center"> - <input id="Ready" type="button" value="Sla op" /> - </td> - </tr> - </table> - </div> - </div> - -<?php -confirm_delete(); -page_footer(); -?>
--- a/www/profile_styles.php Mon Jul 11 15:46:18 2022 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,104 +0,0 @@ -<?php -require_once($_SERVER['DOCUMENT_ROOT'].'/includes/global.inc.php'); -page_header('Bier stijlen', 'profile_styles'); -?> - - <div id="jqxgrid"></div> - <div style="margin-top: 30px;"> - <div id="cellbegineditevent"></div> - <div style="margin-top: 10px;" id="cellendeditevent"></div> - </div> - - <!-- Popup editor window. --> - <div id="popupWindow"> - <div>Wijzig bier stijl.</div> - <div style="overflow: hidden;"> - <table style="width: 100%;"> - <tr> - <td align="right" style="vertical-align: top;">Bier stijl:</td> - <td align="left" style="vertical-align: top;"><input id="name" /></td> - <td align="right" style="vertical-align: top;">Bier groep:</td> - <td align="left" style="vertical-align: top;"><input id="style_letter" /></td> - </tr> - <tr> - <td align="right" style="vertical-align: top;">Categorie:</td> - <td align="left" style="vertical-align: top;"><input id="category" /></td> - <td align="right" style="vertical-align: top;">Categorie nummer:</td> - <td align="left" style="vertical-align: top;"><input id="category_number" /></td> - </tr> - <tr> - <td align="right" style="vertical-align: top;">Profiel:</td> - <td align="left" colspan="3"><textarea id="profile"></textarea></td> - </tr> - <tr> - <td align="right" style="vertical-align: top;">Opmerkingen:</td> - <td align="left" colspan="3"><textarea id="notes"></textarea></td> - </tr> - <tr> - <td align="right" style="vertical-align: top;">Type:</td> - <td align="left"><div id="type"></div></td> - <td align="right" style="vertical-align: top;">Stijl gids:</td> - <td align="left" style="vertical-align: top;"><input id="style_guide" /></td> - </tr> - - <tr> - <td align="right" style="vertical-align: top;">Minimum start SG:</td> - <td align="left" style="vertical-align: top;"><input id="og_min" /></td> - <td align="right" style="vertical-align: top;">Minimum kleur EBC:</td> - <td align="left" style="vertical-align: top;"><input id="color_min" /></td> - </tr> - <tr> - <td align="right" style="vertical-align: top;">Maximum start SG:</td> - <td align="left" style="vertical-align: top;"><input id="og_max" /></td> - <td align="right" style="vertical-align: top;">Maximum kleur EBC:</td> - <td align="left" style="vertical-align: top;"><input id="color_max" /></td> - </tr> - <tr> - <td align="right" style="vertical-align: top;">Minimum eind SG:</td> - <td align="left" style="vertical-align: top;"><input id="fg_min" /></td> - <td align="right" style="vertical-align: top;">Minimum koolzuur vol:</td> - <td align="left" style="vertical-align: top;"><input id="carb_min" /></td> - </tr> - <tr> - <td align="right" style="vertical-align: top;">Maximum eind SG:</td> - <td align="left" style="vertical-align: top;"><input id="fg_max" /></td> - <td align="right" style="vertical-align: top;">Maximum koolzuur vol:</td> - <td align="left" style="vertical-align: top;"><input id="carb_max" /></td> - </tr> - <tr> - <td align="right" style="vertical-align: top;">Minimum bitterheid IBU:</td> - <td align="left" style="vertical-align: top;"><input id="ibu_min" /></td> - <td align="right" style="vertical-align: top;">Minimum alcohol vol %:</td> - <td align="left" style="vertical-align: top;"><input id="abv_min" /></td> - </tr> - <tr> - <td align="right" style="vertical-align: top;">Maximum bitterheid IBU:</td> - <td align="left" style="vertical-align: top;"><input id="ibu_max" /></td> - <td align="right" style="vertical-align: top;">Maximum alcohol vol %:</td> - <td align="left" style="vertical-align: top;"><input id="abv_max" /></td> - </tr> - <tr> - <td align="right" style="vertical-align: top;">Ingredienten:</td> - <td align="left" colspan="3"><textarea id="ingredients"></textarea></td> - </tr> - <tr> - <td align="right" style="vertical-align: top;">Voorbeelden:</td> - <td align="left" colspan="3"><textarea id="examples"></textarea></td> - </tr> - <tr> - <td style="padding-top: 10px;" align="right"><input type="button" id="Delete" value="Verwijder" /></td> - <td align="right"></td> - <td align="right"></td> - <td style="padding-top: 10px;" align="left"> - <input style="margin-right: 5px;" type="button" id="Save" value="Sla op" /> - <input id="Cancel" type="button" value="Annuleer" /> - </td> - </tr> - </table> - </div> - </div> - -<?php -confirm_delete(); -page_footer(); -?>
--- a/www/profile_water.php Mon Jul 11 15:46:18 2022 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,77 +0,0 @@ -<?php -require_once($_SERVER['DOCUMENT_ROOT'].'/includes/global.inc.php'); -page_header('Water profielen', 'profile_water'); -?> - - <div id="jqxgrid"></div> - <div style="margin-top: 30px;"> - <div id="cellbegineditevent"></div> - <div style="margin-top: 10px;" id="cellendeditevent"></div> - </div> - - <!-- Popup editor window. --> - <div id="popupWindow"> - <div>Wijzig brouwwater profiel.</div> - <div style="overflow: hidden;"> - <table style="width: 100%;"> - <tr> - <td align="right" style="vertical-align: top;">Water naam:</td> - <td align="left" colspan="3" style="vertical-align: top;"><input id="name" /></td> - </tr> - <tr> - <td align="right" style="vertical-align: top;">Opmerkingen:</td> - <td align="left" colspan="3"><textarea id="notes"></textarea></td> - </tr> - <tr> - <td colspan="4"> </td> - </tr> - <tr> - <td style="vertical-align: top; float: right;">Calcium (Ca) mg/L:</td> - <td><div id="calcium"></div></td> - <td style="vertical-align: top; float: right;">Sulfaat (CaSO4) mg/L:</td> - <td><div id="sulfate"></div></td> - </tr> - <tr> - <td style="vertical-align: top; float: right;">Magnesium (Mg) mg/L:</td> - <td><div id="magnesium"></div></td> - <td style="vertical-align: top; float: right;">Chloride (Cl) mg/L:</td> - <td><div id="chloride"></div></td> - </tr> - <tr> - <td style="vertical-align: top; float: right;">Natrium (Na) mg/L:</td> - <td><div id="sodium"></div></td> - <td style="vertical-align: top; float: right;">Bicarbonaat (HCO3) mg/L:</td> <!-- Input for total_alkalinity --> - <td><div id="bicarbonate"></div></td> - </tr> - <tr> - <td></td> - <td></td> - <td style="vertical-align: top; float: right;">Totale alkaliteit (CaCO3) mg/L:</td> - <td><div id="total_alkalinity"></div></td> - </tr> - <tr> - <td colspan="4"> </td> - </tr> - <tr> - <td style="vertical-align: top; float: right;">Zuurgraad (pH):</td> - <td><div id="ph"></div></td> - <td style="vertical-align: top; float: right;">Ionen balans meq/L:</td> - <td><div style="float: left;" id="balance"></div><div style="float: left; margin-left: 10px;" id="wr_balance"></div></td> - </tr> - <tr> - <td style="padding-top: 110px;" align="right"><input type="button" id="Delete" value="Verwijder" /></td> - <td align="right"></td> - <td align="right"></td> - <td style="padding-top: 110px;" align="left"> - <input style="margin-right: 5px;" type="button" id="Save" value="Sla op" /> - <input id="Cancel" type="button" value="Annuleer" /> - </td> - </tr> - </table> - </div> - </div> - -<?php -confirm_delete(); -page_footer(); -?>