www/js/prod_inprod.js

Fri, 25 Jan 2019 13:33:10 +0100

author
Michiel Broek <mbroek@mbse.eu>
date
Fri, 25 Jan 2019 13:33:10 +0100
changeset 201
f9b7e3f6be7c
parent 151
2c9cfe2f0860
child 235
0a063ac5d7f5
permissions
-rw-r--r--

Fixed yeast database import differences between grams, ml and packs. Added cells field filled with defaults. Some edit screen improvements. Dynamic prompts depending on the yeast type. Disable men and filter of most columns in the yeasts list. Friendlier display of inverntory.

/*****************************************************************************
 * 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: 'name', type: 'string' },
			{ name: 'code', type: 'string' },
			{ name: 'birth', type: 'string' },
			{ name: 'stage', type: 'string' },
		],
		id: 'record',
		url: "includes/db_product.php?select=inprod"
	};
	var dataAdapter = new $.jqx.dataAdapter(source);
	// initialize jqxGrid
	$("#jqxgrid").jqxGrid({
		width: 1280,
		height: 630,
		source: dataAdapter,
		theme: theme,
		showstatusbar: true,
		localization: getLocalization(),
		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: 120, height: 20 });
			// add new recipe.
			addButton.click(function (event) {
				var url= "prod_new.php?return=prod_inprod.php";
				window.location.href = url;
			});
		},
		filterable: true,
		filtermode: 'excel',
		columns: [
			{ text: 'Datum', datafield: 'birth', width: 120 },
			{ text: 'Code', datafield: 'code', width: 120 },
			{ text: 'Naam', datafield: 'name' },
			{ text: 'Fase', datafield: 'stage', width: 130 },
			{ text: 'Wijzig', datafield: 'Edit', width: 120, align: 'center', columntype: 'button', cellsrenderer: function () {
				return "Wijzig";
				}, buttonclick: function (row) {
					var datarecord = dataAdapter.records[row];
					var url= "prod_edit.php?record=" + datarecord.record + "&select=inprod&return=prod_inprod.php";
					window.location.href = url;
				}
			}
		],
	});
});

mercurial