www/js/rec_main.js

Sun, 02 Jun 2019 12:48:54 +0200

author
Michiel Broek <mbroek@mbse.eu>
date
Sun, 02 Jun 2019 12:48:54 +0200
changeset 392
544d7d0183b2
parent 286
124af734af68
child 471
0bf73d605604
permissions
-rw-r--r--

Added 15 fields to the recipes table. Added 18 fields to the products table. These are calculated values that are now stored in the database so export programs can use these values without calculating them again. Product and recipe print have water and mash schedule added. Product print has brewday results added if the brewday is over. The ingredients layout changed in the product and recipe prints.

/*****************************************************************************
 * Copyright (C) 2018
 *
 * 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: 'st_name', type: 'string' },
			{ name: 'st_letter', type: 'string' },
			{ name: 'st_guide', type: 'string' },
			{ name: 'name', type: 'string' },
			{ name: 'est_og', type: 'float' },
			{ name: 'est_color', type: 'float' },
			{ name: 'est_ibu', type: 'float' },
			{ name: 'est_abv', type: 'float' },
		],
		id: 'record',
		url: "includes/db_recipes.php"
	};
	var dataAdapter = new $.jqx.dataAdapter(source);
	// initialize jqxGrid
	$("#jqxgrid").jqxGrid({
		width: 1280,
		height: 630,
		source: dataAdapter,
		groupable: true,
		theme: theme,
		showstatusbar: true,
		renderstatusbar: function (statusbar) {
			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: -3px;'>Add</span></div>");
			container.append(addButton);
			statusbar.append(container);
			addButton.jqxButton({ theme: theme, width: 100, height: 20 });
			// add new recipe.
			addButton.click(function (event) {
				var url= "rec_new.php?return=rec_main.php";
				window.location.href = url;
			});
		},
		filterable: true,
		filtermode: 'excel',
		columns: [
			{ text: 'Stijlgids', datafield: 'st_guide', width: 120 },
			{ text: 'Letter', datafield: 'st_letter', width: 60 },
			{ text: 'Stijl', datafield: 'st_name', width: 160 },
			{ text: 'Naam', datafield: 'name' },
			{ text: 'OG', datafield: 'est_og', width: 60, align: 'right', cellsalign: 'right', cellsformat: 'f3' },
			{ text: 'EBC', datafield: 'est_color', width: 60, align: 'right', cellsalign: 'right', cellsformat: 'f0' },
			{ text: 'IBU', datafield: 'est_ibu', width: 60, align: 'right', cellsalign: 'right', cellsformat: 'f0' },
			{ text: 'ABV', datafield: 'est_abv', width: 60, align: 'right', cellsalign: 'right', cellsformat: 'p1' },
			{ text: '', datafield: 'Edit', width: 120, align: 'center', columntype: 'button', cellsrenderer: function () {
				return "Wijzig";
				}, buttonclick: function (row) {
					var datarecord = dataAdapter.records[row];
					var url= "rec_edit.php?record=" + datarecord.record + "&return=rec_main.php";
					window.location.href = url;
				}
			}
		],
		groups: ['st_guide','st_letter' ]
	});
});

mercurial