www/js/inv_yeasts.js

Sun, 03 Mar 2019 13:26:28 +0100

author
Michiel Broek <mbroek@mbse.eu>
date
Sun, 03 Mar 2019 13:26:28 +0100
changeset 311
f6fafccd8a6d
parent 286
124af734af68
child 313
9f45d09c2071
permissions
-rw-r--r--

Added xml import for fermentables, hops, miscs, yeasts and styles. Fixed update IBU calculation in the editor hop popups.

14
d9dfd703df83 Added yeast inventory screens
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1 /*****************************************************************************
198
f0ec83e1e01f Switches yeasts inventory to indexed names and translations. Database save is using POST instead of GET. Redesigned the web page. Added total cost display which updates on inventory changes.
Michiel Broek <mbroek@mbse.eu>
parents: 37
diff changeset
2 * Copyright (C) 2014-2019
14
d9dfd703df83 Added yeast inventory screens
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
3 *
d9dfd703df83 Added yeast inventory screens
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
4 * Michiel Broek <mbroek at mbse dot eu>
d9dfd703df83 Added yeast inventory screens
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
5 *
d9dfd703df83 Added yeast inventory screens
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
6 * This file is part of BrewCloud
d9dfd703df83 Added yeast inventory screens
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
7 *
d9dfd703df83 Added yeast inventory screens
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
8 * This is free software; you can redistribute it and/or modify it
d9dfd703df83 Added yeast inventory screens
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
9 * under the terms of the GNU General Public License as published by the
d9dfd703df83 Added yeast inventory screens
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
10 * Free Software Foundation; either version 2, or (at your option) any
d9dfd703df83 Added yeast inventory screens
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
11 * later version.
d9dfd703df83 Added yeast inventory screens
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
12 *
d9dfd703df83 Added yeast inventory screens
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
13 * BrewCloud is distributed in the hope that it will be useful, but
d9dfd703df83 Added yeast inventory screens
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
14 * WITHOUT ANY WARRANTY; without even the implied warranty of
d9dfd703df83 Added yeast inventory screens
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
d9dfd703df83 Added yeast inventory screens
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
16 * General Public License for more details.
d9dfd703df83 Added yeast inventory screens
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
17 *
d9dfd703df83 Added yeast inventory screens
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
18 * You should have received a copy of the GNU General Public License
d9dfd703df83 Added yeast inventory screens
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
19 * along with ThermFerm; see the file COPYING. If not, write to the Free
d9dfd703df83 Added yeast inventory screens
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
20 * Software Foundation, 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
d9dfd703df83 Added yeast inventory screens
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
21 *****************************************************************************/
d9dfd703df83 Added yeast inventory screens
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
22
d9dfd703df83 Added yeast inventory screens
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
23
d9dfd703df83 Added yeast inventory screens
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
24 function createDelElements() {
d9dfd703df83 Added yeast inventory screens
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
25 $('#eventWindow').jqxWindow({
d9dfd703df83 Added yeast inventory screens
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
26 theme: theme,
d9dfd703df83 Added yeast inventory screens
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
27 position: { x: 490, y: 210 },
d9dfd703df83 Added yeast inventory screens
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
28 width: 300,
34
a720353fada9 Formatting and measurements
Michiel Broek <mbroek@mbse.eu>
parents: 33
diff changeset
29 height: 175,
14
d9dfd703df83 Added yeast inventory screens
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
30 resizable: false,
d9dfd703df83 Added yeast inventory screens
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
31 isModal: true,
d9dfd703df83 Added yeast inventory screens
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
32 modalOpacity: 0.4,
d9dfd703df83 Added yeast inventory screens
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
33 okButton: $('#delOk'),
d9dfd703df83 Added yeast inventory screens
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
34 cancelButton: $('#delCancel'),
d9dfd703df83 Added yeast inventory screens
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
35 initContent: function () {
198
f0ec83e1e01f Switches yeasts inventory to indexed names and translations. Database save is using POST instead of GET. Redesigned the web page. Added total cost display which updates on inventory changes.
Michiel Broek <mbroek@mbse.eu>
parents: 37
diff changeset
36 $('#delOk').jqxButton({ template: "danger", width: '65px', theme: theme });
f0ec83e1e01f Switches yeasts inventory to indexed names and translations. Database save is using POST instead of GET. Redesigned the web page. Added total cost display which updates on inventory changes.
Michiel Broek <mbroek@mbse.eu>
parents: 37
diff changeset
37 $('#delCancel').jqxButton({ template: "success", width: '65px', theme: theme });
14
d9dfd703df83 Added yeast inventory screens
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
38 $('#delCancel').focus();
d9dfd703df83 Added yeast inventory screens
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
39 }
d9dfd703df83 Added yeast inventory screens
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
40 });
d9dfd703df83 Added yeast inventory screens
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
41 $('#eventWindow').jqxWindow('hide');
d9dfd703df83 Added yeast inventory screens
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
42 }
d9dfd703df83 Added yeast inventory screens
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
43
d9dfd703df83 Added yeast inventory screens
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
44
d9dfd703df83 Added yeast inventory screens
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
45 $(document).ready(function () {
198
f0ec83e1e01f Switches yeasts inventory to indexed names and translations. Database save is using POST instead of GET. Redesigned the web page. Added total cost display which updates on inventory changes.
Michiel Broek <mbroek@mbse.eu>
parents: 37
diff changeset
46
f0ec83e1e01f Switches yeasts inventory to indexed names and translations. Database save is using POST instead of GET. Redesigned the web page. Added total cost display which updates on inventory changes.
Michiel Broek <mbroek@mbse.eu>
parents: 37
diff changeset
47 var dataRecord = {};
f0ec83e1e01f Switches yeasts inventory to indexed names and translations. Database save is using POST instead of GET. Redesigned the web page. Added total cost display which updates on inventory changes.
Michiel Broek <mbroek@mbse.eu>
parents: 37
diff changeset
48
201
f9b7e3f6be7c 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.
Michiel Broek <mbroek@mbse.eu>
parents: 200
diff changeset
49 function calcTotal() {
198
f0ec83e1e01f Switches yeasts inventory to indexed names and translations. Database save is using POST instead of GET. Redesigned the web page. Added total cost display which updates on inventory changes.
Michiel Broek <mbroek@mbse.eu>
parents: 37
diff changeset
50
201
f9b7e3f6be7c 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.
Michiel Broek <mbroek@mbse.eu>
parents: 200
diff changeset
51 $('#totval').val(dataRecord.cost * dataRecord.inventory);
f9b7e3f6be7c 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.
Michiel Broek <mbroek@mbse.eu>
parents: 200
diff changeset
52 if (dataRecord.form == 0) { // Liquid
f9b7e3f6be7c 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.
Michiel Broek <mbroek@mbse.eu>
parents: 200
diff changeset
53 $("#pmpt_cost").html('Prijs per pak:');
f9b7e3f6be7c 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.
Michiel Broek <mbroek@mbse.eu>
parents: 200
diff changeset
54 $("#pmpt_inventory").html('Voorraad pak(ken):');
278
dc22dd5d77fd Initial design of a yeast starter calculator based on the Braukaiser model. Changed the yeast inventory prompts to the correct Dutch amounts. The pitchrate calculator makes a difference between light and heavy beers, turning point is a SG 1.060. Some code is from Homebrew Dad's calculator.
Michiel Broek <mbroek@mbse.eu>
parents: 269
diff changeset
55 $("#pmpt_cells").html('Miljard cellen per pak:');
dc22dd5d77fd Initial design of a yeast starter calculator based on the Braukaiser model. Changed the yeast inventory prompts to the correct Dutch amounts. The pitchrate calculator makes a difference between light and heavy beers, turning point is a SG 1.060. Some code is from Homebrew Dad's calculator.
Michiel Broek <mbroek@mbse.eu>
parents: 269
diff changeset
56 $("#inventory").jqxNumberInput({ decimalDigits: 0 });
201
f9b7e3f6be7c 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.
Michiel Broek <mbroek@mbse.eu>
parents: 200
diff changeset
57 } else if (dataRecord.form == 1) { // Dry
f9b7e3f6be7c 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.
Michiel Broek <mbroek@mbse.eu>
parents: 200
diff changeset
58 $("#pmpt_cost").html('Prijs per kg:');
f9b7e3f6be7c 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.
Michiel Broek <mbroek@mbse.eu>
parents: 200
diff changeset
59 $("#pmpt_inventory").html('Voorraad gram:');
278
dc22dd5d77fd Initial design of a yeast starter calculator based on the Braukaiser model. Changed the yeast inventory prompts to the correct Dutch amounts. The pitchrate calculator makes a difference between light and heavy beers, turning point is a SG 1.060. Some code is from Homebrew Dad's calculator.
Michiel Broek <mbroek@mbse.eu>
parents: 269
diff changeset
60 $("#pmpt_cells").html('Miljard cellen per gram:');
dc22dd5d77fd Initial design of a yeast starter calculator based on the Braukaiser model. Changed the yeast inventory prompts to the correct Dutch amounts. The pitchrate calculator makes a difference between light and heavy beers, turning point is a SG 1.060. Some code is from Homebrew Dad's calculator.
Michiel Broek <mbroek@mbse.eu>
parents: 269
diff changeset
61 $("#inventory").jqxNumberInput({ decimalDigits: 1 });
201
f9b7e3f6be7c 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.
Michiel Broek <mbroek@mbse.eu>
parents: 200
diff changeset
62 } else {
f9b7e3f6be7c 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.
Michiel Broek <mbroek@mbse.eu>
parents: 200
diff changeset
63 $("#pmpt_cost").html('Prijs per liter:');
f9b7e3f6be7c 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.
Michiel Broek <mbroek@mbse.eu>
parents: 200
diff changeset
64 $("#pmpt_inventory").html('Voorraad ml:');
278
dc22dd5d77fd Initial design of a yeast starter calculator based on the Braukaiser model. Changed the yeast inventory prompts to the correct Dutch amounts. The pitchrate calculator makes a difference between light and heavy beers, turning point is a SG 1.060. Some code is from Homebrew Dad's calculator.
Michiel Broek <mbroek@mbse.eu>
parents: 269
diff changeset
65 $("#pmpt_cells").html('Miljard cellen per ml:');
dc22dd5d77fd Initial design of a yeast starter calculator based on the Braukaiser model. Changed the yeast inventory prompts to the correct Dutch amounts. The pitchrate calculator makes a difference between light and heavy beers, turning point is a SG 1.060. Some code is from Homebrew Dad's calculator.
Michiel Broek <mbroek@mbse.eu>
parents: 269
diff changeset
66 $("#inventory").jqxNumberInput({ decimalDigits: 1 });
201
f9b7e3f6be7c 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.
Michiel Broek <mbroek@mbse.eu>
parents: 200
diff changeset
67 }
198
f0ec83e1e01f Switches yeasts inventory to indexed names and translations. Database save is using POST instead of GET. Redesigned the web page. Added total cost display which updates on inventory changes.
Michiel Broek <mbroek@mbse.eu>
parents: 37
diff changeset
68 }
f0ec83e1e01f Switches yeasts inventory to indexed names and translations. Database save is using POST instead of GET. Redesigned the web page. Added total cost display which updates on inventory changes.
Michiel Broek <mbroek@mbse.eu>
parents: 37
diff changeset
69
14
d9dfd703df83 Added yeast inventory screens
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
70 var url = "includes/db_inventory_yeasts.php";
d9dfd703df83 Added yeast inventory screens
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
71 // prepare the data
d9dfd703df83 Added yeast inventory screens
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
72 var source = {
d9dfd703df83 Added yeast inventory screens
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
73 datatype: "json",
d9dfd703df83 Added yeast inventory screens
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
74 cache: false,
d9dfd703df83 Added yeast inventory screens
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
75 datafields: [
d9dfd703df83 Added yeast inventory screens
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
76 { name: 'record', type: 'number' },
d9dfd703df83 Added yeast inventory screens
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
77 { name: 'name', type: 'string' },
198
f0ec83e1e01f Switches yeasts inventory to indexed names and translations. Database save is using POST instead of GET. Redesigned the web page. Added total cost display which updates on inventory changes.
Michiel Broek <mbroek@mbse.eu>
parents: 37
diff changeset
78 { name: 'type', type: 'int' },
f0ec83e1e01f Switches yeasts inventory to indexed names and translations. Database save is using POST instead of GET. Redesigned the web page. Added total cost display which updates on inventory changes.
Michiel Broek <mbroek@mbse.eu>
parents: 37
diff changeset
79 { name: 'form', type: 'int' },
14
d9dfd703df83 Added yeast inventory screens
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
80 { name: 'laboratory', type: 'string' },
d9dfd703df83 Added yeast inventory screens
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
81 { name: 'product_id', type: 'string' },
198
f0ec83e1e01f Switches yeasts inventory to indexed names and translations. Database save is using POST instead of GET. Redesigned the web page. Added total cost display which updates on inventory changes.
Michiel Broek <mbroek@mbse.eu>
parents: 37
diff changeset
82 { name: 'min_temperature', type: 'float' },
f0ec83e1e01f Switches yeasts inventory to indexed names and translations. Database save is using POST instead of GET. Redesigned the web page. Added total cost display which updates on inventory changes.
Michiel Broek <mbroek@mbse.eu>
parents: 37
diff changeset
83 { name: 'max_temperature', type: 'float' },
f0ec83e1e01f Switches yeasts inventory to indexed names and translations. Database save is using POST instead of GET. Redesigned the web page. Added total cost display which updates on inventory changes.
Michiel Broek <mbroek@mbse.eu>
parents: 37
diff changeset
84 { name: 'flocculation', type: 'int' },
14
d9dfd703df83 Added yeast inventory screens
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
85 { name: 'attenuation', type: 'float' },
d9dfd703df83 Added yeast inventory screens
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
86 { name: 'notes', type: 'string' },
d9dfd703df83 Added yeast inventory screens
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
87 { name: 'best_for', type: 'string' },
198
f0ec83e1e01f Switches yeasts inventory to indexed names and translations. Database save is using POST instead of GET. Redesigned the web page. Added total cost display which updates on inventory changes.
Michiel Broek <mbroek@mbse.eu>
parents: 37
diff changeset
88 { name: 'max_reuse', type: 'int' },
14
d9dfd703df83 Added yeast inventory screens
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
89 { name: 'inventory', type: 'float' },
d9dfd703df83 Added yeast inventory screens
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
90 { name: 'cost', type: 'float' },
d9dfd703df83 Added yeast inventory screens
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
91 { name: 'production_date', type: 'string' },
200
7b2f11652d67 Miscs from bool to ints. Miscs database uses POST instead of GET. Dropdowns are unsing indexes. Dynamic edit screen adjust for weight and liter. Edit screen redesigned. Friendly show duration of ingredients.
Michiel Broek <mbroek@mbse.eu>
parents: 198
diff changeset
92 { name: 'tht_date', type: 'string' },
7b2f11652d67 Miscs from bool to ints. Miscs database uses POST instead of GET. Dropdowns are unsing indexes. Dynamic edit screen adjust for weight and liter. Edit screen redesigned. Friendly show duration of ingredients.
Michiel Broek <mbroek@mbse.eu>
parents: 198
diff changeset
93 { name: 'cells', type: 'float' }
14
d9dfd703df83 Added yeast inventory screens
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
94 ],
d9dfd703df83 Added yeast inventory screens
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
95 id: 'record',
d9dfd703df83 Added yeast inventory screens
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
96 url: url,
d9dfd703df83 Added yeast inventory screens
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
97 deleterow: function (rowid, commit) {
d9dfd703df83 Added yeast inventory screens
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
98 // synchronize with the server - send delete command
d9dfd703df83 Added yeast inventory screens
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
99 var data = "delete=true&" + $.param({ record: rowid });
d9dfd703df83 Added yeast inventory screens
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
100 $.ajax({
d9dfd703df83 Added yeast inventory screens
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
101 dataType: 'json',
d9dfd703df83 Added yeast inventory screens
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
102 url: url,
d9dfd703df83 Added yeast inventory screens
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
103 cache: false,
d9dfd703df83 Added yeast inventory screens
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
104 data: data,
198
f0ec83e1e01f Switches yeasts inventory to indexed names and translations. Database save is using POST instead of GET. Redesigned the web page. Added total cost display which updates on inventory changes.
Michiel Broek <mbroek@mbse.eu>
parents: 37
diff changeset
105 type: "POST",
14
d9dfd703df83 Added yeast inventory screens
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
106 success: function (data, status, xhr) {
d9dfd703df83 Added yeast inventory screens
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
107 // delete command is executed.
d9dfd703df83 Added yeast inventory screens
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
108 commit(true);
d9dfd703df83 Added yeast inventory screens
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
109 },
d9dfd703df83 Added yeast inventory screens
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
110 error: function (jqXHR, textStatus, errorThrown) {
d9dfd703df83 Added yeast inventory screens
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
111 commit(false);
d9dfd703df83 Added yeast inventory screens
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
112 }
d9dfd703df83 Added yeast inventory screens
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
113 });
d9dfd703df83 Added yeast inventory screens
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
114 },
d9dfd703df83 Added yeast inventory screens
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
115 addrow: function (rowid, rowdata, position, commit) {
d9dfd703df83 Added yeast inventory screens
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
116 var data = "insert=true&" + $.param(rowdata);
d9dfd703df83 Added yeast inventory screens
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
117 $.ajax({
d9dfd703df83 Added yeast inventory screens
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
118 dataType: 'json',
d9dfd703df83 Added yeast inventory screens
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
119 url: url,
d9dfd703df83 Added yeast inventory screens
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
120 cache: false,
d9dfd703df83 Added yeast inventory screens
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
121 data: data,
198
f0ec83e1e01f Switches yeasts inventory to indexed names and translations. Database save is using POST instead of GET. Redesigned the web page. Added total cost display which updates on inventory changes.
Michiel Broek <mbroek@mbse.eu>
parents: 37
diff changeset
122 type: "POST",
14
d9dfd703df83 Added yeast inventory screens
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
123 success: function (data, status, xhr) {
d9dfd703df83 Added yeast inventory screens
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
124 commit(true);
d9dfd703df83 Added yeast inventory screens
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
125 },
d9dfd703df83 Added yeast inventory screens
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
126 error: function(jqXHR, textStatus, errorThrown) {
d9dfd703df83 Added yeast inventory screens
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
127 commit(false);
d9dfd703df83 Added yeast inventory screens
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
128 }
d9dfd703df83 Added yeast inventory screens
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
129 });
d9dfd703df83 Added yeast inventory screens
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
130 },
d9dfd703df83 Added yeast inventory screens
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
131 updaterow: function (rowid, rowdata, commit) {
d9dfd703df83 Added yeast inventory screens
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
132 var data = "update=true&" + $.param(rowdata);
d9dfd703df83 Added yeast inventory screens
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
133 $.ajax({
d9dfd703df83 Added yeast inventory screens
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
134 dataType: 'json',
d9dfd703df83 Added yeast inventory screens
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
135 url: url,
d9dfd703df83 Added yeast inventory screens
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
136 cache: false,
d9dfd703df83 Added yeast inventory screens
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
137 data: data,
198
f0ec83e1e01f Switches yeasts inventory to indexed names and translations. Database save is using POST instead of GET. Redesigned the web page. Added total cost display which updates on inventory changes.
Michiel Broek <mbroek@mbse.eu>
parents: 37
diff changeset
138 type: "POST",
14
d9dfd703df83 Added yeast inventory screens
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
139 success: function (data, status, xhr) {
d9dfd703df83 Added yeast inventory screens
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
140 // update command is executed.
d9dfd703df83 Added yeast inventory screens
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
141 commit(true);
d9dfd703df83 Added yeast inventory screens
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
142 },
d9dfd703df83 Added yeast inventory screens
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
143 error: function(jqXHR, textStatus, errorThrown) {
d9dfd703df83 Added yeast inventory screens
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
144 commit(false);
d9dfd703df83 Added yeast inventory screens
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
145 }
d9dfd703df83 Added yeast inventory screens
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
146 });
d9dfd703df83 Added yeast inventory screens
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
147 }
d9dfd703df83 Added yeast inventory screens
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
148 };
d9dfd703df83 Added yeast inventory screens
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
149 // initialize the input fields.
198
f0ec83e1e01f Switches yeasts inventory to indexed names and translations. Database save is using POST instead of GET. Redesigned the web page. Added total cost display which updates on inventory changes.
Michiel Broek <mbroek@mbse.eu>
parents: 37
diff changeset
150 $("#name").jqxInput({ theme: theme, width: 640, height: 23 });
f0ec83e1e01f Switches yeasts inventory to indexed names and translations. Database save is using POST instead of GET. Redesigned the web page. Added total cost display which updates on inventory changes.
Michiel Broek <mbroek@mbse.eu>
parents: 37
diff changeset
151 $("#laboratory").jqxInput({ theme: theme, width: 320, height: 23 });
f0ec83e1e01f Switches yeasts inventory to indexed names and translations. Database save is using POST instead of GET. Redesigned the web page. Added total cost display which updates on inventory changes.
Michiel Broek <mbroek@mbse.eu>
parents: 37
diff changeset
152 $("#product_id").jqxInput({ theme: theme, width: 320, height: 23 });
f0ec83e1e01f Switches yeasts inventory to indexed names and translations. Database save is using POST instead of GET. Redesigned the web page. Added total cost display which updates on inventory changes.
Michiel Broek <mbroek@mbse.eu>
parents: 37
diff changeset
153 $("#type").jqxDropDownList({
f0ec83e1e01f Switches yeasts inventory to indexed names and translations. Database save is using POST instead of GET. Redesigned the web page. Added total cost display which updates on inventory changes.
Michiel Broek <mbroek@mbse.eu>
parents: 37
diff changeset
154 theme: theme,
f0ec83e1e01f Switches yeasts inventory to indexed names and translations. Database save is using POST instead of GET. Redesigned the web page. Added total cost display which updates on inventory changes.
Michiel Broek <mbroek@mbse.eu>
parents: 37
diff changeset
155 source: YeastTypeAdapter,
f0ec83e1e01f Switches yeasts inventory to indexed names and translations. Database save is using POST instead of GET. Redesigned the web page. Added total cost display which updates on inventory changes.
Michiel Broek <mbroek@mbse.eu>
parents: 37
diff changeset
156 valueMember: 'id',
f0ec83e1e01f Switches yeasts inventory to indexed names and translations. Database save is using POST instead of GET. Redesigned the web page. Added total cost display which updates on inventory changes.
Michiel Broek <mbroek@mbse.eu>
parents: 37
diff changeset
157 displayMember: 'nl',
f0ec83e1e01f Switches yeasts inventory to indexed names and translations. Database save is using POST instead of GET. Redesigned the web page. Added total cost display which updates on inventory changes.
Michiel Broek <mbroek@mbse.eu>
parents: 37
diff changeset
158 width: 180,
f0ec83e1e01f Switches yeasts inventory to indexed names and translations. Database save is using POST instead of GET. Redesigned the web page. Added total cost display which updates on inventory changes.
Michiel Broek <mbroek@mbse.eu>
parents: 37
diff changeset
159 height: 23,
f0ec83e1e01f Switches yeasts inventory to indexed names and translations. Database save is using POST instead of GET. Redesigned the web page. Added total cost display which updates on inventory changes.
Michiel Broek <mbroek@mbse.eu>
parents: 37
diff changeset
160 autoDropDownHeight: true
f0ec83e1e01f Switches yeasts inventory to indexed names and translations. Database save is using POST instead of GET. Redesigned the web page. Added total cost display which updates on inventory changes.
Michiel Broek <mbroek@mbse.eu>
parents: 37
diff changeset
161 });
f0ec83e1e01f Switches yeasts inventory to indexed names and translations. Database save is using POST instead of GET. Redesigned the web page. Added total cost display which updates on inventory changes.
Michiel Broek <mbroek@mbse.eu>
parents: 37
diff changeset
162 $("#form").jqxDropDownList({
f0ec83e1e01f Switches yeasts inventory to indexed names and translations. Database save is using POST instead of GET. Redesigned the web page. Added total cost display which updates on inventory changes.
Michiel Broek <mbroek@mbse.eu>
parents: 37
diff changeset
163 theme: theme,
f0ec83e1e01f Switches yeasts inventory to indexed names and translations. Database save is using POST instead of GET. Redesigned the web page. Added total cost display which updates on inventory changes.
Michiel Broek <mbroek@mbse.eu>
parents: 37
diff changeset
164 source: YeastFormAdapter,
f0ec83e1e01f Switches yeasts inventory to indexed names and translations. Database save is using POST instead of GET. Redesigned the web page. Added total cost display which updates on inventory changes.
Michiel Broek <mbroek@mbse.eu>
parents: 37
diff changeset
165 valueMember: 'id',
f0ec83e1e01f Switches yeasts inventory to indexed names and translations. Database save is using POST instead of GET. Redesigned the web page. Added total cost display which updates on inventory changes.
Michiel Broek <mbroek@mbse.eu>
parents: 37
diff changeset
166 displayMember: 'nl',
f0ec83e1e01f Switches yeasts inventory to indexed names and translations. Database save is using POST instead of GET. Redesigned the web page. Added total cost display which updates on inventory changes.
Michiel Broek <mbroek@mbse.eu>
parents: 37
diff changeset
167 selectedIndex: 0,
f0ec83e1e01f Switches yeasts inventory to indexed names and translations. Database save is using POST instead of GET. Redesigned the web page. Added total cost display which updates on inventory changes.
Michiel Broek <mbroek@mbse.eu>
parents: 37
diff changeset
168 width: 180,
f0ec83e1e01f Switches yeasts inventory to indexed names and translations. Database save is using POST instead of GET. Redesigned the web page. Added total cost display which updates on inventory changes.
Michiel Broek <mbroek@mbse.eu>
parents: 37
diff changeset
169 height: 23,
f0ec83e1e01f Switches yeasts inventory to indexed names and translations. Database save is using POST instead of GET. Redesigned the web page. Added total cost display which updates on inventory changes.
Michiel Broek <mbroek@mbse.eu>
parents: 37
diff changeset
170 autoDropDownHeight: true
f0ec83e1e01f Switches yeasts inventory to indexed names and translations. Database save is using POST instead of GET. Redesigned the web page. Added total cost display which updates on inventory changes.
Michiel Broek <mbroek@mbse.eu>
parents: 37
diff changeset
171 });
f0ec83e1e01f Switches yeasts inventory to indexed names and translations. Database save is using POST instead of GET. Redesigned the web page. Added total cost display which updates on inventory changes.
Michiel Broek <mbroek@mbse.eu>
parents: 37
diff changeset
172 $("#notes").jqxInput({ theme: theme, width: 800, height: 120 });
201
f9b7e3f6be7c 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.
Michiel Broek <mbroek@mbse.eu>
parents: 200
diff changeset
173 $("#best_for").jqxInput({ theme: theme, width: 320, height: 75 });
245
3649c3d31d15 Fixed the mousewheel, spinner buttons to use the full min/max ranges. The 1.002 SG block to be precise.
Michiel Broek <mbroek@mbse.eu>
parents: 201
diff changeset
174 $("#inventory").jqxNumberInput( Spin1dec );
198
f0ec83e1e01f Switches yeasts inventory to indexed names and translations. Database save is using POST instead of GET. Redesigned the web page. Added total cost display which updates on inventory changes.
Michiel Broek <mbroek@mbse.eu>
parents: 37
diff changeset
175 $("#production_date").jqxDateTimeInput( Dateopts );
f0ec83e1e01f Switches yeasts inventory to indexed names and translations. Database save is using POST instead of GET. Redesigned the web page. Added total cost display which updates on inventory changes.
Michiel Broek <mbroek@mbse.eu>
parents: 37
diff changeset
176 $("#min_temperature").jqxNumberInput( YeastT );
f0ec83e1e01f Switches yeasts inventory to indexed names and translations. Database save is using POST instead of GET. Redesigned the web page. Added total cost display which updates on inventory changes.
Michiel Broek <mbroek@mbse.eu>
parents: 37
diff changeset
177 $("#max_temperature").jqxNumberInput( YeastT );
f0ec83e1e01f Switches yeasts inventory to indexed names and translations. Database save is using POST instead of GET. Redesigned the web page. Added total cost display which updates on inventory changes.
Michiel Broek <mbroek@mbse.eu>
parents: 37
diff changeset
178 $("#flocculation").jqxDropDownList({
f0ec83e1e01f Switches yeasts inventory to indexed names and translations. Database save is using POST instead of GET. Redesigned the web page. Added total cost display which updates on inventory changes.
Michiel Broek <mbroek@mbse.eu>
parents: 37
diff changeset
179 theme: theme,
f0ec83e1e01f Switches yeasts inventory to indexed names and translations. Database save is using POST instead of GET. Redesigned the web page. Added total cost display which updates on inventory changes.
Michiel Broek <mbroek@mbse.eu>
parents: 37
diff changeset
180 source: FlocculationAdapter,
f0ec83e1e01f Switches yeasts inventory to indexed names and translations. Database save is using POST instead of GET. Redesigned the web page. Added total cost display which updates on inventory changes.
Michiel Broek <mbroek@mbse.eu>
parents: 37
diff changeset
181 valueMember: 'id',
f0ec83e1e01f Switches yeasts inventory to indexed names and translations. Database save is using POST instead of GET. Redesigned the web page. Added total cost display which updates on inventory changes.
Michiel Broek <mbroek@mbse.eu>
parents: 37
diff changeset
182 displayMember: 'nl',
f0ec83e1e01f Switches yeasts inventory to indexed names and translations. Database save is using POST instead of GET. Redesigned the web page. Added total cost display which updates on inventory changes.
Michiel Broek <mbroek@mbse.eu>
parents: 37
diff changeset
183 width: 180,
f0ec83e1e01f Switches yeasts inventory to indexed names and translations. Database save is using POST instead of GET. Redesigned the web page. Added total cost display which updates on inventory changes.
Michiel Broek <mbroek@mbse.eu>
parents: 37
diff changeset
184 height: 23,
f0ec83e1e01f Switches yeasts inventory to indexed names and translations. Database save is using POST instead of GET. Redesigned the web page. Added total cost display which updates on inventory changes.
Michiel Broek <mbroek@mbse.eu>
parents: 37
diff changeset
185 autoDropDownHeight: true
f0ec83e1e01f Switches yeasts inventory to indexed names and translations. Database save is using POST instead of GET. Redesigned the web page. Added total cost display which updates on inventory changes.
Michiel Broek <mbroek@mbse.eu>
parents: 37
diff changeset
186 });
245
3649c3d31d15 Fixed the mousewheel, spinner buttons to use the full min/max ranges. The 1.002 SG block to be precise.
Michiel Broek <mbroek@mbse.eu>
parents: 201
diff changeset
187 $("#attenuation").jqxNumberInput( Perc1dec );
198
f0ec83e1e01f Switches yeasts inventory to indexed names and translations. Database save is using POST instead of GET. Redesigned the web page. Added total cost display which updates on inventory changes.
Michiel Broek <mbroek@mbse.eu>
parents: 37
diff changeset
188 $("#max_reuse").jqxNumberInput( PosInt );
f0ec83e1e01f Switches yeasts inventory to indexed names and translations. Database save is using POST instead of GET. Redesigned the web page. Added total cost display which updates on inventory changes.
Michiel Broek <mbroek@mbse.eu>
parents: 37
diff changeset
189 $("#max_reuse").jqxNumberInput({ max: 10 });
245
3649c3d31d15 Fixed the mousewheel, spinner buttons to use the full min/max ranges. The 1.002 SG block to be precise.
Michiel Broek <mbroek@mbse.eu>
parents: 201
diff changeset
190 $("#cost").jqxNumberInput( Spin2dec );
198
f0ec83e1e01f Switches yeasts inventory to indexed names and translations. Database save is using POST instead of GET. Redesigned the web page. Added total cost display which updates on inventory changes.
Michiel Broek <mbroek@mbse.eu>
parents: 37
diff changeset
191 $("#tht_date").jqxDateTimeInput( Dateopts );
269
25696a91b395 Code cleanup
Michiel Broek <mbroek@mbse.eu>
parents: 245
diff changeset
192 $("#totval").jqxNumberInput( Show2dec );
245
3649c3d31d15 Fixed the mousewheel, spinner buttons to use the full min/max ranges. The 1.002 SG block to be precise.
Michiel Broek <mbroek@mbse.eu>
parents: 201
diff changeset
193 $("#cells").jqxNumberInput( Spin1dec );
14
d9dfd703df83 Added yeast inventory screens
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
194
d9dfd703df83 Added yeast inventory screens
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
195 var dataAdapter = new $.jqx.dataAdapter(source);
d9dfd703df83 Added yeast inventory screens
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
196 var editrow = -1;
d9dfd703df83 Added yeast inventory screens
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
197 // initialize jqxGrid
d9dfd703df83 Added yeast inventory screens
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
198 $("#jqxgrid").jqxGrid({
d9dfd703df83 Added yeast inventory screens
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
199 width: 1280,
d9dfd703df83 Added yeast inventory screens
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
200 height: 630,
d9dfd703df83 Added yeast inventory screens
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
201 source: dataAdapter,
d9dfd703df83 Added yeast inventory screens
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
202 theme: theme,
d9dfd703df83 Added yeast inventory screens
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
203 showstatusbar: true,
d9dfd703df83 Added yeast inventory screens
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
204 renderstatusbar: function (statusbar) {
d9dfd703df83 Added yeast inventory screens
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
205 var container = $("<div style='overflow: hidden; position: relative; margin: 5px;'></div>");
34
a720353fada9 Formatting and measurements
Michiel Broek <mbroek@mbse.eu>
parents: 33
diff changeset
206 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;'>Nieuw</span></div>");
311
f6fafccd8a6d Added xml import for fermentables, hops, miscs, yeasts and styles. Fixed update IBU calculation in the editor hop popups.
Michiel Broek <mbroek@mbse.eu>
parents: 286
diff changeset
207 var impButton = $("<div style='float: right; margin-right: 50px;'><img style='position: relative; margin-top: 2px;' src='images/add.png'/><span style='margin-left: 4px; position: relative; top: -3px;'>Import</span></div>");
14
d9dfd703df83 Added yeast inventory screens
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
208 container.append(addButton);
311
f6fafccd8a6d Added xml import for fermentables, hops, miscs, yeasts and styles. Fixed update IBU calculation in the editor hop popups.
Michiel Broek <mbroek@mbse.eu>
parents: 286
diff changeset
209 container.append(impButton);
14
d9dfd703df83 Added yeast inventory screens
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
210 statusbar.append(container);
198
f0ec83e1e01f Switches yeasts inventory to indexed names and translations. Database save is using POST instead of GET. Redesigned the web page. Added total cost display which updates on inventory changes.
Michiel Broek <mbroek@mbse.eu>
parents: 37
diff changeset
211 addButton.jqxButton({ theme: theme, width: 90, height: 20 });
311
f6fafccd8a6d Added xml import for fermentables, hops, miscs, yeasts and styles. Fixed update IBU calculation in the editor hop popups.
Michiel Broek <mbroek@mbse.eu>
parents: 286
diff changeset
212 impButton.jqxButton({ theme: theme, width: 90, height: 20 });
14
d9dfd703df83 Added yeast inventory screens
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
213 // add new row.
d9dfd703df83 Added yeast inventory screens
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
214 addButton.click(function (event) {
d9dfd703df83 Added yeast inventory screens
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
215 editrow = -1;
198
f0ec83e1e01f Switches yeasts inventory to indexed names and translations. Database save is using POST instead of GET. Redesigned the web page. Added total cost display which updates on inventory changes.
Michiel Broek <mbroek@mbse.eu>
parents: 37
diff changeset
216 $("#popupWindow").jqxWindow({ position: { x: 110, y: 30 } });
14
d9dfd703df83 Added yeast inventory screens
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
217 $("#name").val('');
d9dfd703df83 Added yeast inventory screens
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
218 $("#laboratory").val('');
d9dfd703df83 Added yeast inventory screens
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
219 $("#product_id").val('');
198
f0ec83e1e01f Switches yeasts inventory to indexed names and translations. Database save is using POST instead of GET. Redesigned the web page. Added total cost display which updates on inventory changes.
Michiel Broek <mbroek@mbse.eu>
parents: 37
diff changeset
220 $("#type").val(0);
f0ec83e1e01f Switches yeasts inventory to indexed names and translations. Database save is using POST instead of GET. Redesigned the web page. Added total cost display which updates on inventory changes.
Michiel Broek <mbroek@mbse.eu>
parents: 37
diff changeset
221 $("#form").val(0);
f0ec83e1e01f Switches yeasts inventory to indexed names and translations. Database save is using POST instead of GET. Redesigned the web page. Added total cost display which updates on inventory changes.
Michiel Broek <mbroek@mbse.eu>
parents: 37
diff changeset
222 $("#min_temperature").val(18);
f0ec83e1e01f Switches yeasts inventory to indexed names and translations. Database save is using POST instead of GET. Redesigned the web page. Added total cost display which updates on inventory changes.
Michiel Broek <mbroek@mbse.eu>
parents: 37
diff changeset
223 $("#max_temperature").val(22);
f0ec83e1e01f Switches yeasts inventory to indexed names and translations. Database save is using POST instead of GET. Redesigned the web page. Added total cost display which updates on inventory changes.
Michiel Broek <mbroek@mbse.eu>
parents: 37
diff changeset
224 $("#flocculation").val(0);
f0ec83e1e01f Switches yeasts inventory to indexed names and translations. Database save is using POST instead of GET. Redesigned the web page. Added total cost display which updates on inventory changes.
Michiel Broek <mbroek@mbse.eu>
parents: 37
diff changeset
225 $("#attenuation").val(77);
14
d9dfd703df83 Added yeast inventory screens
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
226 $("#notes").val('');
d9dfd703df83 Added yeast inventory screens
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
227 $("#best_for").val('');
198
f0ec83e1e01f Switches yeasts inventory to indexed names and translations. Database save is using POST instead of GET. Redesigned the web page. Added total cost display which updates on inventory changes.
Michiel Broek <mbroek@mbse.eu>
parents: 37
diff changeset
228 $("#max_reuse").val(10);
f0ec83e1e01f Switches yeasts inventory to indexed names and translations. Database save is using POST instead of GET. Redesigned the web page. Added total cost display which updates on inventory changes.
Michiel Broek <mbroek@mbse.eu>
parents: 37
diff changeset
229 $("#inventory").val(0);
f0ec83e1e01f Switches yeasts inventory to indexed names and translations. Database save is using POST instead of GET. Redesigned the web page. Added total cost display which updates on inventory changes.
Michiel Broek <mbroek@mbse.eu>
parents: 37
diff changeset
230 $("#cost").val(0);
14
d9dfd703df83 Added yeast inventory screens
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
231 $("#production_date").val('');
d9dfd703df83 Added yeast inventory screens
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
232 $("#tht_date").val('');
201
f9b7e3f6be7c 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.
Michiel Broek <mbroek@mbse.eu>
parents: 200
diff changeset
233 $("#cells").val(1);
14
d9dfd703df83 Added yeast inventory screens
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
234 $("#popupWindow").jqxWindow('open');
d9dfd703df83 Added yeast inventory screens
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
235 });
311
f6fafccd8a6d Added xml import for fermentables, hops, miscs, yeasts and styles. Fixed update IBU calculation in the editor hop popups.
Michiel Broek <mbroek@mbse.eu>
parents: 286
diff changeset
236 impButton.click(function (event) {
f6fafccd8a6d Added xml import for fermentables, hops, miscs, yeasts and styles. Fixed update IBU calculation in the editor hop popups.
Michiel Broek <mbroek@mbse.eu>
parents: 286
diff changeset
237 var url="import_ingredients.php?select=yeasts";
f6fafccd8a6d Added xml import for fermentables, hops, miscs, yeasts and styles. Fixed update IBU calculation in the editor hop popups.
Michiel Broek <mbroek@mbse.eu>
parents: 286
diff changeset
238 window.location.href = url;
f6fafccd8a6d Added xml import for fermentables, hops, miscs, yeasts and styles. Fixed update IBU calculation in the editor hop popups.
Michiel Broek <mbroek@mbse.eu>
parents: 286
diff changeset
239 });
14
d9dfd703df83 Added yeast inventory screens
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
240 },
d9dfd703df83 Added yeast inventory screens
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
241 filterable: true,
d9dfd703df83 Added yeast inventory screens
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
242 filtermode: 'excel',
d9dfd703df83 Added yeast inventory screens
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
243 columns: [
d9dfd703df83 Added yeast inventory screens
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
244 { text: 'Laboratorium', datafield: 'laboratory', width: 150 },
201
f9b7e3f6be7c 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.
Michiel Broek <mbroek@mbse.eu>
parents: 200
diff changeset
245 { text: 'Product ID', datafield: 'product_id', width: 120, menu: false },
f9b7e3f6be7c 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.
Michiel Broek <mbroek@mbse.eu>
parents: 200
diff changeset
246 { text: 'Gist naam', datafield: 'name', menu: false },
f9b7e3f6be7c 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.
Michiel Broek <mbroek@mbse.eu>
parents: 200
diff changeset
247 { text: 'Type', datafield: 'type', align: 'center', cellsalign: 'center', menu: false, width: 110,
198
f0ec83e1e01f Switches yeasts inventory to indexed names and translations. Database save is using POST instead of GET. Redesigned the web page. Added total cost display which updates on inventory changes.
Michiel Broek <mbroek@mbse.eu>
parents: 37
diff changeset
248 cellsrenderer: function (index, datafield, value, defaultvalue, column, rowdata) {
f0ec83e1e01f Switches yeasts inventory to indexed names and translations. Database save is using POST instead of GET. Redesigned the web page. Added total cost display which updates on inventory changes.
Michiel Broek <mbroek@mbse.eu>
parents: 37
diff changeset
249 return "<div style='margin: 4px;' class='jqx-center-align'>" + YeastTypeData[value].nl + "</div>";
f0ec83e1e01f Switches yeasts inventory to indexed names and translations. Database save is using POST instead of GET. Redesigned the web page. Added total cost display which updates on inventory changes.
Michiel Broek <mbroek@mbse.eu>
parents: 37
diff changeset
250 }
f0ec83e1e01f Switches yeasts inventory to indexed names and translations. Database save is using POST instead of GET. Redesigned the web page. Added total cost display which updates on inventory changes.
Michiel Broek <mbroek@mbse.eu>
parents: 37
diff changeset
251 },
201
f9b7e3f6be7c 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.
Michiel Broek <mbroek@mbse.eu>
parents: 200
diff changeset
252 { text: 'Vorm', datafield: 'form', align: 'center', cellsalign: 'center', menu: false, width: 110,
198
f0ec83e1e01f Switches yeasts inventory to indexed names and translations. Database save is using POST instead of GET. Redesigned the web page. Added total cost display which updates on inventory changes.
Michiel Broek <mbroek@mbse.eu>
parents: 37
diff changeset
253 cellsrenderer: function (index, datafield, value, defaultvalue, column, rowdata) {
f0ec83e1e01f Switches yeasts inventory to indexed names and translations. Database save is using POST instead of GET. Redesigned the web page. Added total cost display which updates on inventory changes.
Michiel Broek <mbroek@mbse.eu>
parents: 37
diff changeset
254 return "<div style='margin: 4px;' class='jqx-center-align'>" + YeastFormData[value].nl + "</div>";
f0ec83e1e01f Switches yeasts inventory to indexed names and translations. Database save is using POST instead of GET. Redesigned the web page. Added total cost display which updates on inventory changes.
Michiel Broek <mbroek@mbse.eu>
parents: 37
diff changeset
255 }
f0ec83e1e01f Switches yeasts inventory to indexed names and translations. Database save is using POST instead of GET. Redesigned the web page. Added total cost display which updates on inventory changes.
Michiel Broek <mbroek@mbse.eu>
parents: 37
diff changeset
256 },
201
f9b7e3f6be7c 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.
Michiel Broek <mbroek@mbse.eu>
parents: 200
diff changeset
257 { text: 'SVG', datafield: 'attenuation', width: 80, align: 'right', cellsalign: 'right', menu: false, cellsformat: 'p1' },
286
124af734af68 Version 0.1.0. Removed localization because it was messy, parts were localized and others not. In production and recipes ingredients not in stock are marked in red.
Michiel Broek <mbroek@mbse.eu>
parents: 278
diff changeset
258 { text: 'Voorraad', datafield: 'inventory', width: 100, align: 'right', menu: false,
201
f9b7e3f6be7c 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.
Michiel Broek <mbroek@mbse.eu>
parents: 200
diff changeset
259 cellsrenderer: function (index, datafield, value, defaultvalue, column, rowdata) {
286
124af734af68 Version 0.1.0. Removed localization because it was messy, parts were localized and others not. In production and recipes ingredients not in stock are marked in red.
Michiel Broek <mbroek@mbse.eu>
parents: 278
diff changeset
260 var amount = "";
124af734af68 Version 0.1.0. Removed localization because it was messy, parts were localized and others not. In production and recipes ingredients not in stock are marked in red.
Michiel Broek <mbroek@mbse.eu>
parents: 278
diff changeset
261 if (value > 0) {
124af734af68 Version 0.1.0. Removed localization because it was messy, parts were localized and others not. In production and recipes ingredients not in stock are marked in red.
Michiel Broek <mbroek@mbse.eu>
parents: 278
diff changeset
262 if ((rowdata.form == 0) && (value > 1))
124af734af68 Version 0.1.0. Removed localization because it was messy, parts were localized and others not. In production and recipes ingredients not in stock are marked in red.
Michiel Broek <mbroek@mbse.eu>
parents: 278
diff changeset
263 amount = dataAdapter.formatNumber(value,"f0")+" pakken";
124af734af68 Version 0.1.0. Removed localization because it was messy, parts were localized and others not. In production and recipes ingredients not in stock are marked in red.
Michiel Broek <mbroek@mbse.eu>
parents: 278
diff changeset
264 else if (rowdata.form == 0)
124af734af68 Version 0.1.0. Removed localization because it was messy, parts were localized and others not. In production and recipes ingredients not in stock are marked in red.
Michiel Broek <mbroek@mbse.eu>
parents: 278
diff changeset
265 amount = dataAdapter.formatNumber(value,"f0")+" pak";
124af734af68 Version 0.1.0. Removed localization because it was messy, parts were localized and others not. In production and recipes ingredients not in stock are marked in red.
Michiel Broek <mbroek@mbse.eu>
parents: 278
diff changeset
266 else if (rowdata.form == 1)
124af734af68 Version 0.1.0. Removed localization because it was messy, parts were localized and others not. In production and recipes ingredients not in stock are marked in red.
Michiel Broek <mbroek@mbse.eu>
parents: 278
diff changeset
267 amount = dataAdapter.formatNumber(value * 1000,"f1")+" gram";
124af734af68 Version 0.1.0. Removed localization because it was messy, parts were localized and others not. In production and recipes ingredients not in stock are marked in red.
Michiel Broek <mbroek@mbse.eu>
parents: 278
diff changeset
268 else
124af734af68 Version 0.1.0. Removed localization because it was messy, parts were localized and others not. In production and recipes ingredients not in stock are marked in red.
Michiel Broek <mbroek@mbse.eu>
parents: 278
diff changeset
269 amount = dataAdapter.formatNumber(value * 1000,"f1")+" ml";
124af734af68 Version 0.1.0. Removed localization because it was messy, parts were localized and others not. In production and recipes ingredients not in stock are marked in red.
Michiel Broek <mbroek@mbse.eu>
parents: 278
diff changeset
270 }
124af734af68 Version 0.1.0. Removed localization because it was messy, parts were localized and others not. In production and recipes ingredients not in stock are marked in red.
Michiel Broek <mbroek@mbse.eu>
parents: 278
diff changeset
271 return "<span style='margin: 3px; margin-top: 6px; float: right;'>" + amount + "</span>";
201
f9b7e3f6be7c 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.
Michiel Broek <mbroek@mbse.eu>
parents: 200
diff changeset
272 }
f9b7e3f6be7c 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.
Michiel Broek <mbroek@mbse.eu>
parents: 200
diff changeset
273 },
286
124af734af68 Version 0.1.0. Removed localization because it was messy, parts were localized and others not. In production and recipes ingredients not in stock are marked in red.
Michiel Broek <mbroek@mbse.eu>
parents: 278
diff changeset
274 { text: '', datafield: 'Edit', columntype: 'button', width: 100, align: 'center', menu: false, cellsrenderer: function () {
34
a720353fada9 Formatting and measurements
Michiel Broek <mbroek@mbse.eu>
parents: 33
diff changeset
275 return "Wijzig";
14
d9dfd703df83 Added yeast inventory screens
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
276 }, buttonclick: function (row) {
d9dfd703df83 Added yeast inventory screens
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
277 // open the popup window when the user clicks a button.
d9dfd703df83 Added yeast inventory screens
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
278 editrow = row;
198
f0ec83e1e01f Switches yeasts inventory to indexed names and translations. Database save is using POST instead of GET. Redesigned the web page. Added total cost display which updates on inventory changes.
Michiel Broek <mbroek@mbse.eu>
parents: 37
diff changeset
279 $("#popupWindow").jqxWindow({ position: { x: 110, y: 30 } });
14
d9dfd703df83 Added yeast inventory screens
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
280 // get the clicked row's data and initialize the input fields.
198
f0ec83e1e01f Switches yeasts inventory to indexed names and translations. Database save is using POST instead of GET. Redesigned the web page. Added total cost display which updates on inventory changes.
Michiel Broek <mbroek@mbse.eu>
parents: 37
diff changeset
281 dataRecord = $("#jqxgrid").jqxGrid('getrowdata', editrow);
14
d9dfd703df83 Added yeast inventory screens
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
282 $("#name").val(dataRecord.name);
d9dfd703df83 Added yeast inventory screens
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
283 $("#laboratory").val(dataRecord.laboratory);
d9dfd703df83 Added yeast inventory screens
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
284 $("#product_id").val(dataRecord.product_id);
d9dfd703df83 Added yeast inventory screens
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
285 $("#type").val(dataRecord.type);
d9dfd703df83 Added yeast inventory screens
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
286 $("#form").val(dataRecord.form);
d9dfd703df83 Added yeast inventory screens
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
287 $("#min_temperature").val(dataRecord.min_temperature);
d9dfd703df83 Added yeast inventory screens
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
288 $("#max_temperature").val(dataRecord.max_temperature);
d9dfd703df83 Added yeast inventory screens
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
289 $("#flocculation").val(dataRecord.flocculation);
d9dfd703df83 Added yeast inventory screens
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
290 $("#attenuation").val(dataRecord.attenuation);
d9dfd703df83 Added yeast inventory screens
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
291 $("#notes").val(dataRecord.notes);
d9dfd703df83 Added yeast inventory screens
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
292 $("#best_for").val(dataRecord.best_for);
d9dfd703df83 Added yeast inventory screens
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
293 $("#max_reuse").val(dataRecord.max_reuse);
201
f9b7e3f6be7c 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.
Michiel Broek <mbroek@mbse.eu>
parents: 200
diff changeset
294 if (dataRecord.form == 0)
f9b7e3f6be7c 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.
Michiel Broek <mbroek@mbse.eu>
parents: 200
diff changeset
295 $("#inventory").val(dataRecord.inventory);
f9b7e3f6be7c 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.
Michiel Broek <mbroek@mbse.eu>
parents: 200
diff changeset
296 else
f9b7e3f6be7c 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.
Michiel Broek <mbroek@mbse.eu>
parents: 200
diff changeset
297 $("#inventory").val(dataRecord.inventory * 1000);
14
d9dfd703df83 Added yeast inventory screens
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
298 $("#cost").val(dataRecord.cost);
d9dfd703df83 Added yeast inventory screens
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
299 $("#production_date").val(dataRecord.production_date);
d9dfd703df83 Added yeast inventory screens
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
300 $("#tht_date").val(dataRecord.tht_date);
201
f9b7e3f6be7c 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.
Michiel Broek <mbroek@mbse.eu>
parents: 200
diff changeset
301 $("#cells").val(dataRecord.cells);
f9b7e3f6be7c 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.
Michiel Broek <mbroek@mbse.eu>
parents: 200
diff changeset
302 calcTotal();
14
d9dfd703df83 Added yeast inventory screens
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
303 // show the popup window.
d9dfd703df83 Added yeast inventory screens
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
304 $("#popupWindow").jqxWindow('open');
d9dfd703df83 Added yeast inventory screens
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
305 }
d9dfd703df83 Added yeast inventory screens
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
306 }
d9dfd703df83 Added yeast inventory screens
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
307 ]
d9dfd703df83 Added yeast inventory screens
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
308 });
198
f0ec83e1e01f Switches yeasts inventory to indexed names and translations. Database save is using POST instead of GET. Redesigned the web page. Added total cost display which updates on inventory changes.
Michiel Broek <mbroek@mbse.eu>
parents: 37
diff changeset
309
201
f9b7e3f6be7c 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.
Michiel Broek <mbroek@mbse.eu>
parents: 200
diff changeset
310 $('#popupWindow').on('open', function (event) { calcTotal(); });
198
f0ec83e1e01f Switches yeasts inventory to indexed names and translations. Database save is using POST instead of GET. Redesigned the web page. Added total cost display which updates on inventory changes.
Michiel Broek <mbroek@mbse.eu>
parents: 37
diff changeset
311 $("#cost").on('change', function (event) {
f0ec83e1e01f Switches yeasts inventory to indexed names and translations. Database save is using POST instead of GET. Redesigned the web page. Added total cost display which updates on inventory changes.
Michiel Broek <mbroek@mbse.eu>
parents: 37
diff changeset
312 dataRecord.cost = parseFloat(event.args.value);
201
f9b7e3f6be7c 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.
Michiel Broek <mbroek@mbse.eu>
parents: 200
diff changeset
313 calcTotal();
198
f0ec83e1e01f Switches yeasts inventory to indexed names and translations. Database save is using POST instead of GET. Redesigned the web page. Added total cost display which updates on inventory changes.
Michiel Broek <mbroek@mbse.eu>
parents: 37
diff changeset
314 });
f0ec83e1e01f Switches yeasts inventory to indexed names and translations. Database save is using POST instead of GET. Redesigned the web page. Added total cost display which updates on inventory changes.
Michiel Broek <mbroek@mbse.eu>
parents: 37
diff changeset
315 $("#inventory").on('change', function (event) {
201
f9b7e3f6be7c 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.
Michiel Broek <mbroek@mbse.eu>
parents: 200
diff changeset
316 if (dataRecord.form == 0)
f9b7e3f6be7c 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.
Michiel Broek <mbroek@mbse.eu>
parents: 200
diff changeset
317 dataRecord.inventory = parseFloat(event.args.value);
f9b7e3f6be7c 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.
Michiel Broek <mbroek@mbse.eu>
parents: 200
diff changeset
318 else
f9b7e3f6be7c 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.
Michiel Broek <mbroek@mbse.eu>
parents: 200
diff changeset
319 dataRecord.inventory = parseFloat(event.args.value) / 1000.0;
f9b7e3f6be7c 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.
Michiel Broek <mbroek@mbse.eu>
parents: 200
diff changeset
320 calcTotal();
f9b7e3f6be7c 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.
Michiel Broek <mbroek@mbse.eu>
parents: 200
diff changeset
321 });
f9b7e3f6be7c 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.
Michiel Broek <mbroek@mbse.eu>
parents: 200
diff changeset
322 $("#form").on('select', function (event) {
f9b7e3f6be7c 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.
Michiel Broek <mbroek@mbse.eu>
parents: 200
diff changeset
323 if (event.args) {
f9b7e3f6be7c 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.
Michiel Broek <mbroek@mbse.eu>
parents: 200
diff changeset
324 dataRecord.form = event.args.index;
f9b7e3f6be7c 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.
Michiel Broek <mbroek@mbse.eu>
parents: 200
diff changeset
325 calcTotal();
f9b7e3f6be7c 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.
Michiel Broek <mbroek@mbse.eu>
parents: 200
diff changeset
326 }
198
f0ec83e1e01f Switches yeasts inventory to indexed names and translations. Database save is using POST instead of GET. Redesigned the web page. Added total cost display which updates on inventory changes.
Michiel Broek <mbroek@mbse.eu>
parents: 37
diff changeset
327 });
f0ec83e1e01f Switches yeasts inventory to indexed names and translations. Database save is using POST instead of GET. Redesigned the web page. Added total cost display which updates on inventory changes.
Michiel Broek <mbroek@mbse.eu>
parents: 37
diff changeset
328
14
d9dfd703df83 Added yeast inventory screens
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
329 // initialize the popup window and buttons.
d9dfd703df83 Added yeast inventory screens
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
330 $("#popupWindow").jqxWindow({
198
f0ec83e1e01f Switches yeasts inventory to indexed names and translations. Database save is using POST instead of GET. Redesigned the web page. Added total cost display which updates on inventory changes.
Michiel Broek <mbroek@mbse.eu>
parents: 37
diff changeset
331 width: 1050,
f0ec83e1e01f Switches yeasts inventory to indexed names and translations. Database save is using POST instead of GET. Redesigned the web page. Added total cost display which updates on inventory changes.
Michiel Broek <mbroek@mbse.eu>
parents: 37
diff changeset
332 height: 550,
f0ec83e1e01f Switches yeasts inventory to indexed names and translations. Database save is using POST instead of GET. Redesigned the web page. Added total cost display which updates on inventory changes.
Michiel Broek <mbroek@mbse.eu>
parents: 37
diff changeset
333 resizable: false,
f0ec83e1e01f Switches yeasts inventory to indexed names and translations. Database save is using POST instead of GET. Redesigned the web page. Added total cost display which updates on inventory changes.
Michiel Broek <mbroek@mbse.eu>
parents: 37
diff changeset
334 theme: theme,
f0ec83e1e01f Switches yeasts inventory to indexed names and translations. Database save is using POST instead of GET. Redesigned the web page. Added total cost display which updates on inventory changes.
Michiel Broek <mbroek@mbse.eu>
parents: 37
diff changeset
335 isModal: true,
f0ec83e1e01f Switches yeasts inventory to indexed names and translations. Database save is using POST instead of GET. Redesigned the web page. Added total cost display which updates on inventory changes.
Michiel Broek <mbroek@mbse.eu>
parents: 37
diff changeset
336 autoOpen: false,
f0ec83e1e01f Switches yeasts inventory to indexed names and translations. Database save is using POST instead of GET. Redesigned the web page. Added total cost display which updates on inventory changes.
Michiel Broek <mbroek@mbse.eu>
parents: 37
diff changeset
337 cancelButton: $("#Cancel"),
f0ec83e1e01f Switches yeasts inventory to indexed names and translations. Database save is using POST instead of GET. Redesigned the web page. Added total cost display which updates on inventory changes.
Michiel Broek <mbroek@mbse.eu>
parents: 37
diff changeset
338 modalOpacity: 0.40
14
d9dfd703df83 Added yeast inventory screens
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
339 });
d9dfd703df83 Added yeast inventory screens
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
340 $("#popupWindow").on('open', function () {
d9dfd703df83 Added yeast inventory screens
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
341 $("#name").jqxInput('selectAll');
d9dfd703df83 Added yeast inventory screens
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
342 });
198
f0ec83e1e01f Switches yeasts inventory to indexed names and translations. Database save is using POST instead of GET. Redesigned the web page. Added total cost display which updates on inventory changes.
Michiel Broek <mbroek@mbse.eu>
parents: 37
diff changeset
343 $("#Delete").jqxButton({ template: "danger", width: '90px', theme: theme });
14
d9dfd703df83 Added yeast inventory screens
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
344 $("#Delete").click(function () {
d9dfd703df83 Added yeast inventory screens
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
345 if (editrow >= 0) {
d9dfd703df83 Added yeast inventory screens
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
346 // Open a popup to confirm this action.
d9dfd703df83 Added yeast inventory screens
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
347 $('#eventWindow').jqxWindow('open');
d9dfd703df83 Added yeast inventory screens
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
348 $("#delOk").click(function () {
d9dfd703df83 Added yeast inventory screens
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
349 var rowID = $('#jqxgrid').jqxGrid('getrowid', editrow);
d9dfd703df83 Added yeast inventory screens
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
350 $("#jqxgrid").jqxGrid('deleterow', rowID);
d9dfd703df83 Added yeast inventory screens
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
351 });
d9dfd703df83 Added yeast inventory screens
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
352 }
d9dfd703df83 Added yeast inventory screens
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
353 $("#popupWindow").jqxWindow('hide');
d9dfd703df83 Added yeast inventory screens
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
354 });
198
f0ec83e1e01f Switches yeasts inventory to indexed names and translations. Database save is using POST instead of GET. Redesigned the web page. Added total cost display which updates on inventory changes.
Michiel Broek <mbroek@mbse.eu>
parents: 37
diff changeset
355 $("#Cancel").jqxButton({ template: "primary", width: '90px', theme: theme });
f0ec83e1e01f Switches yeasts inventory to indexed names and translations. Database save is using POST instead of GET. Redesigned the web page. Added total cost display which updates on inventory changes.
Michiel Broek <mbroek@mbse.eu>
parents: 37
diff changeset
356 $("#Save").jqxButton({ template: "success", width: '90px', theme: theme });
14
d9dfd703df83 Added yeast inventory screens
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
357 // update the edited row when the user clicks the 'Save' button.
d9dfd703df83 Added yeast inventory screens
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
358 $("#Save").click(function () {
198
f0ec83e1e01f Switches yeasts inventory to indexed names and translations. Database save is using POST instead of GET. Redesigned the web page. Added total cost display which updates on inventory changes.
Michiel Broek <mbroek@mbse.eu>
parents: 37
diff changeset
359 var rowID = -1;
14
d9dfd703df83 Added yeast inventory screens
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
360 if (editrow >= 0) {
198
f0ec83e1e01f Switches yeasts inventory to indexed names and translations. Database save is using POST instead of GET. Redesigned the web page. Added total cost display which updates on inventory changes.
Michiel Broek <mbroek@mbse.eu>
parents: 37
diff changeset
361 rowID = $('#jqxgrid').jqxGrid('getrowid', editrow);
f0ec83e1e01f Switches yeasts inventory to indexed names and translations. Database save is using POST instead of GET. Redesigned the web page. Added total cost display which updates on inventory changes.
Michiel Broek <mbroek@mbse.eu>
parents: 37
diff changeset
362 }
201
f9b7e3f6be7c 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.
Michiel Broek <mbroek@mbse.eu>
parents: 200
diff changeset
363 if (dataRecord.form == 0)
f9b7e3f6be7c 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.
Michiel Broek <mbroek@mbse.eu>
parents: 200
diff changeset
364 var n_inventory = parseFloat($("#inventory").jqxNumberInput('decimal'));
f9b7e3f6be7c 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.
Michiel Broek <mbroek@mbse.eu>
parents: 200
diff changeset
365 else
f9b7e3f6be7c 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.
Michiel Broek <mbroek@mbse.eu>
parents: 200
diff changeset
366 var n_inventory = parseFloat($("#inventory").jqxNumberInput('decimal')) / 1000.0;
198
f0ec83e1e01f Switches yeasts inventory to indexed names and translations. Database save is using POST instead of GET. Redesigned the web page. Added total cost display which updates on inventory changes.
Michiel Broek <mbroek@mbse.eu>
parents: 37
diff changeset
367 var row = {
f0ec83e1e01f Switches yeasts inventory to indexed names and translations. Database save is using POST instead of GET. Redesigned the web page. Added total cost display which updates on inventory changes.
Michiel Broek <mbroek@mbse.eu>
parents: 37
diff changeset
368 record: rowID,
f0ec83e1e01f Switches yeasts inventory to indexed names and translations. Database save is using POST instead of GET. Redesigned the web page. Added total cost display which updates on inventory changes.
Michiel Broek <mbroek@mbse.eu>
parents: 37
diff changeset
369 name: $("#name").val(),
f0ec83e1e01f Switches yeasts inventory to indexed names and translations. Database save is using POST instead of GET. Redesigned the web page. Added total cost display which updates on inventory changes.
Michiel Broek <mbroek@mbse.eu>
parents: 37
diff changeset
370 type: $("#type").val(),
f0ec83e1e01f Switches yeasts inventory to indexed names and translations. Database save is using POST instead of GET. Redesigned the web page. Added total cost display which updates on inventory changes.
Michiel Broek <mbroek@mbse.eu>
parents: 37
diff changeset
371 form: $("#form").val(),
f0ec83e1e01f Switches yeasts inventory to indexed names and translations. Database save is using POST instead of GET. Redesigned the web page. Added total cost display which updates on inventory changes.
Michiel Broek <mbroek@mbse.eu>
parents: 37
diff changeset
372 laboratory: $("#laboratory").val(),
f0ec83e1e01f Switches yeasts inventory to indexed names and translations. Database save is using POST instead of GET. Redesigned the web page. Added total cost display which updates on inventory changes.
Michiel Broek <mbroek@mbse.eu>
parents: 37
diff changeset
373 product_id: $("#product_id").val(),
f0ec83e1e01f Switches yeasts inventory to indexed names and translations. Database save is using POST instead of GET. Redesigned the web page. Added total cost display which updates on inventory changes.
Michiel Broek <mbroek@mbse.eu>
parents: 37
diff changeset
374 min_temperature: parseInt($("#min_temperature").jqxNumberInput('decimal')),
f0ec83e1e01f Switches yeasts inventory to indexed names and translations. Database save is using POST instead of GET. Redesigned the web page. Added total cost display which updates on inventory changes.
Michiel Broek <mbroek@mbse.eu>
parents: 37
diff changeset
375 max_temperature: parseInt($("#max_temperature").jqxNumberInput('decimal')),
f0ec83e1e01f Switches yeasts inventory to indexed names and translations. Database save is using POST instead of GET. Redesigned the web page. Added total cost display which updates on inventory changes.
Michiel Broek <mbroek@mbse.eu>
parents: 37
diff changeset
376 flocculation: $("#flocculation").val(),
f0ec83e1e01f Switches yeasts inventory to indexed names and translations. Database save is using POST instead of GET. Redesigned the web page. Added total cost display which updates on inventory changes.
Michiel Broek <mbroek@mbse.eu>
parents: 37
diff changeset
377 attenuation: parseFloat($("#attenuation").jqxNumberInput('decimal')),
f0ec83e1e01f Switches yeasts inventory to indexed names and translations. Database save is using POST instead of GET. Redesigned the web page. Added total cost display which updates on inventory changes.
Michiel Broek <mbroek@mbse.eu>
parents: 37
diff changeset
378 notes: $("#notes").val(),
f0ec83e1e01f Switches yeasts inventory to indexed names and translations. Database save is using POST instead of GET. Redesigned the web page. Added total cost display which updates on inventory changes.
Michiel Broek <mbroek@mbse.eu>
parents: 37
diff changeset
379 best_for: $("#best_for").val(),
f0ec83e1e01f Switches yeasts inventory to indexed names and translations. Database save is using POST instead of GET. Redesigned the web page. Added total cost display which updates on inventory changes.
Michiel Broek <mbroek@mbse.eu>
parents: 37
diff changeset
380 max_reuse: parseInt($("#max_reuse").jqxNumberInput('decimal')),
201
f9b7e3f6be7c 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.
Michiel Broek <mbroek@mbse.eu>
parents: 200
diff changeset
381 inventory: n_inventory,
198
f0ec83e1e01f Switches yeasts inventory to indexed names and translations. Database save is using POST instead of GET. Redesigned the web page. Added total cost display which updates on inventory changes.
Michiel Broek <mbroek@mbse.eu>
parents: 37
diff changeset
382 cost: parseFloat($("#cost").jqxNumberInput('decimal')),
f0ec83e1e01f Switches yeasts inventory to indexed names and translations. Database save is using POST instead of GET. Redesigned the web page. Added total cost display which updates on inventory changes.
Michiel Broek <mbroek@mbse.eu>
parents: 37
diff changeset
383 production_date: $("#production_date").val(),
201
f9b7e3f6be7c 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.
Michiel Broek <mbroek@mbse.eu>
parents: 200
diff changeset
384 tht_date: $("#tht_date").val(),
f9b7e3f6be7c 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.
Michiel Broek <mbroek@mbse.eu>
parents: 200
diff changeset
385 cells: parseFloat($("#cells").jqxNumberInput('decimal'))
198
f0ec83e1e01f Switches yeasts inventory to indexed names and translations. Database save is using POST instead of GET. Redesigned the web page. Added total cost display which updates on inventory changes.
Michiel Broek <mbroek@mbse.eu>
parents: 37
diff changeset
386 };
f0ec83e1e01f Switches yeasts inventory to indexed names and translations. Database save is using POST instead of GET. Redesigned the web page. Added total cost display which updates on inventory changes.
Michiel Broek <mbroek@mbse.eu>
parents: 37
diff changeset
387 if (editrow >= 0) {
14
d9dfd703df83 Added yeast inventory screens
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
388 $('#jqxgrid').jqxGrid('updaterow', rowID, row);
d9dfd703df83 Added yeast inventory screens
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
389 } else {
198
f0ec83e1e01f Switches yeasts inventory to indexed names and translations. Database save is using POST instead of GET. Redesigned the web page. Added total cost display which updates on inventory changes.
Michiel Broek <mbroek@mbse.eu>
parents: 37
diff changeset
390 $('#jqxgrid').jqxGrid('addrow', null, row);
14
d9dfd703df83 Added yeast inventory screens
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
391 }
198
f0ec83e1e01f Switches yeasts inventory to indexed names and translations. Database save is using POST instead of GET. Redesigned the web page. Added total cost display which updates on inventory changes.
Michiel Broek <mbroek@mbse.eu>
parents: 37
diff changeset
392 $("#popupWindow").jqxWindow('hide');
f0ec83e1e01f Switches yeasts inventory to indexed names and translations. Database save is using POST instead of GET. Redesigned the web page. Added total cost display which updates on inventory changes.
Michiel Broek <mbroek@mbse.eu>
parents: 37
diff changeset
393 location.reload( true ); // reload ourself.
14
d9dfd703df83 Added yeast inventory screens
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
394 });
d9dfd703df83 Added yeast inventory screens
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
395 createDelElements();
d9dfd703df83 Added yeast inventory screens
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
396 });
d9dfd703df83 Added yeast inventory screens
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
397

mercurial