www/js/inv_yeasts.js

Sun, 24 Feb 2019 17:23:52 +0100

author
Michiel Broek <mbroek@mbse.eu>
date
Sun, 24 Feb 2019 17:23:52 +0100
changeset 286
124af734af68
parent 278
dc22dd5d77fd
child 311
f6fafccd8a6d
permissions
-rw-r--r--

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.

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>");
14
d9dfd703df83 Added yeast inventory screens
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
207 container.append(addButton);
d9dfd703df83 Added yeast inventory screens
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
208 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
209 addButton.jqxButton({ theme: theme, width: 90, height: 20 });
14
d9dfd703df83 Added yeast inventory screens
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
210 // add new row.
d9dfd703df83 Added yeast inventory screens
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
211 addButton.click(function (event) {
d9dfd703df83 Added yeast inventory screens
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
212 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
213 $("#popupWindow").jqxWindow({ position: { x: 110, y: 30 } });
14
d9dfd703df83 Added yeast inventory screens
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
214 $("#name").val('');
d9dfd703df83 Added yeast inventory screens
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
215 $("#laboratory").val('');
d9dfd703df83 Added yeast inventory screens
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
216 $("#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
217 $("#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
218 $("#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
219 $("#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
220 $("#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
221 $("#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
222 $("#attenuation").val(77);
14
d9dfd703df83 Added yeast inventory screens
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
223 $("#notes").val('');
d9dfd703df83 Added yeast inventory screens
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
224 $("#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
225 $("#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
226 $("#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
227 $("#cost").val(0);
14
d9dfd703df83 Added yeast inventory screens
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
228 $("#production_date").val('');
d9dfd703df83 Added yeast inventory screens
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
229 $("#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
230 $("#cells").val(1);
14
d9dfd703df83 Added yeast inventory screens
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
231 $("#popupWindow").jqxWindow('open');
d9dfd703df83 Added yeast inventory screens
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
232 });
d9dfd703df83 Added yeast inventory screens
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
233 },
d9dfd703df83 Added yeast inventory screens
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
234 filterable: true,
d9dfd703df83 Added yeast inventory screens
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
235 filtermode: 'excel',
d9dfd703df83 Added yeast inventory screens
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
236 columns: [
d9dfd703df83 Added yeast inventory screens
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
237 { 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
238 { 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
239 { 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
240 { 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
241 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
242 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
243 }
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
244 },
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: '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
246 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
247 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
248 }
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 },
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
250 { 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
251 { 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
252 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
253 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
254 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
255 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
256 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
257 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
258 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
259 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
260 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
261 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
262 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
263 }
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 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
265 }
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
266 },
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
267 { 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
268 return "Wijzig";
14
d9dfd703df83 Added yeast inventory screens
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
269 }, buttonclick: function (row) {
d9dfd703df83 Added yeast inventory screens
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
270 // open the popup window when the user clicks a button.
d9dfd703df83 Added yeast inventory screens
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
271 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
272 $("#popupWindow").jqxWindow({ position: { x: 110, y: 30 } });
14
d9dfd703df83 Added yeast inventory screens
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
273 // 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
274 dataRecord = $("#jqxgrid").jqxGrid('getrowdata', editrow);
14
d9dfd703df83 Added yeast inventory screens
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
275 $("#name").val(dataRecord.name);
d9dfd703df83 Added yeast inventory screens
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
276 $("#laboratory").val(dataRecord.laboratory);
d9dfd703df83 Added yeast inventory screens
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
277 $("#product_id").val(dataRecord.product_id);
d9dfd703df83 Added yeast inventory screens
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
278 $("#type").val(dataRecord.type);
d9dfd703df83 Added yeast inventory screens
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
279 $("#form").val(dataRecord.form);
d9dfd703df83 Added yeast inventory screens
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
280 $("#min_temperature").val(dataRecord.min_temperature);
d9dfd703df83 Added yeast inventory screens
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
281 $("#max_temperature").val(dataRecord.max_temperature);
d9dfd703df83 Added yeast inventory screens
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
282 $("#flocculation").val(dataRecord.flocculation);
d9dfd703df83 Added yeast inventory screens
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
283 $("#attenuation").val(dataRecord.attenuation);
d9dfd703df83 Added yeast inventory screens
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
284 $("#notes").val(dataRecord.notes);
d9dfd703df83 Added yeast inventory screens
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
285 $("#best_for").val(dataRecord.best_for);
d9dfd703df83 Added yeast inventory screens
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
286 $("#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
287 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
288 $("#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
289 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
290 $("#inventory").val(dataRecord.inventory * 1000);
14
d9dfd703df83 Added yeast inventory screens
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
291 $("#cost").val(dataRecord.cost);
d9dfd703df83 Added yeast inventory screens
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
292 $("#production_date").val(dataRecord.production_date);
d9dfd703df83 Added yeast inventory screens
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
293 $("#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
294 $("#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
295 calcTotal();
14
d9dfd703df83 Added yeast inventory screens
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
296 // show the popup window.
d9dfd703df83 Added yeast inventory screens
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
297 $("#popupWindow").jqxWindow('open');
d9dfd703df83 Added yeast inventory screens
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
298 }
d9dfd703df83 Added yeast inventory screens
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
299 }
d9dfd703df83 Added yeast inventory screens
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
300 ]
d9dfd703df83 Added yeast inventory screens
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
301 });
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
302
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
303 $('#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
304 $("#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
305 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
306 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
307 });
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
308 $("#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
309 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
310 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
311 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
312 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
313 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
314 });
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
315 $("#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
316 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
317 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
318 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
319 }
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
320 });
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
321
14
d9dfd703df83 Added yeast inventory screens
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
322 // initialize the popup window and buttons.
d9dfd703df83 Added yeast inventory screens
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
323 $("#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
324 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
325 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
326 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
327 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
328 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
329 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
330 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
331 modalOpacity: 0.40
14
d9dfd703df83 Added yeast inventory screens
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
332 });
d9dfd703df83 Added yeast inventory screens
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
333 $("#popupWindow").on('open', function () {
d9dfd703df83 Added yeast inventory screens
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
334 $("#name").jqxInput('selectAll');
d9dfd703df83 Added yeast inventory screens
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
335 });
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
336 $("#Delete").jqxButton({ template: "danger", width: '90px', theme: theme });
14
d9dfd703df83 Added yeast inventory screens
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
337 $("#Delete").click(function () {
d9dfd703df83 Added yeast inventory screens
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
338 if (editrow >= 0) {
d9dfd703df83 Added yeast inventory screens
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
339 // Open a popup to confirm this action.
d9dfd703df83 Added yeast inventory screens
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
340 $('#eventWindow').jqxWindow('open');
d9dfd703df83 Added yeast inventory screens
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
341 $("#delOk").click(function () {
d9dfd703df83 Added yeast inventory screens
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
342 var rowID = $('#jqxgrid').jqxGrid('getrowid', editrow);
d9dfd703df83 Added yeast inventory screens
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
343 $("#jqxgrid").jqxGrid('deleterow', rowID);
d9dfd703df83 Added yeast inventory screens
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
344 });
d9dfd703df83 Added yeast inventory screens
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
345 }
d9dfd703df83 Added yeast inventory screens
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
346 $("#popupWindow").jqxWindow('hide');
d9dfd703df83 Added yeast inventory screens
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
347 });
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
348 $("#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
349 $("#Save").jqxButton({ template: "success", width: '90px', theme: theme });
14
d9dfd703df83 Added yeast inventory screens
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
350 // update the edited row when the user clicks the 'Save' button.
d9dfd703df83 Added yeast inventory screens
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
351 $("#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
352 var rowID = -1;
14
d9dfd703df83 Added yeast inventory screens
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
353 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
354 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
355 }
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
356 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
357 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
358 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
359 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
360 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
361 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
362 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
363 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
364 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
365 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
366 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
367 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
368 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
369 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
370 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
371 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
372 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
373 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
374 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
375 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
376 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
377 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
378 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
379 };
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 if (editrow >= 0) {
14
d9dfd703df83 Added yeast inventory screens
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
381 $('#jqxgrid').jqxGrid('updaterow', rowID, row);
d9dfd703df83 Added yeast inventory screens
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
382 } 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
383 $('#jqxgrid').jqxGrid('addrow', null, row);
14
d9dfd703df83 Added yeast inventory screens
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
384 }
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
385 $("#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
386 location.reload( true ); // reload ourself.
14
d9dfd703df83 Added yeast inventory screens
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
387 });
d9dfd703df83 Added yeast inventory screens
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
388 createDelElements();
d9dfd703df83 Added yeast inventory screens
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
389 });
d9dfd703df83 Added yeast inventory screens
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
390

mercurial