www/js/profile_setup.js

Tue, 26 Feb 2019 16:18:16 +0100

author
Michiel Broek <mbroek@mbse.eu>
date
Tue, 26 Feb 2019 16:18:16 +0100
changeset 296
69fadd1aded2
parent 289
4082c41f45e9
child 446
ee7bcfb8e270
permissions
-rw-r--r--

Updated design document. Add content header application/json to all scripts that produce json output. Chart prints show the beer code and name in the header. Charts don't display the menu anymore.

99
f433193f7bb6 Removed default water setting from the inventory_waters table. Added global setup record with default settings and the default water selection. Added a setup screen.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1 /*****************************************************************************
218
38499e3859fa Global setup switched to dropdown indexes.
Michiel Broek <mbroek@mbse.eu>
parents: 103
diff changeset
2 * Copyright (C) 2019
99
f433193f7bb6 Removed default water setting from the inventory_waters table. Added global setup record with default settings and the default water selection. Added a setup screen.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
3 *
f433193f7bb6 Removed default water setting from the inventory_waters table. Added global setup record with default settings and the default water selection. Added a setup screen.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
4 * Michiel Broek <mbroek at mbse dot eu>
f433193f7bb6 Removed default water setting from the inventory_waters table. Added global setup record with default settings and the default water selection. Added a setup screen.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
5 *
f433193f7bb6 Removed default water setting from the inventory_waters table. Added global setup record with default settings and the default water selection. Added a setup screen.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
6 * This file is part of BMS
f433193f7bb6 Removed default water setting from the inventory_waters table. Added global setup record with default settings and the default water selection. Added a setup screen.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
7 *
f433193f7bb6 Removed default water setting from the inventory_waters table. Added global setup record with default settings and the default water selection. Added a setup screen.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
8 * This is free software; you can redistribute it and/or modify it
f433193f7bb6 Removed default water setting from the inventory_waters table. Added global setup record with default settings and the default water selection. Added a setup screen.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
9 * under the terms of the GNU General Public License as published by the
f433193f7bb6 Removed default water setting from the inventory_waters table. Added global setup record with default settings and the default water selection. Added a setup screen.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
10 * Free Software Foundation; either version 2, or (at your option) any
f433193f7bb6 Removed default water setting from the inventory_waters table. Added global setup record with default settings and the default water selection. Added a setup screen.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
11 * later version.
f433193f7bb6 Removed default water setting from the inventory_waters table. Added global setup record with default settings and the default water selection. Added a setup screen.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
12 *
f433193f7bb6 Removed default water setting from the inventory_waters table. Added global setup record with default settings and the default water selection. Added a setup screen.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
13 * BrewCloud is distributed in the hope that it will be useful, but
f433193f7bb6 Removed default water setting from the inventory_waters table. Added global setup record with default settings and the default water selection. Added a setup screen.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
14 * WITHOUT ANY WARRANTY; without even the implied warranty of
f433193f7bb6 Removed default water setting from the inventory_waters table. Added global setup record with default settings and the default water selection. Added a setup screen.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
f433193f7bb6 Removed default water setting from the inventory_waters table. Added global setup record with default settings and the default water selection. Added a setup screen.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
16 * General Public License for more details.
f433193f7bb6 Removed default water setting from the inventory_waters table. Added global setup record with default settings and the default water selection. Added a setup screen.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
17 *
f433193f7bb6 Removed default water setting from the inventory_waters table. Added global setup record with default settings and the default water selection. Added a setup screen.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
18 * You should have received a copy of the GNU General Public License
f433193f7bb6 Removed default water setting from the inventory_waters table. Added global setup record with default settings and the default water selection. Added a setup screen.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
19 * along with ThermFerm; see the file COPYING. If not, write to the Free
f433193f7bb6 Removed default water setting from the inventory_waters table. Added global setup record with default settings and the default water selection. Added a setup screen.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
20 * Software Foundation, 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
f433193f7bb6 Removed default water setting from the inventory_waters table. Added global setup record with default settings and the default water selection. Added a setup screen.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
21 *****************************************************************************/
f433193f7bb6 Removed default water setting from the inventory_waters table. Added global setup record with default settings and the default water selection. Added a setup screen.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
22
f433193f7bb6 Removed default water setting from the inventory_waters table. Added global setup record with default settings and the default water selection. Added a setup screen.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
23
f433193f7bb6 Removed default water setting from the inventory_waters table. Added global setup record with default settings and the default water selection. Added a setup screen.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
24 $(document).ready(function () {
f433193f7bb6 Removed default water setting from the inventory_waters table. Added global setup record with default settings and the default water selection. Added a setup screen.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
25
f433193f7bb6 Removed default water setting from the inventory_waters table. Added global setup record with default settings and the default water selection. Added a setup screen.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
26 var dataRecord = {};
f433193f7bb6 Removed default water setting from the inventory_waters table. Added global setup record with default settings and the default water selection. Added a setup screen.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
27
f433193f7bb6 Removed default water setting from the inventory_waters table. Added global setup record with default settings and the default water selection. Added a setup screen.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
28 // dropdownlist datasource from inventory_waters, must load sync
f433193f7bb6 Removed default water setting from the inventory_waters table. Added global setup record with default settings and the default water selection. Added a setup screen.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
29 var waterUrl = "getwatersources.php";
f433193f7bb6 Removed default water setting from the inventory_waters table. Added global setup record with default settings and the default water selection. Added a setup screen.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
30 var waterInvSource = {
f433193f7bb6 Removed default water setting from the inventory_waters table. Added global setup record with default settings and the default water selection. Added a setup screen.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
31 datatype: "json",
f433193f7bb6 Removed default water setting from the inventory_waters table. Added global setup record with default settings and the default water selection. Added a setup screen.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
32 datafields: [
f433193f7bb6 Removed default water setting from the inventory_waters table. Added global setup record with default settings and the default water selection. Added a setup screen.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
33 { name: 'name', type: 'string' },
f433193f7bb6 Removed default water setting from the inventory_waters table. Added global setup record with default settings and the default water selection. Added a setup screen.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
34 ],
f433193f7bb6 Removed default water setting from the inventory_waters table. Added global setup record with default settings and the default water selection. Added a setup screen.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
35 url: waterUrl,
f433193f7bb6 Removed default water setting from the inventory_waters table. Added global setup record with default settings and the default water selection. Added a setup screen.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
36 async: false
f433193f7bb6 Removed default water setting from the inventory_waters table. Added global setup record with default settings and the default water selection. Added a setup screen.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
37 };
f433193f7bb6 Removed default water setting from the inventory_waters table. Added global setup record with default settings and the default water selection. Added a setup screen.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
38 var waterlist = new $.jqx.dataAdapter(waterInvSource);
f433193f7bb6 Removed default water setting from the inventory_waters table. Added global setup record with default settings and the default water selection. Added a setup screen.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
39
f433193f7bb6 Removed default water setting from the inventory_waters table. Added global setup record with default settings and the default water selection. Added a setup screen.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
40 var url = "includes/db_setup.php";
f433193f7bb6 Removed default water setting from the inventory_waters table. Added global setup record with default settings and the default water selection. Added a setup screen.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
41
f433193f7bb6 Removed default water setting from the inventory_waters table. Added global setup record with default settings and the default water selection. Added a setup screen.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
42 // Tooltips
f433193f7bb6 Removed default water setting from the inventory_waters table. Added global setup record with default settings and the default water selection. Added a setup screen.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
43 $("#brewery_name").jqxTooltip({ content: 'De naam voor deze brouwerij.' });
f433193f7bb6 Removed default water setting from the inventory_waters table. Added global setup record with default settings and the default water selection. Added a setup screen.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
44 $("#factor_mashhop").jqxTooltip({ content: 'Het efficientie percentage voor hop tijdens de maisch.' });
f433193f7bb6 Removed default water setting from the inventory_waters table. Added global setup record with default settings and the default water selection. Added a setup screen.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
45 $("#factor_fwh").jqxTooltip({ content: 'Het efficientie percentage voor First Wort Hop.' });
f433193f7bb6 Removed default water setting from the inventory_waters table. Added global setup record with default settings and the default water selection. Added a setup screen.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
46 $("#factor_pellet").jqxTooltip({ content: 'Het efficientie percentage bij gebruik van hop pellets.' });
f433193f7bb6 Removed default water setting from the inventory_waters table. Added global setup record with default settings and the default water selection. Added a setup screen.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
47 $("#factor_plug").jqxTooltip({ content: 'Het efficientie percentage bij gebruik van hop plugs.' });
289
4082c41f45e9 Added the use and calculation of wet hops. Assume 5.5 times more hops needed by weight.
Michiel Broek <mbroek@mbse.eu>
parents: 270
diff changeset
48 $("#factor_wethop").jqxTooltip({ content: 'Het efficientie percentage bij gebruik van nat geplukte hop.' });
99
f433193f7bb6 Removed default water setting from the inventory_waters table. Added global setup record with default settings and the default water selection. Added a setup screen.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
49 $("#brix_correction").jqxTooltip({ content: 'Omzettingsfactor voor Plato naar Brix' });
f433193f7bb6 Removed default water setting from the inventory_waters table. Added global setup record with default settings and the default water selection. Added a setup screen.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
50 $("#grain_absorbtion").jqxTooltip({ content: 'Absorbtie van water door graan (L/Kg)' });
f433193f7bb6 Removed default water setting from the inventory_waters table. Added global setup record with default settings and the default water selection. Added a setup screen.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
51
f433193f7bb6 Removed default water setting from the inventory_waters table. Added global setup record with default settings and the default water selection. Added a setup screen.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
52 // Prepare the data
f433193f7bb6 Removed default water setting from the inventory_waters table. Added global setup record with default settings and the default water selection. Added a setup screen.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
53 var source = {
f433193f7bb6 Removed default water setting from the inventory_waters table. Added global setup record with default settings and the default water selection. Added a setup screen.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
54 datatype: "json",
f433193f7bb6 Removed default water setting from the inventory_waters table. Added global setup record with default settings and the default water selection. Added a setup screen.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
55 cache: false,
f433193f7bb6 Removed default water setting from the inventory_waters table. Added global setup record with default settings and the default water selection. Added a setup screen.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
56 datafields: [
f433193f7bb6 Removed default water setting from the inventory_waters table. Added global setup record with default settings and the default water selection. Added a setup screen.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
57 { name: 'brewery_name', type: 'string' },
f433193f7bb6 Removed default water setting from the inventory_waters table. Added global setup record with default settings and the default water selection. Added a setup screen.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
58 /* { name: 'brewery_logo', type: 'array' }, */
f433193f7bb6 Removed default water setting from the inventory_waters table. Added global setup record with default settings and the default water selection. Added a setup screen.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
59 { name: 'factor_mashhop', type: 'number' },
f433193f7bb6 Removed default water setting from the inventory_waters table. Added global setup record with default settings and the default water selection. Added a setup screen.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
60 { name: 'factor_fwh', type: 'number' },
f433193f7bb6 Removed default water setting from the inventory_waters table. Added global setup record with default settings and the default water selection. Added a setup screen.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
61 { name: 'factor_pellet', type: 'number' },
f433193f7bb6 Removed default water setting from the inventory_waters table. Added global setup record with default settings and the default water selection. Added a setup screen.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
62 { name: 'factor_plug', type: 'number' },
289
4082c41f45e9 Added the use and calculation of wet hops. Assume 5.5 times more hops needed by weight.
Michiel Broek <mbroek@mbse.eu>
parents: 270
diff changeset
63 { name: 'factor_wethop', type: 'number' },
218
38499e3859fa Global setup switched to dropdown indexes.
Michiel Broek <mbroek@mbse.eu>
parents: 103
diff changeset
64 { name: 'ibu_method', type: 'int' },
38499e3859fa Global setup switched to dropdown indexes.
Michiel Broek <mbroek@mbse.eu>
parents: 103
diff changeset
65 { name: 'color_method', type: 'int' },
99
f433193f7bb6 Removed default water setting from the inventory_waters table. Added global setup record with default settings and the default water selection. Added a setup screen.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
66 { name: 'brix_correction', type: 'float' },
f433193f7bb6 Removed default water setting from the inventory_waters table. Added global setup record with default settings and the default water selection. Added a setup screen.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
67 { name: 'grain_absorbtion', type: 'float' },
f433193f7bb6 Removed default water setting from the inventory_waters table. Added global setup record with default settings and the default water selection. Added a setup screen.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
68 { name: 'default_water', type: 'string' }
f433193f7bb6 Removed default water setting from the inventory_waters table. Added global setup record with default settings and the default water selection. Added a setup screen.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
69 ],
f433193f7bb6 Removed default water setting from the inventory_waters table. Added global setup record with default settings and the default water selection. Added a setup screen.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
70 url: url
f433193f7bb6 Removed default water setting from the inventory_waters table. Added global setup record with default settings and the default water selection. Added a setup screen.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
71 };
f433193f7bb6 Removed default water setting from the inventory_waters table. Added global setup record with default settings and the default water selection. Added a setup screen.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
72
f433193f7bb6 Removed default water setting from the inventory_waters table. Added global setup record with default settings and the default water selection. Added a setup screen.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
73 // Load data and select one record.
f433193f7bb6 Removed default water setting from the inventory_waters table. Added global setup record with default settings and the default water selection. Added a setup screen.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
74 var dataAdapter = new $.jqx.dataAdapter(source, {
f433193f7bb6 Removed default water setting from the inventory_waters table. Added global setup record with default settings and the default water selection. Added a setup screen.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
75 loadComplete: function () {
f433193f7bb6 Removed default water setting from the inventory_waters table. Added global setup record with default settings and the default water selection. Added a setup screen.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
76 var records = dataAdapter.records;
f433193f7bb6 Removed default water setting from the inventory_waters table. Added global setup record with default settings and the default water selection. Added a setup screen.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
77 dataRecord = records[0];
f433193f7bb6 Removed default water setting from the inventory_waters table. Added global setup record with default settings and the default water selection. Added a setup screen.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
78 $("#brewery_name").val(dataRecord.brewery_name);
f433193f7bb6 Removed default water setting from the inventory_waters table. Added global setup record with default settings and the default water selection. Added a setup screen.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
79 $("#factor_mashhop").val(dataRecord.factor_mashhop);
f433193f7bb6 Removed default water setting from the inventory_waters table. Added global setup record with default settings and the default water selection. Added a setup screen.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
80 $("#factor_fwh").val(dataRecord.factor_fwh);
f433193f7bb6 Removed default water setting from the inventory_waters table. Added global setup record with default settings and the default water selection. Added a setup screen.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
81 $("#factor_pellet").val(dataRecord.factor_pellet);
f433193f7bb6 Removed default water setting from the inventory_waters table. Added global setup record with default settings and the default water selection. Added a setup screen.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
82 $("#factor_plug").val(dataRecord.factor_plug);
289
4082c41f45e9 Added the use and calculation of wet hops. Assume 5.5 times more hops needed by weight.
Michiel Broek <mbroek@mbse.eu>
parents: 270
diff changeset
83 $("#factor_wethop").val(dataRecord.factor_wethop);
99
f433193f7bb6 Removed default water setting from the inventory_waters table. Added global setup record with default settings and the default water selection. Added a setup screen.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
84 $("#color_method").val(dataRecord.color_method);
f433193f7bb6 Removed default water setting from the inventory_waters table. Added global setup record with default settings and the default water selection. Added a setup screen.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
85 $("#ibu_method").val(dataRecord.ibu_method);
f433193f7bb6 Removed default water setting from the inventory_waters table. Added global setup record with default settings and the default water selection. Added a setup screen.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
86 $("#brix_correction").val(dataRecord.brix_correction);
f433193f7bb6 Removed default water setting from the inventory_waters table. Added global setup record with default settings and the default water selection. Added a setup screen.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
87 $("#grain_absorbtion").val(dataRecord.grain_absorbtion);
f433193f7bb6 Removed default water setting from the inventory_waters table. Added global setup record with default settings and the default water selection. Added a setup screen.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
88 },
f433193f7bb6 Removed default water setting from the inventory_waters table. Added global setup record with default settings and the default water selection. Added a setup screen.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
89 loadError: function (jqXHR, status, error) {
f433193f7bb6 Removed default water setting from the inventory_waters table. Added global setup record with default settings and the default water selection. Added a setup screen.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
90 },
f433193f7bb6 Removed default water setting from the inventory_waters table. Added global setup record with default settings and the default water selection. Added a setup screen.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
91 });
f433193f7bb6 Removed default water setting from the inventory_waters table. Added global setup record with default settings and the default water selection. Added a setup screen.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
92 dataAdapter.dataBind();
f433193f7bb6 Removed default water setting from the inventory_waters table. Added global setup record with default settings and the default water selection. Added a setup screen.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
93
f433193f7bb6 Removed default water setting from the inventory_waters table. Added global setup record with default settings and the default water selection. Added a setup screen.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
94 // Editers
f433193f7bb6 Removed default water setting from the inventory_waters table. Added global setup record with default settings and the default water selection. Added a setup screen.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
95 $("#brewery_name").jqxInput({ theme: theme, width: 640, height: 23 });
270
cf4b4b63eb36 Code cleanup
Michiel Broek <mbroek@mbse.eu>
parents: 218
diff changeset
96 $("#factor_fwh").jqxNumberInput({ inputMode: 'simple', theme: theme, width: 110, height: 23, min: -50, max: 50, decimalDigits: 0, spinButtons: true, symbol: '%', symbolPosition: 'right' });
cf4b4b63eb36 Code cleanup
Michiel Broek <mbroek@mbse.eu>
parents: 218
diff changeset
97 $("#factor_mashhop").jqxNumberInput({ inputMode: 'simple', theme: theme, width: 110, height: 23, min: -50, max: 50, decimalDigits: 0, spinButtons: true, symbol: '%', symbolPosition: 'right' });
cf4b4b63eb36 Code cleanup
Michiel Broek <mbroek@mbse.eu>
parents: 218
diff changeset
98 $("#factor_pellet").jqxNumberInput({ inputMode: 'simple', theme: theme, width: 110, height: 23, min: 0, max: 20, decimalDigits: 0, spinButtons: true, symbol: '%', symbolPosition: 'right' });
cf4b4b63eb36 Code cleanup
Michiel Broek <mbroek@mbse.eu>
parents: 218
diff changeset
99 $("#factor_plug").jqxNumberInput({ inputMode: 'simple', theme: theme, width: 110, height: 23, min: 0, max: 20, decimalDigits: 0, spinButtons: true, symbol: '%', symbolPosition: 'right' });
289
4082c41f45e9 Added the use and calculation of wet hops. Assume 5.5 times more hops needed by weight.
Michiel Broek <mbroek@mbse.eu>
parents: 270
diff changeset
100 $("#factor_wethop").jqxNumberInput({ inputMode: 'simple', theme: theme, width: 110, height: 23, min: -98, max: -20, decimalDigits: 0, spinButtons: true, symbol: '%', symbolPosition: 'right' });
270
cf4b4b63eb36 Code cleanup
Michiel Broek <mbroek@mbse.eu>
parents: 218
diff changeset
101 $("#brix_correction").jqxNumberInput({ inputMode: 'simple', theme: theme, width: 110, height: 23, min: 1.00, max: 1.05, decimalDigits: 2, spinButtons: true });
cf4b4b63eb36 Code cleanup
Michiel Broek <mbroek@mbse.eu>
parents: 218
diff changeset
102 $("#grain_absorbtion").jqxNumberInput({ inputMode: 'simple', theme: theme, width: 110, height: 23, min: 0.5, max: 1.1, decimalDigits: 2, spinButtons: true });
218
38499e3859fa Global setup switched to dropdown indexes.
Michiel Broek <mbroek@mbse.eu>
parents: 103
diff changeset
103 $("#color_method").jqxDropDownList({
38499e3859fa Global setup switched to dropdown indexes.
Michiel Broek <mbroek@mbse.eu>
parents: 103
diff changeset
104 theme: theme,
38499e3859fa Global setup switched to dropdown indexes.
Michiel Broek <mbroek@mbse.eu>
parents: 103
diff changeset
105 source: ColorMethodAdapter,
38499e3859fa Global setup switched to dropdown indexes.
Michiel Broek <mbroek@mbse.eu>
parents: 103
diff changeset
106 valueMember: 'id',
38499e3859fa Global setup switched to dropdown indexes.
Michiel Broek <mbroek@mbse.eu>
parents: 103
diff changeset
107 displayMember: 'nl',
38499e3859fa Global setup switched to dropdown indexes.
Michiel Broek <mbroek@mbse.eu>
parents: 103
diff changeset
108 width: 180,
38499e3859fa Global setup switched to dropdown indexes.
Michiel Broek <mbroek@mbse.eu>
parents: 103
diff changeset
109 autoDropDownHeight: true
38499e3859fa Global setup switched to dropdown indexes.
Michiel Broek <mbroek@mbse.eu>
parents: 103
diff changeset
110 });
38499e3859fa Global setup switched to dropdown indexes.
Michiel Broek <mbroek@mbse.eu>
parents: 103
diff changeset
111 $("#ibu_method").jqxDropDownList({
38499e3859fa Global setup switched to dropdown indexes.
Michiel Broek <mbroek@mbse.eu>
parents: 103
diff changeset
112 theme: theme,
38499e3859fa Global setup switched to dropdown indexes.
Michiel Broek <mbroek@mbse.eu>
parents: 103
diff changeset
113 source: IBUmethodAdapter,
38499e3859fa Global setup switched to dropdown indexes.
Michiel Broek <mbroek@mbse.eu>
parents: 103
diff changeset
114 valueMember: 'id',
38499e3859fa Global setup switched to dropdown indexes.
Michiel Broek <mbroek@mbse.eu>
parents: 103
diff changeset
115 displayMember: 'nl',
38499e3859fa Global setup switched to dropdown indexes.
Michiel Broek <mbroek@mbse.eu>
parents: 103
diff changeset
116 width: 180,
38499e3859fa Global setup switched to dropdown indexes.
Michiel Broek <mbroek@mbse.eu>
parents: 103
diff changeset
117 autoDropDownHeight: true
38499e3859fa Global setup switched to dropdown indexes.
Michiel Broek <mbroek@mbse.eu>
parents: 103
diff changeset
118 });
99
f433193f7bb6 Removed default water setting from the inventory_waters table. Added global setup record with default settings and the default water selection. Added a setup screen.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
119 $('#default_water').jqxDropDownList({
f433193f7bb6 Removed default water setting from the inventory_waters table. Added global setup record with default settings and the default water selection. Added a setup screen.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
120 placeHolder: "Kies water:",
f433193f7bb6 Removed default water setting from the inventory_waters table. Added global setup record with default settings and the default water selection. Added a setup screen.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
121 theme: theme,
f433193f7bb6 Removed default water setting from the inventory_waters table. Added global setup record with default settings and the default water selection. Added a setup screen.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
122 source: waterlist,
f433193f7bb6 Removed default water setting from the inventory_waters table. Added global setup record with default settings and the default water selection. Added a setup screen.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
123 valueMember: "name",
f433193f7bb6 Removed default water setting from the inventory_waters table. Added global setup record with default settings and the default water selection. Added a setup screen.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
124 displayMember: "name",
f433193f7bb6 Removed default water setting from the inventory_waters table. Added global setup record with default settings and the default water selection. Added a setup screen.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
125 width: 250,
f433193f7bb6 Removed default water setting from the inventory_waters table. Added global setup record with default settings and the default water selection. Added a setup screen.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
126 dropDownHorizontalAlignment: 'right',
218
38499e3859fa Global setup switched to dropdown indexes.
Michiel Broek <mbroek@mbse.eu>
parents: 103
diff changeset
127 dropDownWidth: 300,
38499e3859fa Global setup switched to dropdown indexes.
Michiel Broek <mbroek@mbse.eu>
parents: 103
diff changeset
128 autoDropDownHeight: true
99
f433193f7bb6 Removed default water setting from the inventory_waters table. Added global setup record with default settings and the default water selection. Added a setup screen.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
129 });
f433193f7bb6 Removed default water setting from the inventory_waters table. Added global setup record with default settings and the default water selection. Added a setup screen.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
130 $('#default_water').jqxDropDownList( 'selectItem', dataRecord.default_water );
f433193f7bb6 Removed default water setting from the inventory_waters table. Added global setup record with default settings and the default water selection. Added a setup screen.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
131
f433193f7bb6 Removed default water setting from the inventory_waters table. Added global setup record with default settings and the default water selection. Added a setup screen.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
132 $("#Save").jqxButton({ template: "success", width: '90px', theme: theme });
f433193f7bb6 Removed default water setting from the inventory_waters table. Added global setup record with default settings and the default water selection. Added a setup screen.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
133 $("#Save").click(function () {
f433193f7bb6 Removed default water setting from the inventory_waters table. Added global setup record with default settings and the default water selection. Added a setup screen.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
134 var row = {
f433193f7bb6 Removed default water setting from the inventory_waters table. Added global setup record with default settings and the default water selection. Added a setup screen.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
135 record: 1,
f433193f7bb6 Removed default water setting from the inventory_waters table. Added global setup record with default settings and the default water selection. Added a setup screen.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
136 brewery_name: $("#brewery_name").val(),
f433193f7bb6 Removed default water setting from the inventory_waters table. Added global setup record with default settings and the default water selection. Added a setup screen.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
137 factor_mashhop: $("#factor_mashhop").val(),
f433193f7bb6 Removed default water setting from the inventory_waters table. Added global setup record with default settings and the default water selection. Added a setup screen.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
138 factor_fwh: $("#factor_fwh").val(),
f433193f7bb6 Removed default water setting from the inventory_waters table. Added global setup record with default settings and the default water selection. Added a setup screen.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
139 factor_pellet: $("#factor_pellet").val(),
f433193f7bb6 Removed default water setting from the inventory_waters table. Added global setup record with default settings and the default water selection. Added a setup screen.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
140 factor_plug: $("#factor_plug").val(),
289
4082c41f45e9 Added the use and calculation of wet hops. Assume 5.5 times more hops needed by weight.
Michiel Broek <mbroek@mbse.eu>
parents: 270
diff changeset
141 factor_wethop: $("#factor_wethop").val(),
99
f433193f7bb6 Removed default water setting from the inventory_waters table. Added global setup record with default settings and the default water selection. Added a setup screen.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
142 color_method: $("#color_method").val(),
f433193f7bb6 Removed default water setting from the inventory_waters table. Added global setup record with default settings and the default water selection. Added a setup screen.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
143 ibu_method: $("#ibu_method").val(),
f433193f7bb6 Removed default water setting from the inventory_waters table. Added global setup record with default settings and the default water selection. Added a setup screen.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
144 brix_correction: parseFloat($("#brix_correction").jqxNumberInput('decimal')),
f433193f7bb6 Removed default water setting from the inventory_waters table. Added global setup record with default settings and the default water selection. Added a setup screen.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
145 grain_absorbtion: parseFloat($("#grain_absorbtion").jqxNumberInput('decimal')),
f433193f7bb6 Removed default water setting from the inventory_waters table. Added global setup record with default settings and the default water selection. Added a setup screen.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
146 default_water: $("#default_water").val()
f433193f7bb6 Removed default water setting from the inventory_waters table. Added global setup record with default settings and the default water selection. Added a setup screen.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
147 };
f433193f7bb6 Removed default water setting from the inventory_waters table. Added global setup record with default settings and the default water selection. Added a setup screen.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
148 var data = "update=true&" + $.param(row);
f433193f7bb6 Removed default water setting from the inventory_waters table. Added global setup record with default settings and the default water selection. Added a setup screen.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
149 $.ajax({
f433193f7bb6 Removed default water setting from the inventory_waters table. Added global setup record with default settings and the default water selection. Added a setup screen.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
150 dataType: 'json',
f433193f7bb6 Removed default water setting from the inventory_waters table. Added global setup record with default settings and the default water selection. Added a setup screen.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
151 url: url,
f433193f7bb6 Removed default water setting from the inventory_waters table. Added global setup record with default settings and the default water selection. Added a setup screen.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
152 cache: false,
f433193f7bb6 Removed default water setting from the inventory_waters table. Added global setup record with default settings and the default water selection. Added a setup screen.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
153 data: data,
f433193f7bb6 Removed default water setting from the inventory_waters table. Added global setup record with default settings and the default water selection. Added a setup screen.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
154 type: "POST",
f433193f7bb6 Removed default water setting from the inventory_waters table. Added global setup record with default settings and the default water selection. Added a setup screen.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
155 success: function (data, status, xhr) {
f433193f7bb6 Removed default water setting from the inventory_waters table. Added global setup record with default settings and the default water selection. Added a setup screen.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
156 // update command is executed.
f433193f7bb6 Removed default water setting from the inventory_waters table. Added global setup record with default settings and the default water selection. Added a setup screen.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
157 //window.location.href = my_return;
f433193f7bb6 Removed default water setting from the inventory_waters table. Added global setup record with default settings and the default water selection. Added a setup screen.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
158 },
f433193f7bb6 Removed default water setting from the inventory_waters table. Added global setup record with default settings and the default water selection. Added a setup screen.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
159 error: function(jqXHR, textStatus, errorThrown) {
f433193f7bb6 Removed default water setting from the inventory_waters table. Added global setup record with default settings and the default water selection. Added a setup screen.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
160 }
f433193f7bb6 Removed default water setting from the inventory_waters table. Added global setup record with default settings and the default water selection. Added a setup screen.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
161 });
f433193f7bb6 Removed default water setting from the inventory_waters table. Added global setup record with default settings and the default water selection. Added a setup screen.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
162 });
f433193f7bb6 Removed default water setting from the inventory_waters table. Added global setup record with default settings and the default water selection. Added a setup screen.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
163 });

mercurial