www/js/profile_setup.js

Sat, 25 Sep 2021 10:42:54 +0200

author
Michiel Broek <mbroek@mbse.eu>
date
Sat, 25 Sep 2021 10:42:54 +0200
changeset 778
e64fd38c469c
parent 768
ae1195153fa2
permissions
-rw-r--r--

If during styles import the CATEGORY_NUMBER is empty, insert 0 in the database instead.

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 /*****************************************************************************
625
57bc32b5f411 Extended the max value for brix correction value to 1.09. Added setting of a private yeast lab for later use. Fixed missing some default setup values.
Michiel Broek <mbroek@mbse.eu>
parents: 523
diff changeset
2 * Copyright (C) 2019-2020
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
523
3cccf4392a25 Code cleanup and manual compress.
Michiel Broek <mbroek@mbse.eu>
parents: 494
diff changeset
24 $(document).ready(function() {
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
25
523
3cccf4392a25 Code cleanup and manual compress.
Michiel Broek <mbroek@mbse.eu>
parents: 494
diff changeset
26 var dataRecord = {},
3cccf4392a25 Code cleanup and manual compress.
Michiel Broek <mbroek@mbse.eu>
parents: 494
diff changeset
27 waterInvSource = {
3cccf4392a25 Code cleanup and manual compress.
Michiel Broek <mbroek@mbse.eu>
parents: 494
diff changeset
28 datatype: 'json',
3cccf4392a25 Code cleanup and manual compress.
Michiel Broek <mbroek@mbse.eu>
parents: 494
diff changeset
29 datafields: [{ name: 'name', type: 'string' }],
3cccf4392a25 Code cleanup and manual compress.
Michiel Broek <mbroek@mbse.eu>
parents: 494
diff changeset
30 url: 'getwatersources.php',
3cccf4392a25 Code cleanup and manual compress.
Michiel Broek <mbroek@mbse.eu>
parents: 494
diff changeset
31 async: false
3cccf4392a25 Code cleanup and manual compress.
Michiel Broek <mbroek@mbse.eu>
parents: 494
diff changeset
32 },
3cccf4392a25 Code cleanup and manual compress.
Michiel Broek <mbroek@mbse.eu>
parents: 494
diff changeset
33 waterlist = new $.jqx.dataAdapter(waterInvSource);
3cccf4392a25 Code cleanup and manual compress.
Michiel Broek <mbroek@mbse.eu>
parents: 494
diff changeset
34 url = 'includes/db_setup.php',
3cccf4392a25 Code cleanup and manual compress.
Michiel Broek <mbroek@mbse.eu>
parents: 494
diff changeset
35 source = {
3cccf4392a25 Code cleanup and manual compress.
Michiel Broek <mbroek@mbse.eu>
parents: 494
diff changeset
36 datatype: 'json',
3cccf4392a25 Code cleanup and manual compress.
Michiel Broek <mbroek@mbse.eu>
parents: 494
diff changeset
37 cache: false,
3cccf4392a25 Code cleanup and manual compress.
Michiel Broek <mbroek@mbse.eu>
parents: 494
diff changeset
38 datafields: [
3cccf4392a25 Code cleanup and manual compress.
Michiel Broek <mbroek@mbse.eu>
parents: 494
diff changeset
39 { name: 'brewery_name', type: 'string' },
3cccf4392a25 Code cleanup and manual compress.
Michiel Broek <mbroek@mbse.eu>
parents: 494
diff changeset
40 { name: 'factor_mashhop', type: 'number' },
3cccf4392a25 Code cleanup and manual compress.
Michiel Broek <mbroek@mbse.eu>
parents: 494
diff changeset
41 { name: 'factor_fwh', type: 'number' },
3cccf4392a25 Code cleanup and manual compress.
Michiel Broek <mbroek@mbse.eu>
parents: 494
diff changeset
42 { name: 'factor_pellet', type: 'number' },
3cccf4392a25 Code cleanup and manual compress.
Michiel Broek <mbroek@mbse.eu>
parents: 494
diff changeset
43 { name: 'factor_plug', type: 'number' },
3cccf4392a25 Code cleanup and manual compress.
Michiel Broek <mbroek@mbse.eu>
parents: 494
diff changeset
44 { name: 'factor_wethop', type: 'number' },
3cccf4392a25 Code cleanup and manual compress.
Michiel Broek <mbroek@mbse.eu>
parents: 494
diff changeset
45 { name: 'factor_cryohop', type: 'number' },
3cccf4392a25 Code cleanup and manual compress.
Michiel Broek <mbroek@mbse.eu>
parents: 494
diff changeset
46 { name: 'ibu_method', type: 'int' },
3cccf4392a25 Code cleanup and manual compress.
Michiel Broek <mbroek@mbse.eu>
parents: 494
diff changeset
47 { name: 'color_method', type: 'int' },
3cccf4392a25 Code cleanup and manual compress.
Michiel Broek <mbroek@mbse.eu>
parents: 494
diff changeset
48 { name: 'brix_correction', type: 'float' },
3cccf4392a25 Code cleanup and manual compress.
Michiel Broek <mbroek@mbse.eu>
parents: 494
diff changeset
49 { name: 'grain_absorbtion', type: 'float' },
625
57bc32b5f411 Extended the max value for brix correction value to 1.09. Added setting of a private yeast lab for later use. Fixed missing some default setup values.
Michiel Broek <mbroek@mbse.eu>
parents: 523
diff changeset
50 { name: 'default_water', type: 'string' },
57bc32b5f411 Extended the max value for brix correction value to 1.09. Added setting of a private yeast lab for later use. Fixed missing some default setup values.
Michiel Broek <mbroek@mbse.eu>
parents: 523
diff changeset
51 { name: 'my_yeastlab', type: 'string' }
523
3cccf4392a25 Code cleanup and manual compress.
Michiel Broek <mbroek@mbse.eu>
parents: 494
diff changeset
52 ],
3cccf4392a25 Code cleanup and manual compress.
Michiel Broek <mbroek@mbse.eu>
parents: 494
diff changeset
53 url: url
3cccf4392a25 Code cleanup and manual compress.
Michiel Broek <mbroek@mbse.eu>
parents: 494
diff changeset
54 },
3cccf4392a25 Code cleanup and manual compress.
Michiel Broek <mbroek@mbse.eu>
parents: 494
diff changeset
55 dataAdapter = new $.jqx.dataAdapter(source, {
3cccf4392a25 Code cleanup and manual compress.
Michiel Broek <mbroek@mbse.eu>
parents: 494
diff changeset
56 loadComplete: function() {
3cccf4392a25 Code cleanup and manual compress.
Michiel Broek <mbroek@mbse.eu>
parents: 494
diff changeset
57 var records = dataAdapter.records;
3cccf4392a25 Code cleanup and manual compress.
Michiel Broek <mbroek@mbse.eu>
parents: 494
diff changeset
58 dataRecord = records[0];
3cccf4392a25 Code cleanup and manual compress.
Michiel Broek <mbroek@mbse.eu>
parents: 494
diff changeset
59 $('#brewery_name').val(dataRecord.brewery_name);
3cccf4392a25 Code cleanup and manual compress.
Michiel Broek <mbroek@mbse.eu>
parents: 494
diff changeset
60 $('#factor_mashhop').val(dataRecord.factor_mashhop);
3cccf4392a25 Code cleanup and manual compress.
Michiel Broek <mbroek@mbse.eu>
parents: 494
diff changeset
61 $('#factor_fwh').val(dataRecord.factor_fwh);
3cccf4392a25 Code cleanup and manual compress.
Michiel Broek <mbroek@mbse.eu>
parents: 494
diff changeset
62 $('#factor_pellet').val(dataRecord.factor_pellet);
3cccf4392a25 Code cleanup and manual compress.
Michiel Broek <mbroek@mbse.eu>
parents: 494
diff changeset
63 $('#factor_plug').val(dataRecord.factor_plug);
3cccf4392a25 Code cleanup and manual compress.
Michiel Broek <mbroek@mbse.eu>
parents: 494
diff changeset
64 $('#factor_wethop').val(dataRecord.factor_wethop);
3cccf4392a25 Code cleanup and manual compress.
Michiel Broek <mbroek@mbse.eu>
parents: 494
diff changeset
65 $('#factor_cryohop').val(dataRecord.factor_cryohop);
3cccf4392a25 Code cleanup and manual compress.
Michiel Broek <mbroek@mbse.eu>
parents: 494
diff changeset
66 $('#color_method').val(dataRecord.color_method);
3cccf4392a25 Code cleanup and manual compress.
Michiel Broek <mbroek@mbse.eu>
parents: 494
diff changeset
67 $('#ibu_method').val(dataRecord.ibu_method);
3cccf4392a25 Code cleanup and manual compress.
Michiel Broek <mbroek@mbse.eu>
parents: 494
diff changeset
68 $('#brix_correction').val(dataRecord.brix_correction);
3cccf4392a25 Code cleanup and manual compress.
Michiel Broek <mbroek@mbse.eu>
parents: 494
diff changeset
69 $('#grain_absorbtion').val(dataRecord.grain_absorbtion);
625
57bc32b5f411 Extended the max value for brix correction value to 1.09. Added setting of a private yeast lab for later use. Fixed missing some default setup values.
Michiel Broek <mbroek@mbse.eu>
parents: 523
diff changeset
70 $('#default_water').jqxDropDownList('selectItem', dataRecord.default_water);
57bc32b5f411 Extended the max value for brix correction value to 1.09. Added setting of a private yeast lab for later use. Fixed missing some default setup values.
Michiel Broek <mbroek@mbse.eu>
parents: 523
diff changeset
71 $('#my_yeastlab').jqxDropDownList('selectItem', dataRecord.my_yeastlab);
523
3cccf4392a25 Code cleanup and manual compress.
Michiel Broek <mbroek@mbse.eu>
parents: 494
diff changeset
72 },
3cccf4392a25 Code cleanup and manual compress.
Michiel Broek <mbroek@mbse.eu>
parents: 494
diff changeset
73 loadError: function(jqXHR, status, error) {
3cccf4392a25 Code cleanup and manual compress.
Michiel Broek <mbroek@mbse.eu>
parents: 494
diff changeset
74 },
3cccf4392a25 Code cleanup and manual compress.
Michiel Broek <mbroek@mbse.eu>
parents: 494
diff changeset
75 });
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
76
523
3cccf4392a25 Code cleanup and manual compress.
Michiel Broek <mbroek@mbse.eu>
parents: 494
diff changeset
77 // Tooltips
3cccf4392a25 Code cleanup and manual compress.
Michiel Broek <mbroek@mbse.eu>
parents: 494
diff changeset
78 $('#brewery_name').jqxTooltip({ content: 'De naam voor deze brouwerij.' });
3cccf4392a25 Code cleanup and manual compress.
Michiel Broek <mbroek@mbse.eu>
parents: 494
diff changeset
79 $('#factor_mashhop').jqxTooltip({ content: 'Het efficientie percentage voor hop tijdens de maisch.' });
3cccf4392a25 Code cleanup and manual compress.
Michiel Broek <mbroek@mbse.eu>
parents: 494
diff changeset
80 $('#factor_fwh').jqxTooltip({ content: 'Het efficientie percentage voor First Wort Hop.' });
3cccf4392a25 Code cleanup and manual compress.
Michiel Broek <mbroek@mbse.eu>
parents: 494
diff changeset
81 $('#factor_pellet').jqxTooltip({ content: 'Het efficientie percentage bij gebruik van hop pellets.' });
3cccf4392a25 Code cleanup and manual compress.
Michiel Broek <mbroek@mbse.eu>
parents: 494
diff changeset
82 $('#factor_plug').jqxTooltip({ content: 'Het efficientie percentage bij gebruik van hop plugs.' });
3cccf4392a25 Code cleanup and manual compress.
Michiel Broek <mbroek@mbse.eu>
parents: 494
diff changeset
83 $('#factor_wethop').jqxTooltip({ content: 'Het efficientie percentage bij gebruik van nat geplukte hop.' });
3cccf4392a25 Code cleanup and manual compress.
Michiel Broek <mbroek@mbse.eu>
parents: 494
diff changeset
84 $('#factor_cryohop').jqxTooltip({ content: 'Het efficientie percentage bij gebruik van Cryo Hop&reg;.' });
3cccf4392a25 Code cleanup and manual compress.
Michiel Broek <mbroek@mbse.eu>
parents: 494
diff changeset
85 $('#brix_correction').jqxTooltip({ content: 'Omzettingsfactor voor Plato naar Brix' });
3cccf4392a25 Code cleanup and manual compress.
Michiel Broek <mbroek@mbse.eu>
parents: 494
diff changeset
86 $('#grain_absorbtion').jqxTooltip({ content: 'Absorbtie van water door graan (L/Kg)' });
494
af28ebe4a779 Fixed as much as possible warnings from the yui-compressor.
Michiel Broek <mbroek@mbse.eu>
parents: 446
diff changeset
87
523
3cccf4392a25 Code cleanup and manual compress.
Michiel Broek <mbroek@mbse.eu>
parents: 494
diff changeset
88 // Editers
3cccf4392a25 Code cleanup and manual compress.
Michiel Broek <mbroek@mbse.eu>
parents: 494
diff changeset
89 $('#brewery_name').jqxInput({ theme: theme, width: 640, height: 23 });
3cccf4392a25 Code cleanup and manual compress.
Michiel Broek <mbroek@mbse.eu>
parents: 494
diff changeset
90 $('#factor_fwh').jqxNumberInput({ inputMode: 'simple', theme: theme, width: 110, height: 23, min: -50, max: 50,
3cccf4392a25 Code cleanup and manual compress.
Michiel Broek <mbroek@mbse.eu>
parents: 494
diff changeset
91 decimalDigits: 0, spinButtons: true, symbol: '%', symbolPosition: 'right' });
3cccf4392a25 Code cleanup and manual compress.
Michiel Broek <mbroek@mbse.eu>
parents: 494
diff changeset
92 $('#factor_mashhop').jqxNumberInput({ inputMode: 'simple', theme: theme, width: 110, height: 23, min: -50, max: 50,
3cccf4392a25 Code cleanup and manual compress.
Michiel Broek <mbroek@mbse.eu>
parents: 494
diff changeset
93 decimalDigits: 0, spinButtons: true, symbol: '%', symbolPosition: 'right' });
3cccf4392a25 Code cleanup and manual compress.
Michiel Broek <mbroek@mbse.eu>
parents: 494
diff changeset
94 $('#factor_pellet').jqxNumberInput({ inputMode: 'simple', theme: theme, width: 110, height: 23, min: 0, max: 20,
3cccf4392a25 Code cleanup and manual compress.
Michiel Broek <mbroek@mbse.eu>
parents: 494
diff changeset
95 decimalDigits: 0, spinButtons: true, symbol: '%', symbolPosition: 'right' });
3cccf4392a25 Code cleanup and manual compress.
Michiel Broek <mbroek@mbse.eu>
parents: 494
diff changeset
96 $('#factor_plug').jqxNumberInput({ inputMode: 'simple', theme: theme, width: 110, height: 23, min: 0, max: 20,
3cccf4392a25 Code cleanup and manual compress.
Michiel Broek <mbroek@mbse.eu>
parents: 494
diff changeset
97 decimalDigits: 0, spinButtons: true, symbol: '%', symbolPosition: 'right' });
3cccf4392a25 Code cleanup and manual compress.
Michiel Broek <mbroek@mbse.eu>
parents: 494
diff changeset
98 $('#factor_wethop').jqxNumberInput({ inputMode: 'simple', theme: theme, width: 110, height: 23, min: -98, max: -20,
3cccf4392a25 Code cleanup and manual compress.
Michiel Broek <mbroek@mbse.eu>
parents: 494
diff changeset
99 decimalDigits: 0, spinButtons: true, symbol: '%', symbolPosition: 'right' });
3cccf4392a25 Code cleanup and manual compress.
Michiel Broek <mbroek@mbse.eu>
parents: 494
diff changeset
100 $('#factor_cryohop').jqxNumberInput({ inputMode: 'simple', theme: theme, width: 110, height: 23, min: -20, max: 150,
3cccf4392a25 Code cleanup and manual compress.
Michiel Broek <mbroek@mbse.eu>
parents: 494
diff changeset
101 decimalDigits: 0, spinButtons: true, symbol: '%', symbolPosition: 'right' });
625
57bc32b5f411 Extended the max value for brix correction value to 1.09. Added setting of a private yeast lab for later use. Fixed missing some default setup values.
Michiel Broek <mbroek@mbse.eu>
parents: 523
diff changeset
102 $('#brix_correction').jqxNumberInput({ inputMode: 'simple', theme: theme, width: 110, height: 23, min: 1.00, max: 1.09, decimalDigits: 2, spinButtons: true });
523
3cccf4392a25 Code cleanup and manual compress.
Michiel Broek <mbroek@mbse.eu>
parents: 494
diff changeset
103 $('#grain_absorbtion').jqxNumberInput({ inputMode: 'simple', theme: theme, width: 110, height: 23, min: 0.5, max: 1.1, decimalDigits: 2, spinButtons: true });
3cccf4392a25 Code cleanup and manual compress.
Michiel Broek <mbroek@mbse.eu>
parents: 494
diff changeset
104 $('#color_method').jqxDropDownList({
3cccf4392a25 Code cleanup and manual compress.
Michiel Broek <mbroek@mbse.eu>
parents: 494
diff changeset
105 theme: theme,
3cccf4392a25 Code cleanup and manual compress.
Michiel Broek <mbroek@mbse.eu>
parents: 494
diff changeset
106 source: ColorMethodAdapter,
3cccf4392a25 Code cleanup and manual compress.
Michiel Broek <mbroek@mbse.eu>
parents: 494
diff changeset
107 valueMember: 'id',
3cccf4392a25 Code cleanup and manual compress.
Michiel Broek <mbroek@mbse.eu>
parents: 494
diff changeset
108 displayMember: 'nl',
3cccf4392a25 Code cleanup and manual compress.
Michiel Broek <mbroek@mbse.eu>
parents: 494
diff changeset
109 width: 180,
3cccf4392a25 Code cleanup and manual compress.
Michiel Broek <mbroek@mbse.eu>
parents: 494
diff changeset
110 autoDropDownHeight: true
3cccf4392a25 Code cleanup and manual compress.
Michiel Broek <mbroek@mbse.eu>
parents: 494
diff changeset
111 });
3cccf4392a25 Code cleanup and manual compress.
Michiel Broek <mbroek@mbse.eu>
parents: 494
diff changeset
112 $('#ibu_method').jqxDropDownList({
3cccf4392a25 Code cleanup and manual compress.
Michiel Broek <mbroek@mbse.eu>
parents: 494
diff changeset
113 theme: theme,
3cccf4392a25 Code cleanup and manual compress.
Michiel Broek <mbroek@mbse.eu>
parents: 494
diff changeset
114 source: IBUmethodAdapter,
3cccf4392a25 Code cleanup and manual compress.
Michiel Broek <mbroek@mbse.eu>
parents: 494
diff changeset
115 valueMember: 'id',
3cccf4392a25 Code cleanup and manual compress.
Michiel Broek <mbroek@mbse.eu>
parents: 494
diff changeset
116 displayMember: 'nl',
3cccf4392a25 Code cleanup and manual compress.
Michiel Broek <mbroek@mbse.eu>
parents: 494
diff changeset
117 width: 180,
3cccf4392a25 Code cleanup and manual compress.
Michiel Broek <mbroek@mbse.eu>
parents: 494
diff changeset
118 autoDropDownHeight: true
3cccf4392a25 Code cleanup and manual compress.
Michiel Broek <mbroek@mbse.eu>
parents: 494
diff changeset
119 });
3cccf4392a25 Code cleanup and manual compress.
Michiel Broek <mbroek@mbse.eu>
parents: 494
diff changeset
120 $('#default_water').jqxDropDownList({
3cccf4392a25 Code cleanup and manual compress.
Michiel Broek <mbroek@mbse.eu>
parents: 494
diff changeset
121 placeHolder: 'Kies water:',
3cccf4392a25 Code cleanup and manual compress.
Michiel Broek <mbroek@mbse.eu>
parents: 494
diff changeset
122 theme: theme,
3cccf4392a25 Code cleanup and manual compress.
Michiel Broek <mbroek@mbse.eu>
parents: 494
diff changeset
123 source: waterlist,
3cccf4392a25 Code cleanup and manual compress.
Michiel Broek <mbroek@mbse.eu>
parents: 494
diff changeset
124 valueMember: 'name',
3cccf4392a25 Code cleanup and manual compress.
Michiel Broek <mbroek@mbse.eu>
parents: 494
diff changeset
125 displayMember: 'name',
3cccf4392a25 Code cleanup and manual compress.
Michiel Broek <mbroek@mbse.eu>
parents: 494
diff changeset
126 width: 250,
3cccf4392a25 Code cleanup and manual compress.
Michiel Broek <mbroek@mbse.eu>
parents: 494
diff changeset
127 dropDownHorizontalAlignment: 'right',
3cccf4392a25 Code cleanup and manual compress.
Michiel Broek <mbroek@mbse.eu>
parents: 494
diff changeset
128 dropDownWidth: 300,
3cccf4392a25 Code cleanup and manual compress.
Michiel Broek <mbroek@mbse.eu>
parents: 494
diff changeset
129 autoDropDownHeight: true
3cccf4392a25 Code cleanup and manual compress.
Michiel Broek <mbroek@mbse.eu>
parents: 494
diff changeset
130 });
625
57bc32b5f411 Extended the max value for brix correction value to 1.09. Added setting of a private yeast lab for later use. Fixed missing some default setup values.
Michiel Broek <mbroek@mbse.eu>
parents: 523
diff changeset
131 $('#my_yeastlab').jqxDropDownList({
57bc32b5f411 Extended the max value for brix correction value to 1.09. Added setting of a private yeast lab for later use. Fixed missing some default setup values.
Michiel Broek <mbroek@mbse.eu>
parents: 523
diff changeset
132 placeHolder: 'Mijn gist laboratorium:',
57bc32b5f411 Extended the max value for brix correction value to 1.09. Added setting of a private yeast lab for later use. Fixed missing some default setup values.
Michiel Broek <mbroek@mbse.eu>
parents: 523
diff changeset
133 theme: theme,
57bc32b5f411 Extended the max value for brix correction value to 1.09. Added setting of a private yeast lab for later use. Fixed missing some default setup values.
Michiel Broek <mbroek@mbse.eu>
parents: 523
diff changeset
134 source: yeastlablist,
57bc32b5f411 Extended the max value for brix correction value to 1.09. Added setting of a private yeast lab for later use. Fixed missing some default setup values.
Michiel Broek <mbroek@mbse.eu>
parents: 523
diff changeset
135 valueMember: 'laboratory',
57bc32b5f411 Extended the max value for brix correction value to 1.09. Added setting of a private yeast lab for later use. Fixed missing some default setup values.
Michiel Broek <mbroek@mbse.eu>
parents: 523
diff changeset
136 displayMember: 'laboratory',
57bc32b5f411 Extended the max value for brix correction value to 1.09. Added setting of a private yeast lab for later use. Fixed missing some default setup values.
Michiel Broek <mbroek@mbse.eu>
parents: 523
diff changeset
137 width: 250,
57bc32b5f411 Extended the max value for brix correction value to 1.09. Added setting of a private yeast lab for later use. Fixed missing some default setup values.
Michiel Broek <mbroek@mbse.eu>
parents: 523
diff changeset
138 dropDownHorizontalAlignment: 'right',
57bc32b5f411 Extended the max value for brix correction value to 1.09. Added setting of a private yeast lab for later use. Fixed missing some default setup values.
Michiel Broek <mbroek@mbse.eu>
parents: 523
diff changeset
139 dropDownWidth: 300,
57bc32b5f411 Extended the max value for brix correction value to 1.09. Added setting of a private yeast lab for later use. Fixed missing some default setup values.
Michiel Broek <mbroek@mbse.eu>
parents: 523
diff changeset
140 autoDropDownHeight: true
57bc32b5f411 Extended the max value for brix correction value to 1.09. Added setting of a private yeast lab for later use. Fixed missing some default setup values.
Michiel Broek <mbroek@mbse.eu>
parents: 523
diff changeset
141 });
57bc32b5f411 Extended the max value for brix correction value to 1.09. Added setting of a private yeast lab for later use. Fixed missing some default setup values.
Michiel Broek <mbroek@mbse.eu>
parents: 523
diff changeset
142 dataAdapter.dataBind();
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
143
523
3cccf4392a25 Code cleanup and manual compress.
Michiel Broek <mbroek@mbse.eu>
parents: 494
diff changeset
144 $('#Save').jqxButton({ template: 'success', width: '90px', theme: theme });
3cccf4392a25 Code cleanup and manual compress.
Michiel Broek <mbroek@mbse.eu>
parents: 494
diff changeset
145 $('#Save').click(function() {
3cccf4392a25 Code cleanup and manual compress.
Michiel Broek <mbroek@mbse.eu>
parents: 494
diff changeset
146 var data,
3cccf4392a25 Code cleanup and manual compress.
Michiel Broek <mbroek@mbse.eu>
parents: 494
diff changeset
147 row = {
3cccf4392a25 Code cleanup and manual compress.
Michiel Broek <mbroek@mbse.eu>
parents: 494
diff changeset
148 record: 1,
3cccf4392a25 Code cleanup and manual compress.
Michiel Broek <mbroek@mbse.eu>
parents: 494
diff changeset
149 brewery_name: $('#brewery_name').val(),
3cccf4392a25 Code cleanup and manual compress.
Michiel Broek <mbroek@mbse.eu>
parents: 494
diff changeset
150 factor_mashhop: $('#factor_mashhop').val(),
3cccf4392a25 Code cleanup and manual compress.
Michiel Broek <mbroek@mbse.eu>
parents: 494
diff changeset
151 factor_fwh: $('#factor_fwh').val(),
3cccf4392a25 Code cleanup and manual compress.
Michiel Broek <mbroek@mbse.eu>
parents: 494
diff changeset
152 factor_pellet: $('#factor_pellet').val(),
3cccf4392a25 Code cleanup and manual compress.
Michiel Broek <mbroek@mbse.eu>
parents: 494
diff changeset
153 factor_plug: $('#factor_plug').val(),
3cccf4392a25 Code cleanup and manual compress.
Michiel Broek <mbroek@mbse.eu>
parents: 494
diff changeset
154 factor_wethop: $('#factor_wethop').val(),
3cccf4392a25 Code cleanup and manual compress.
Michiel Broek <mbroek@mbse.eu>
parents: 494
diff changeset
155 factor_cryohop: $('#factor_cryohop').val(),
3cccf4392a25 Code cleanup and manual compress.
Michiel Broek <mbroek@mbse.eu>
parents: 494
diff changeset
156 color_method: $('#color_method').val(),
3cccf4392a25 Code cleanup and manual compress.
Michiel Broek <mbroek@mbse.eu>
parents: 494
diff changeset
157 ibu_method: $('#ibu_method').val(),
3cccf4392a25 Code cleanup and manual compress.
Michiel Broek <mbroek@mbse.eu>
parents: 494
diff changeset
158 brix_correction: parseFloat($('#brix_correction').jqxNumberInput('decimal')),
3cccf4392a25 Code cleanup and manual compress.
Michiel Broek <mbroek@mbse.eu>
parents: 494
diff changeset
159 grain_absorbtion: parseFloat($('#grain_absorbtion').jqxNumberInput('decimal')),
625
57bc32b5f411 Extended the max value for brix correction value to 1.09. Added setting of a private yeast lab for later use. Fixed missing some default setup values.
Michiel Broek <mbroek@mbse.eu>
parents: 523
diff changeset
160 default_water: $('#default_water').val(),
57bc32b5f411 Extended the max value for brix correction value to 1.09. Added setting of a private yeast lab for later use. Fixed missing some default setup values.
Michiel Broek <mbroek@mbse.eu>
parents: 523
diff changeset
161 my_yeastlab: $('#my_yeastlab').val()
523
3cccf4392a25 Code cleanup and manual compress.
Michiel Broek <mbroek@mbse.eu>
parents: 494
diff changeset
162 };
3cccf4392a25 Code cleanup and manual compress.
Michiel Broek <mbroek@mbse.eu>
parents: 494
diff changeset
163 data = 'update=true&' + $.param(row);
3cccf4392a25 Code cleanup and manual compress.
Michiel Broek <mbroek@mbse.eu>
parents: 494
diff changeset
164 $.ajax({
3cccf4392a25 Code cleanup and manual compress.
Michiel Broek <mbroek@mbse.eu>
parents: 494
diff changeset
165 dataType: 'json',
3cccf4392a25 Code cleanup and manual compress.
Michiel Broek <mbroek@mbse.eu>
parents: 494
diff changeset
166 url: url,
3cccf4392a25 Code cleanup and manual compress.
Michiel Broek <mbroek@mbse.eu>
parents: 494
diff changeset
167 cache: false,
3cccf4392a25 Code cleanup and manual compress.
Michiel Broek <mbroek@mbse.eu>
parents: 494
diff changeset
168 data: data,
3cccf4392a25 Code cleanup and manual compress.
Michiel Broek <mbroek@mbse.eu>
parents: 494
diff changeset
169 type: 'POST',
768
ae1195153fa2 Better error reporting in profiles fermentation steps, mash profiles, beer styles, water profiles and general setup.
Michiel Broek <mbroek@mbse.eu>
parents: 625
diff changeset
170 success: function(data) {
ae1195153fa2 Better error reporting in profiles fermentation steps, mash profiles, beer styles, water profiles and general setup.
Michiel Broek <mbroek@mbse.eu>
parents: 625
diff changeset
171 if (data.error) {
ae1195153fa2 Better error reporting in profiles fermentation steps, mash profiles, beer styles, water profiles and general setup.
Michiel Broek <mbroek@mbse.eu>
parents: 625
diff changeset
172 console.log('update: ' + data.msg);
ae1195153fa2 Better error reporting in profiles fermentation steps, mash profiles, beer styles, water profiles and general setup.
Michiel Broek <mbroek@mbse.eu>
parents: 625
diff changeset
173 alert('Fout: ' + data.msg);
ae1195153fa2 Better error reporting in profiles fermentation steps, mash profiles, beer styles, water profiles and general setup.
Michiel Broek <mbroek@mbse.eu>
parents: 625
diff changeset
174 } else {
ae1195153fa2 Better error reporting in profiles fermentation steps, mash profiles, beer styles, water profiles and general setup.
Michiel Broek <mbroek@mbse.eu>
parents: 625
diff changeset
175 console.log('update: success');
ae1195153fa2 Better error reporting in profiles fermentation steps, mash profiles, beer styles, water profiles and general setup.
Michiel Broek <mbroek@mbse.eu>
parents: 625
diff changeset
176 }
523
3cccf4392a25 Code cleanup and manual compress.
Michiel Broek <mbroek@mbse.eu>
parents: 494
diff changeset
177 },
3cccf4392a25 Code cleanup and manual compress.
Michiel Broek <mbroek@mbse.eu>
parents: 494
diff changeset
178 error: function(jqXHR, textStatus, errorThrown) {
3cccf4392a25 Code cleanup and manual compress.
Michiel Broek <mbroek@mbse.eu>
parents: 494
diff changeset
179 }
3cccf4392a25 Code cleanup and manual compress.
Michiel Broek <mbroek@mbse.eu>
parents: 494
diff changeset
180 });
3cccf4392a25 Code cleanup and manual compress.
Michiel Broek <mbroek@mbse.eu>
parents: 494
diff changeset
181 });
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
182 });

mercurial