Added view archives by name

Sun, 24 Feb 2019 23:26:01 +0100

author
Michiel Broek <mbroek@mbse.eu>
date
Sun, 24 Feb 2019 23:26:01 +0100
changeset 290
12aa92828e24
parent 289
4082c41f45e9
child 291
869247533c5f

Added view archives by name

README.design file | annotate | diff | comparison | revisions
www/includes/db_product.php file | annotate | diff | comparison | revisions
www/includes/global.inc.php file | annotate | diff | comparison | revisions
www/js/prod_archive_name.js file | annotate | diff | comparison | revisions
www/prod_archive_name.php file | annotate | diff | comparison | revisions
--- a/README.design	Sun Feb 24 22:29:00 2019 +0100
+++ b/README.design	Sun Feb 24 23:26:01 2019 +0100
@@ -139,3 +139,15 @@
 
 -----------------------------------------------------------------------------
 
+TODO:
+
+Copieren recepten tussen products en recipes, maar ook dupliceren. Import.
+Menu voor archive products.
+Cron uitbreiden met test op nieuw verschenen logfiles. Of nog slimmer, zet de
+logfile aan zodra een product in een gistkast geladen is.
+Download gist temperatuur grenzen naar thermferm zodat die opgevraagd kunnen
+worden door de monitor. Die kan dan de kleuren op de thermometers aanpassen.
+Download en import brouw logs van de brouwcontroller.
+Import van ingredienten vanuit xml bestanden zoals die van brouwhulp.
+Export ingredienten naar xml.
+
--- a/www/includes/db_product.php	Sun Feb 24 22:29:00 2019 +0100
+++ b/www/includes/db_product.php	Sun Feb 24 23:26:01 2019 +0100
@@ -436,6 +436,22 @@
 		return;
 	}
 
+	if (isset($_GET['select']) && ($_GET['select'] == "archname")) {
+		$query = "SELECT record,name,code,birth,batch_size FROM products WHERE stage = '11' ORDER BY name,birth;";
+		$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'],
+				'code' => $row['code'],
+				'birth' => $row['birth'],
+				'batch_size' => $row['batch_size']
+			);
+		}
+	        echo json_encode($brews, JSON_UNESCAPED_UNICODE);
+	        return;
+	}
+
 	/*
 	 * SELECT, produce a list of products that can be fermented.
 	 */
--- a/www/includes/global.inc.php	Sun Feb 24 22:29:00 2019 +0100
+++ b/www/includes/global.inc.php	Sun Feb 24 23:26:01 2019 +0100
@@ -217,7 +217,7 @@
        <li><a href="prod_new.php?return=index.php">Start nieuw</a></li>
        <li>Archief
 	<ul>
-         <li>Op naam</li>
+         <li><a href="prod_archive_name.php">Op naam</a></li>
          <li>Op code</li>
          <li>Op datum</li>
         </ul>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/www/js/prod_archive_name.js	Sun Feb 24 23:26:01 2019 +0100
@@ -0,0 +1,60 @@
+/*****************************************************************************
+ * Copyright (C) 2019
+ *
+ * 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.
+ *
+ * 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.
+ *****************************************************************************/
+
+
+$(document).ready(function () {
+	var source = {
+		datatype: "json",
+		cache: false,
+		datafields: [
+			{ name: 'record', type: 'number' },
+			{ name: 'name', type: 'string' },
+			{ name: 'code', type: 'string' },
+			{ name: 'birth', type: 'string' },
+			{ name: 'batch_size', type: 'float' },
+		],
+		id: 'record',
+		url: "includes/db_product.php?select=archname"
+	};
+	var dataAdapter = new $.jqx.dataAdapter(source);
+	// initialize jqxGrid
+	$("#jqxgrid").jqxGrid({
+		width: 1280,
+		height: 630,
+		source: dataAdapter,
+		theme: theme,
+		columns: [
+			{ text: 'Naam', datafield: 'name' },
+			{ text: 'Datum', datafield: 'birth', width: 120 },
+			{ text: 'Code', datafield: 'code', width: 120 },
+			{ text: 'Liters', datafield: 'batch_size', width: 110, align: 'right', cellsalign: 'right', cellsformat: 'f1' },
+			{ text: '', datafield: 'Edit', width: 100, align: 'center', columntype: 'button', cellsrenderer: function () {
+				return "Bekijk";
+				}, buttonclick: function (row) {
+					var datarecord = dataAdapter.records[row];
+					var url= "prod_edit.php?record=" + datarecord.record + "&select=archname&return=prod_archive_name.php";
+					window.location.href = url;
+				}
+			}
+		],
+	});
+});
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/www/prod_archive_name.php	Sun Feb 24 23:26:01 2019 +0100
@@ -0,0 +1,14 @@
+<?php
+require_once($_SERVER['DOCUMENT_ROOT'].'/includes/global.inc.php');
+page_header('Producten archief', 'prod_archive_name');
+?>
+
+   <div id="jqxgrid"></div>
+    <div style="margin-top: 30px;">
+    <div id="cellbegineditevent"></div>
+    <div style="margin-top: 10px;" id="cellendeditevent"></div>
+   </div>
+
+<?php
+page_footer();
+?>

mercurial