www/js/inv_yeasts.js

Thu, 17 Oct 2019 16:00:10 +0200

author
Michiel Broek <mbroek@mbse.eu>
date
Thu, 17 Oct 2019 16:00:10 +0200
changeset 515
9d771385a8a0
parent 514
3c680d1dea35
child 528
202272a28052
permissions
-rw-r--r--

Added dried yeast form. Pitch rate for Kveik initially set at 0.25. Dried Kveik cells set to 9000000000 cells/gram.

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 () {
481
fc21dcfbe51d Small code optimize for yeast inventory.
Michiel Broek <mbroek@mbse.eu>
parents: 395
diff changeset
36 $('#delOk').jqxButton({ template: 'danger', width: '65px', theme: theme });
fc21dcfbe51d Small code optimize for yeast inventory.
Michiel Broek <mbroek@mbse.eu>
parents: 395
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
481
fc21dcfbe51d Small code optimize for yeast inventory.
Michiel Broek <mbroek@mbse.eu>
parents: 395
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
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
47 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
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 $('#totval').val(dataRecord.cost * dataRecord.inventory);
515
9d771385a8a0 Added dried yeast form. Pitch rate for Kveik initially set at 0.25. Dried Kveik cells set to 9000000000 cells/gram.
Michiel Broek <mbroek@mbse.eu>
parents: 514
diff changeset
50 if (dataRecord.form == 'Vloeibaar') { // Liquid
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 $("#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
52 $("#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
53 $("#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
54 $("#inventory").jqxNumberInput({ decimalDigits: 0 });
515
9d771385a8a0 Added dried yeast form. Pitch rate for Kveik initially set at 0.25. Dried Kveik cells set to 9000000000 cells/gram.
Michiel Broek <mbroek@mbse.eu>
parents: 514
diff changeset
55 } else if (dataRecord.form == 'Droog' || dataRecord.form == 'Gedroogd') { // Dry
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
56 $("#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
57 $("#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
58 $("#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
59 $("#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
60 } 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
61 $("#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
62 $("#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
63 $("#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
64 $("#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
65 }
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
66 }
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
67
488
77f1617b6994 Fixed inventory databases race conditions
Michiel Broek <mbroek@mbse.eu>
parents: 481
diff changeset
68 var dataRecord = {},
77f1617b6994 Fixed inventory databases race conditions
Michiel Broek <mbroek@mbse.eu>
parents: 481
diff changeset
69 url = 'includes/db_inventory_yeasts.php',
481
fc21dcfbe51d Small code optimize for yeast inventory.
Michiel Broek <mbroek@mbse.eu>
parents: 395
diff changeset
70 source = {
fc21dcfbe51d Small code optimize for yeast inventory.
Michiel Broek <mbroek@mbse.eu>
parents: 395
diff changeset
71 datatype: 'json',
14
d9dfd703df83 Added yeast inventory screens
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
72 cache: false,
d9dfd703df83 Added yeast inventory screens
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
73 datafields: [
d9dfd703df83 Added yeast inventory screens
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
74 { name: 'record', type: 'number' },
d9dfd703df83 Added yeast inventory screens
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
75 { name: 'name', type: 'string' },
514
3c680d1dea35 Added dutch array strings to a global php script. Changed fermentables, hops, yeast and misc inventory scripts to use these strings between the database scripts and javascript scripts. This makes filtering on types strings useable. Added these changes to the product/recipe forum and print exports too.
Michiel Broek <mbroek@mbse.eu>
parents: 512
diff changeset
76 { name: 'type', type: 'string' },
3c680d1dea35 Added dutch array strings to a global php script. Changed fermentables, hops, yeast and misc inventory scripts to use these strings between the database scripts and javascript scripts. This makes filtering on types strings useable. Added these changes to the product/recipe forum and print exports too.
Michiel Broek <mbroek@mbse.eu>
parents: 512
diff changeset
77 { name: 'form', type: 'string' },
14
d9dfd703df83 Added yeast inventory screens
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
78 { name: 'laboratory', type: 'string' },
d9dfd703df83 Added yeast inventory screens
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
79 { 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
80 { 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
81 { 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
82 { name: 'flocculation', type: 'int' },
14
d9dfd703df83 Added yeast inventory screens
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
83 { name: 'attenuation', type: 'float' },
d9dfd703df83 Added yeast inventory screens
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
84 { name: 'notes', type: 'string' },
d9dfd703df83 Added yeast inventory screens
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
85 { 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
86 { name: 'max_reuse', type: 'int' },
14
d9dfd703df83 Added yeast inventory screens
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
87 { name: 'inventory', type: 'float' },
d9dfd703df83 Added yeast inventory screens
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
88 { name: 'cost', type: 'float' },
d9dfd703df83 Added yeast inventory screens
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
89 { 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
90 { name: 'tht_date', type: 'string' },
313
9f45d09c2071 Added alcohol tolerance field in the yeasts database.
Michiel Broek <mbroek@mbse.eu>
parents: 311
diff changeset
91 { name: 'cells', type: 'float' },
512
4451af8b6295 Added new fields in inventory_yeasts for Kveik and extra generic flags. Currently these fields do nothing but adding extra information in the database. Added Brett, Kveik and Hybrid yeast types.
Michiel Broek <mbroek@mbse.eu>
parents: 488
diff changeset
92 { name: 'tolerance', type: 'float' },
4451af8b6295 Added new fields in inventory_yeasts for Kveik and extra generic flags. Currently these fields do nothing but adding extra information in the database. Added Brett, Kveik and Hybrid yeast types.
Michiel Broek <mbroek@mbse.eu>
parents: 488
diff changeset
93 { name: 'sta1', type: 'int' },
4451af8b6295 Added new fields in inventory_yeasts for Kveik and extra generic flags. Currently these fields do nothing but adding extra information in the database. Added Brett, Kveik and Hybrid yeast types.
Michiel Broek <mbroek@mbse.eu>
parents: 488
diff changeset
94 { name: 'bacteria', type: 'int' },
4451af8b6295 Added new fields in inventory_yeasts for Kveik and extra generic flags. Currently these fields do nothing but adding extra information in the database. Added Brett, Kveik and Hybrid yeast types.
Michiel Broek <mbroek@mbse.eu>
parents: 488
diff changeset
95 { name: 'harvest_top', type: 'int' },
4451af8b6295 Added new fields in inventory_yeasts for Kveik and extra generic flags. Currently these fields do nothing but adding extra information in the database. Added Brett, Kveik and Hybrid yeast types.
Michiel Broek <mbroek@mbse.eu>
parents: 488
diff changeset
96 { name: 'harvest_time', type: 'int' },
4451af8b6295 Added new fields in inventory_yeasts for Kveik and extra generic flags. Currently these fields do nothing but adding extra information in the database. Added Brett, Kveik and Hybrid yeast types.
Michiel Broek <mbroek@mbse.eu>
parents: 488
diff changeset
97 { name: 'pitch_temperature', type: 'float' },
4451af8b6295 Added new fields in inventory_yeasts for Kveik and extra generic flags. Currently these fields do nothing but adding extra information in the database. Added Brett, Kveik and Hybrid yeast types.
Michiel Broek <mbroek@mbse.eu>
parents: 488
diff changeset
98 { name: 'pofpos', type: 'int' },
4451af8b6295 Added new fields in inventory_yeasts for Kveik and extra generic flags. Currently these fields do nothing but adding extra information in the database. Added Brett, Kveik and Hybrid yeast types.
Michiel Broek <mbroek@mbse.eu>
parents: 488
diff changeset
99 { name: 'zymocide', type: 'int' }
14
d9dfd703df83 Added yeast inventory screens
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
100 ],
d9dfd703df83 Added yeast inventory screens
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
101 id: 'record',
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 deleterow: function (rowid, commit) {
d9dfd703df83 Added yeast inventory screens
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
104 // synchronize with the server - send delete command
d9dfd703df83 Added yeast inventory screens
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
105 var data = "delete=true&" + $.param({ record: rowid });
d9dfd703df83 Added yeast inventory screens
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
106 $.ajax({
d9dfd703df83 Added yeast inventory screens
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
107 dataType: 'json',
d9dfd703df83 Added yeast inventory screens
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
108 url: url,
d9dfd703df83 Added yeast inventory screens
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
109 cache: false,
d9dfd703df83 Added yeast inventory screens
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
110 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
111 type: "POST",
14
d9dfd703df83 Added yeast inventory screens
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
112 success: function (data, status, xhr) {
d9dfd703df83 Added yeast inventory screens
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
113 commit(true);
488
77f1617b6994 Fixed inventory databases race conditions
Michiel Broek <mbroek@mbse.eu>
parents: 481
diff changeset
114 location.reload( true );
14
d9dfd703df83 Added yeast inventory screens
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
115 },
d9dfd703df83 Added yeast inventory screens
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
116 error: function (jqXHR, textStatus, errorThrown) {
d9dfd703df83 Added yeast inventory screens
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
117 commit(false);
d9dfd703df83 Added yeast inventory screens
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
118 }
d9dfd703df83 Added yeast inventory screens
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
119 });
d9dfd703df83 Added yeast inventory screens
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
120 },
d9dfd703df83 Added yeast inventory screens
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
121 addrow: function (rowid, rowdata, position, commit) {
d9dfd703df83 Added yeast inventory screens
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
122 var data = "insert=true&" + $.param(rowdata);
d9dfd703df83 Added yeast inventory screens
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
123 $.ajax({
d9dfd703df83 Added yeast inventory screens
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
124 dataType: 'json',
d9dfd703df83 Added yeast inventory screens
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
125 url: url,
d9dfd703df83 Added yeast inventory screens
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
126 cache: false,
d9dfd703df83 Added yeast inventory screens
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
127 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
128 type: "POST",
14
d9dfd703df83 Added yeast inventory screens
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
129 success: function (data, status, xhr) {
d9dfd703df83 Added yeast inventory screens
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
130 commit(true);
488
77f1617b6994 Fixed inventory databases race conditions
Michiel Broek <mbroek@mbse.eu>
parents: 481
diff changeset
131 location.reload( true );
14
d9dfd703df83 Added yeast inventory screens
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
132 },
d9dfd703df83 Added yeast inventory screens
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
133 error: function(jqXHR, textStatus, errorThrown) {
d9dfd703df83 Added yeast inventory screens
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
134 commit(false);
d9dfd703df83 Added yeast inventory screens
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
135 }
d9dfd703df83 Added yeast inventory screens
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
136 });
d9dfd703df83 Added yeast inventory screens
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
137 },
d9dfd703df83 Added yeast inventory screens
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
138 updaterow: function (rowid, rowdata, commit) {
d9dfd703df83 Added yeast inventory screens
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
139 var data = "update=true&" + $.param(rowdata);
d9dfd703df83 Added yeast inventory screens
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
140 $.ajax({
d9dfd703df83 Added yeast inventory screens
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
141 dataType: 'json',
d9dfd703df83 Added yeast inventory screens
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
142 url: url,
d9dfd703df83 Added yeast inventory screens
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
143 cache: false,
d9dfd703df83 Added yeast inventory screens
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
144 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
145 type: "POST",
14
d9dfd703df83 Added yeast inventory screens
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
146 success: function (data, status, xhr) {
d9dfd703df83 Added yeast inventory screens
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
147 commit(true);
488
77f1617b6994 Fixed inventory databases race conditions
Michiel Broek <mbroek@mbse.eu>
parents: 481
diff changeset
148 location.reload( true );
14
d9dfd703df83 Added yeast inventory screens
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
149 },
d9dfd703df83 Added yeast inventory screens
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
150 error: function(jqXHR, textStatus, errorThrown) {
d9dfd703df83 Added yeast inventory screens
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
151 commit(false);
d9dfd703df83 Added yeast inventory screens
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
152 }
d9dfd703df83 Added yeast inventory screens
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
153 });
d9dfd703df83 Added yeast inventory screens
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
154 }
488
77f1617b6994 Fixed inventory databases race conditions
Michiel Broek <mbroek@mbse.eu>
parents: 481
diff changeset
155 },
77f1617b6994 Fixed inventory databases race conditions
Michiel Broek <mbroek@mbse.eu>
parents: 481
diff changeset
156 dataAdapter = new $.jqx.dataAdapter(source),
77f1617b6994 Fixed inventory databases race conditions
Michiel Broek <mbroek@mbse.eu>
parents: 481
diff changeset
157 editrow = -1;
77f1617b6994 Fixed inventory databases race conditions
Michiel Broek <mbroek@mbse.eu>
parents: 481
diff changeset
158
14
d9dfd703df83 Added yeast inventory screens
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
159 // 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
160 $("#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
161 $("#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
162 $("#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
163 $("#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
164 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
165 source: YeastTypeAdapter,
514
3c680d1dea35 Added dutch array strings to a global php script. Changed fermentables, hops, yeast and misc inventory scripts to use these strings between the database scripts and javascript scripts. This makes filtering on types strings useable. Added these changes to the product/recipe forum and print exports too.
Michiel Broek <mbroek@mbse.eu>
parents: 512
diff changeset
166 valueMember: 'nl',
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
167 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
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 $("#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
173 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
174 source: YeastFormAdapter,
514
3c680d1dea35 Added dutch array strings to a global php script. Changed fermentables, hops, yeast and misc inventory scripts to use these strings between the database scripts and javascript scripts. This makes filtering on types strings useable. Added these changes to the product/recipe forum and print exports too.
Michiel Broek <mbroek@mbse.eu>
parents: 512
diff changeset
175 valueMember: 'nl',
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
176 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
177 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
178 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
179 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
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
181 $("#notes").jqxInput({ theme: theme, width: 800, height: 120 });
313
9f45d09c2071 Added alcohol tolerance field in the yeasts database.
Michiel Broek <mbroek@mbse.eu>
parents: 311
diff changeset
182 $("#best_for").jqxInput({ theme: theme, width: 320, height: 100 });
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
183 $("#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
184 $("#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
185 $("#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
186 $("#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
187 $("#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
188 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
189 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
190 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
191 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
192 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
193 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
194 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
195 });
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
196 $("#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
197 $("#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
198 $("#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
199 $("#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
200 $("#tht_date").jqxDateTimeInput( Dateopts );
269
25696a91b395 Code cleanup
Michiel Broek <mbroek@mbse.eu>
parents: 245
diff changeset
201 $("#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
202 $("#cells").jqxNumberInput( Spin1dec );
313
9f45d09c2071 Added alcohol tolerance field in the yeasts database.
Michiel Broek <mbroek@mbse.eu>
parents: 311
diff changeset
203 $("#tolerance").jqxNumberInput( Perc1dec );
9f45d09c2071 Added alcohol tolerance field in the yeasts database.
Michiel Broek <mbroek@mbse.eu>
parents: 311
diff changeset
204 $("#tolerance").jqxNumberInput({ max: 25 });
512
4451af8b6295 Added new fields in inventory_yeasts for Kveik and extra generic flags. Currently these fields do nothing but adding extra information in the database. Added Brett, Kveik and Hybrid yeast types.
Michiel Broek <mbroek@mbse.eu>
parents: 488
diff changeset
205 $('#sta1').jqxCheckBox({ theme: theme, width: 120, height: 23 });
4451af8b6295 Added new fields in inventory_yeasts for Kveik and extra generic flags. Currently these fields do nothing but adding extra information in the database. Added Brett, Kveik and Hybrid yeast types.
Michiel Broek <mbroek@mbse.eu>
parents: 488
diff changeset
206 $('#sta1').on('checked', function(event) { dataRecord.sta1 = 1; });
4451af8b6295 Added new fields in inventory_yeasts for Kveik and extra generic flags. Currently these fields do nothing but adding extra information in the database. Added Brett, Kveik and Hybrid yeast types.
Michiel Broek <mbroek@mbse.eu>
parents: 488
diff changeset
207 $('#sta1').on('unchecked', function(event) { dataRecord.sta1 = 0; });
4451af8b6295 Added new fields in inventory_yeasts for Kveik and extra generic flags. Currently these fields do nothing but adding extra information in the database. Added Brett, Kveik and Hybrid yeast types.
Michiel Broek <mbroek@mbse.eu>
parents: 488
diff changeset
208 $('#bacteria').jqxCheckBox({ theme: theme, width: 120, height: 23 });
4451af8b6295 Added new fields in inventory_yeasts for Kveik and extra generic flags. Currently these fields do nothing but adding extra information in the database. Added Brett, Kveik and Hybrid yeast types.
Michiel Broek <mbroek@mbse.eu>
parents: 488
diff changeset
209 $('#bacteria').on('checked', function(event) { dataRecord.bacteria = 1; });
4451af8b6295 Added new fields in inventory_yeasts for Kveik and extra generic flags. Currently these fields do nothing but adding extra information in the database. Added Brett, Kveik and Hybrid yeast types.
Michiel Broek <mbroek@mbse.eu>
parents: 488
diff changeset
210 $('#bacteria').on('unchecked', function(event) { dataRecord.bacteria = 0; });
4451af8b6295 Added new fields in inventory_yeasts for Kveik and extra generic flags. Currently these fields do nothing but adding extra information in the database. Added Brett, Kveik and Hybrid yeast types.
Michiel Broek <mbroek@mbse.eu>
parents: 488
diff changeset
211 $('#harvest_top').jqxCheckBox({ theme: theme, width: 120, height: 23 });
4451af8b6295 Added new fields in inventory_yeasts for Kveik and extra generic flags. Currently these fields do nothing but adding extra information in the database. Added Brett, Kveik and Hybrid yeast types.
Michiel Broek <mbroek@mbse.eu>
parents: 488
diff changeset
212 $('#harvest_top').on('checked', function(event) { dataRecord.harvest_top = 1; });
4451af8b6295 Added new fields in inventory_yeasts for Kveik and extra generic flags. Currently these fields do nothing but adding extra information in the database. Added Brett, Kveik and Hybrid yeast types.
Michiel Broek <mbroek@mbse.eu>
parents: 488
diff changeset
213 $('#harvest_top').on('unchecked', function(event) { dataRecord.harvest_top = 0; });
4451af8b6295 Added new fields in inventory_yeasts for Kveik and extra generic flags. Currently these fields do nothing but adding extra information in the database. Added Brett, Kveik and Hybrid yeast types.
Michiel Broek <mbroek@mbse.eu>
parents: 488
diff changeset
214 $('#harvest_time').jqxNumberInput( PosInt );
4451af8b6295 Added new fields in inventory_yeasts for Kveik and extra generic flags. Currently these fields do nothing but adding extra information in the database. Added Brett, Kveik and Hybrid yeast types.
Michiel Broek <mbroek@mbse.eu>
parents: 488
diff changeset
215 $("#pitch_temperature").jqxNumberInput( YeastT );
4451af8b6295 Added new fields in inventory_yeasts for Kveik and extra generic flags. Currently these fields do nothing but adding extra information in the database. Added Brett, Kveik and Hybrid yeast types.
Michiel Broek <mbroek@mbse.eu>
parents: 488
diff changeset
216 $('#pofpos').jqxCheckBox({ theme: theme, width: 120, height: 23 });
4451af8b6295 Added new fields in inventory_yeasts for Kveik and extra generic flags. Currently these fields do nothing but adding extra information in the database. Added Brett, Kveik and Hybrid yeast types.
Michiel Broek <mbroek@mbse.eu>
parents: 488
diff changeset
217 $('#pofpos').on('checked', function(event) { dataRecord.pofpos = 1; });
4451af8b6295 Added new fields in inventory_yeasts for Kveik and extra generic flags. Currently these fields do nothing but adding extra information in the database. Added Brett, Kveik and Hybrid yeast types.
Michiel Broek <mbroek@mbse.eu>
parents: 488
diff changeset
218 $('#pofpos').on('unchecked', function(event) { dataRecord.pofpos = 0; });
4451af8b6295 Added new fields in inventory_yeasts for Kveik and extra generic flags. Currently these fields do nothing but adding extra information in the database. Added Brett, Kveik and Hybrid yeast types.
Michiel Broek <mbroek@mbse.eu>
parents: 488
diff changeset
219 $("#zymocide").jqxDropDownList({
4451af8b6295 Added new fields in inventory_yeasts for Kveik and extra generic flags. Currently these fields do nothing but adding extra information in the database. Added Brett, Kveik and Hybrid yeast types.
Michiel Broek <mbroek@mbse.eu>
parents: 488
diff changeset
220 theme: theme,
4451af8b6295 Added new fields in inventory_yeasts for Kveik and extra generic flags. Currently these fields do nothing but adding extra information in the database. Added Brett, Kveik and Hybrid yeast types.
Michiel Broek <mbroek@mbse.eu>
parents: 488
diff changeset
221 source: ZymocideAdapter,
4451af8b6295 Added new fields in inventory_yeasts for Kveik and extra generic flags. Currently these fields do nothing but adding extra information in the database. Added Brett, Kveik and Hybrid yeast types.
Michiel Broek <mbroek@mbse.eu>
parents: 488
diff changeset
222 valueMember: 'id',
4451af8b6295 Added new fields in inventory_yeasts for Kveik and extra generic flags. Currently these fields do nothing but adding extra information in the database. Added Brett, Kveik and Hybrid yeast types.
Michiel Broek <mbroek@mbse.eu>
parents: 488
diff changeset
223 displayMember: 'nl',
4451af8b6295 Added new fields in inventory_yeasts for Kveik and extra generic flags. Currently these fields do nothing but adding extra information in the database. Added Brett, Kveik and Hybrid yeast types.
Michiel Broek <mbroek@mbse.eu>
parents: 488
diff changeset
224 width: 80,
4451af8b6295 Added new fields in inventory_yeasts for Kveik and extra generic flags. Currently these fields do nothing but adding extra information in the database. Added Brett, Kveik and Hybrid yeast types.
Michiel Broek <mbroek@mbse.eu>
parents: 488
diff changeset
225 height: 23,
4451af8b6295 Added new fields in inventory_yeasts for Kveik and extra generic flags. Currently these fields do nothing but adding extra information in the database. Added Brett, Kveik and Hybrid yeast types.
Michiel Broek <mbroek@mbse.eu>
parents: 488
diff changeset
226 autoDropDownHeight: true
4451af8b6295 Added new fields in inventory_yeasts for Kveik and extra generic flags. Currently these fields do nothing but adding extra information in the database. Added Brett, Kveik and Hybrid yeast types.
Michiel Broek <mbroek@mbse.eu>
parents: 488
diff changeset
227 });
14
d9dfd703df83 Added yeast inventory screens
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
228
d9dfd703df83 Added yeast inventory screens
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
229 // initialize jqxGrid
d9dfd703df83 Added yeast inventory screens
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
230 $("#jqxgrid").jqxGrid({
d9dfd703df83 Added yeast inventory screens
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
231 width: 1280,
d9dfd703df83 Added yeast inventory screens
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
232 height: 630,
d9dfd703df83 Added yeast inventory screens
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
233 source: dataAdapter,
d9dfd703df83 Added yeast inventory screens
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
234 theme: theme,
d9dfd703df83 Added yeast inventory screens
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
235 showstatusbar: true,
481
fc21dcfbe51d Small code optimize for yeast inventory.
Michiel Broek <mbroek@mbse.eu>
parents: 395
diff changeset
236 renderstatusbar: function(statusbar) {
fc21dcfbe51d Small code optimize for yeast inventory.
Michiel Broek <mbroek@mbse.eu>
parents: 395
diff changeset
237 var container, addButton, impButton;
fc21dcfbe51d Small code optimize for yeast inventory.
Michiel Broek <mbroek@mbse.eu>
parents: 395
diff changeset
238 container = $("<div style='overflow: hidden; position: relative; margin: 5px;'></div>");
fc21dcfbe51d Small code optimize for yeast inventory.
Michiel Broek <mbroek@mbse.eu>
parents: 395
diff changeset
239 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>");
fc21dcfbe51d Small code optimize for yeast inventory.
Michiel Broek <mbroek@mbse.eu>
parents: 395
diff changeset
240 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
241 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
242 container.append(impButton);
14
d9dfd703df83 Added yeast inventory screens
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
243 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
244 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
245 impButton.jqxButton({ theme: theme, width: 90, height: 20 });
14
d9dfd703df83 Added yeast inventory screens
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
246 // add new row.
d9dfd703df83 Added yeast inventory screens
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
247 addButton.click(function (event) {
d9dfd703df83 Added yeast inventory screens
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
248 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
249 $("#popupWindow").jqxWindow({ position: { x: 110, y: 30 } });
14
d9dfd703df83 Added yeast inventory screens
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
250 $("#name").val('');
d9dfd703df83 Added yeast inventory screens
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
251 $("#laboratory").val('');
d9dfd703df83 Added yeast inventory screens
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
252 $("#product_id").val('');
514
3c680d1dea35 Added dutch array strings to a global php script. Changed fermentables, hops, yeast and misc inventory scripts to use these strings between the database scripts and javascript scripts. This makes filtering on types strings useable. Added these changes to the product/recipe forum and print exports too.
Michiel Broek <mbroek@mbse.eu>
parents: 512
diff changeset
253 $("#type").val('Bovengist');
3c680d1dea35 Added dutch array strings to a global php script. Changed fermentables, hops, yeast and misc inventory scripts to use these strings between the database scripts and javascript scripts. This makes filtering on types strings useable. Added these changes to the product/recipe forum and print exports too.
Michiel Broek <mbroek@mbse.eu>
parents: 512
diff changeset
254 $("#form").val('Vloeibaar');
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
255 $("#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
256 $("#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
257 $("#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
258 $("#attenuation").val(77);
14
d9dfd703df83 Added yeast inventory screens
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
259 $("#notes").val('');
d9dfd703df83 Added yeast inventory screens
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
260 $("#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
261 $("#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
262 $("#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
263 $("#cost").val(0);
14
d9dfd703df83 Added yeast inventory screens
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
264 $("#production_date").val('');
d9dfd703df83 Added yeast inventory screens
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
265 $("#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
266 $("#cells").val(1);
313
9f45d09c2071 Added alcohol tolerance field in the yeasts database.
Michiel Broek <mbroek@mbse.eu>
parents: 311
diff changeset
267 $("#tolerance").val(0);
512
4451af8b6295 Added new fields in inventory_yeasts for Kveik and extra generic flags. Currently these fields do nothing but adding extra information in the database. Added Brett, Kveik and Hybrid yeast types.
Michiel Broek <mbroek@mbse.eu>
parents: 488
diff changeset
268 $("#sta1").val(0);
4451af8b6295 Added new fields in inventory_yeasts for Kveik and extra generic flags. Currently these fields do nothing but adding extra information in the database. Added Brett, Kveik and Hybrid yeast types.
Michiel Broek <mbroek@mbse.eu>
parents: 488
diff changeset
269 $("#bacteria").val(0);
4451af8b6295 Added new fields in inventory_yeasts for Kveik and extra generic flags. Currently these fields do nothing but adding extra information in the database. Added Brett, Kveik and Hybrid yeast types.
Michiel Broek <mbroek@mbse.eu>
parents: 488
diff changeset
270 $("#harvest_top").val(0);
4451af8b6295 Added new fields in inventory_yeasts for Kveik and extra generic flags. Currently these fields do nothing but adding extra information in the database. Added Brett, Kveik and Hybrid yeast types.
Michiel Broek <mbroek@mbse.eu>
parents: 488
diff changeset
271 $("#harvest_time").val(0);
514
3c680d1dea35 Added dutch array strings to a global php script. Changed fermentables, hops, yeast and misc inventory scripts to use these strings between the database scripts and javascript scripts. This makes filtering on types strings useable. Added these changes to the product/recipe forum and print exports too.
Michiel Broek <mbroek@mbse.eu>
parents: 512
diff changeset
272 $("#pitch_temperature").val(0);
512
4451af8b6295 Added new fields in inventory_yeasts for Kveik and extra generic flags. Currently these fields do nothing but adding extra information in the database. Added Brett, Kveik and Hybrid yeast types.
Michiel Broek <mbroek@mbse.eu>
parents: 488
diff changeset
273 $("#pofpos").val(0);
4451af8b6295 Added new fields in inventory_yeasts for Kveik and extra generic flags. Currently these fields do nothing but adding extra information in the database. Added Brett, Kveik and Hybrid yeast types.
Michiel Broek <mbroek@mbse.eu>
parents: 488
diff changeset
274 $("#zymocide").val(0);
14
d9dfd703df83 Added yeast inventory screens
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
275 $("#popupWindow").jqxWindow('open');
d9dfd703df83 Added yeast inventory screens
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
276 });
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
277 impButton.click(function (event) {
481
fc21dcfbe51d Small code optimize for yeast inventory.
Michiel Broek <mbroek@mbse.eu>
parents: 395
diff changeset
278 window.location.href = 'import_ingredients.php?select=yeasts';
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
279 });
14
d9dfd703df83 Added yeast inventory screens
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
280 },
d9dfd703df83 Added yeast inventory screens
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
281 filterable: true,
d9dfd703df83 Added yeast inventory screens
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
282 filtermode: 'excel',
d9dfd703df83 Added yeast inventory screens
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
283 columns: [
d9dfd703df83 Added yeast inventory screens
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
284 { 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
285 { 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
286 { text: 'Gist naam', datafield: 'name', menu: false },
514
3c680d1dea35 Added dutch array strings to a global php script. Changed fermentables, hops, yeast and misc inventory scripts to use these strings between the database scripts and javascript scripts. This makes filtering on types strings useable. Added these changes to the product/recipe forum and print exports too.
Michiel Broek <mbroek@mbse.eu>
parents: 512
diff changeset
287 { text: 'Type', datafield: 'type', align: 'center', cellsalign: 'center', width: 110 },
3c680d1dea35 Added dutch array strings to a global php script. Changed fermentables, hops, yeast and misc inventory scripts to use these strings between the database scripts and javascript scripts. This makes filtering on types strings useable. Added these changes to the product/recipe forum and print exports too.
Michiel Broek <mbroek@mbse.eu>
parents: 512
diff changeset
288 { text: 'Vorm', datafield: 'form', align: 'center', cellsalign: 'center', width: 110 },
313
9f45d09c2071 Added alcohol tolerance field in the yeasts database.
Michiel Broek <mbroek@mbse.eu>
parents: 311
diff changeset
289 { text: 'SVG', datafield: 'attenuation', width: 70, align: 'right', cellsalign: 'right', menu: false, cellsformat: 'p1' },
9f45d09c2071 Added alcohol tolerance field in the yeasts database.
Michiel Broek <mbroek@mbse.eu>
parents: 311
diff changeset
290 { text: 'Tol%', datafield: 'tolerance', width: 60, align: 'right', cellsalign: 'right', menu: false,
9f45d09c2071 Added alcohol tolerance field in the yeasts database.
Michiel Broek <mbroek@mbse.eu>
parents: 311
diff changeset
291 cellsrenderer: function (index, datafield, value, defaultvalue, column, rowdata) {
9f45d09c2071 Added alcohol tolerance field in the yeasts database.
Michiel Broek <mbroek@mbse.eu>
parents: 311
diff changeset
292 var amount = "";
9f45d09c2071 Added alcohol tolerance field in the yeasts database.
Michiel Broek <mbroek@mbse.eu>
parents: 311
diff changeset
293 if (value > 0)
9f45d09c2071 Added alcohol tolerance field in the yeasts database.
Michiel Broek <mbroek@mbse.eu>
parents: 311
diff changeset
294 amount = dataAdapter.formatNumber(value, "p0");
9f45d09c2071 Added alcohol tolerance field in the yeasts database.
Michiel Broek <mbroek@mbse.eu>
parents: 311
diff changeset
295 return '<span style="margin: 4px; margin-top: 6px; float: right;">' + amount + '</span>';
9f45d09c2071 Added alcohol tolerance field in the yeasts database.
Michiel Broek <mbroek@mbse.eu>
parents: 311
diff changeset
296 }
9f45d09c2071 Added alcohol tolerance field in the yeasts database.
Michiel Broek <mbroek@mbse.eu>
parents: 311
diff changeset
297 },
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
298 { 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
299 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
300 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
301 if (value > 0) {
514
3c680d1dea35 Added dutch array strings to a global php script. Changed fermentables, hops, yeast and misc inventory scripts to use these strings between the database scripts and javascript scripts. This makes filtering on types strings useable. Added these changes to the product/recipe forum and print exports too.
Michiel Broek <mbroek@mbse.eu>
parents: 512
diff changeset
302 if ((rowdata.form == 'Vloeibaar') && (value > 1))
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
303 amount = dataAdapter.formatNumber(value,"f0")+" pakken";
514
3c680d1dea35 Added dutch array strings to a global php script. Changed fermentables, hops, yeast and misc inventory scripts to use these strings between the database scripts and javascript scripts. This makes filtering on types strings useable. Added these changes to the product/recipe forum and print exports too.
Michiel Broek <mbroek@mbse.eu>
parents: 512
diff changeset
304 else if (rowdata.form == 'Vloeibaar')
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
305 amount = dataAdapter.formatNumber(value,"f0")+" pak";
515
9d771385a8a0 Added dried yeast form. Pitch rate for Kveik initially set at 0.25. Dried Kveik cells set to 9000000000 cells/gram.
Michiel Broek <mbroek@mbse.eu>
parents: 514
diff changeset
306 else if (rowdata.form == 'Droog' || rowdata.form == 'Gedroogd')
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
307 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
308 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
309 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
310 }
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
311 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
312 }
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 },
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
314 { 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
315 return "Wijzig";
14
d9dfd703df83 Added yeast inventory screens
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
316 }, buttonclick: function (row) {
d9dfd703df83 Added yeast inventory screens
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
317 // open the popup window when the user clicks a button.
d9dfd703df83 Added yeast inventory screens
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
318 editrow = row;
512
4451af8b6295 Added new fields in inventory_yeasts for Kveik and extra generic flags. Currently these fields do nothing but adding extra information in the database. Added Brett, Kveik and Hybrid yeast types.
Michiel Broek <mbroek@mbse.eu>
parents: 488
diff changeset
319 $("#popupWindow").jqxWindow({ position: { x: 110, y: 15 } });
14
d9dfd703df83 Added yeast inventory screens
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
320 // 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
321 dataRecord = $("#jqxgrid").jqxGrid('getrowdata', editrow);
14
d9dfd703df83 Added yeast inventory screens
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
322 $("#name").val(dataRecord.name);
d9dfd703df83 Added yeast inventory screens
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
323 $("#laboratory").val(dataRecord.laboratory);
d9dfd703df83 Added yeast inventory screens
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
324 $("#product_id").val(dataRecord.product_id);
d9dfd703df83 Added yeast inventory screens
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
325 $("#type").val(dataRecord.type);
d9dfd703df83 Added yeast inventory screens
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
326 $("#form").val(dataRecord.form);
512
4451af8b6295 Added new fields in inventory_yeasts for Kveik and extra generic flags. Currently these fields do nothing but adding extra information in the database. Added Brett, Kveik and Hybrid yeast types.
Michiel Broek <mbroek@mbse.eu>
parents: 488
diff changeset
327 $("#min_temperature").val(parseFloat(dataRecord.min_temperature));
4451af8b6295 Added new fields in inventory_yeasts for Kveik and extra generic flags. Currently these fields do nothing but adding extra information in the database. Added Brett, Kveik and Hybrid yeast types.
Michiel Broek <mbroek@mbse.eu>
parents: 488
diff changeset
328 $("#max_temperature").val(parseFloat(dataRecord.max_temperature));
14
d9dfd703df83 Added yeast inventory screens
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
329 $("#flocculation").val(dataRecord.flocculation);
d9dfd703df83 Added yeast inventory screens
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
330 $("#attenuation").val(dataRecord.attenuation);
d9dfd703df83 Added yeast inventory screens
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
331 $("#notes").val(dataRecord.notes);
d9dfd703df83 Added yeast inventory screens
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
332 $("#best_for").val(dataRecord.best_for);
d9dfd703df83 Added yeast inventory screens
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
333 $("#max_reuse").val(dataRecord.max_reuse);
514
3c680d1dea35 Added dutch array strings to a global php script. Changed fermentables, hops, yeast and misc inventory scripts to use these strings between the database scripts and javascript scripts. This makes filtering on types strings useable. Added these changes to the product/recipe forum and print exports too.
Michiel Broek <mbroek@mbse.eu>
parents: 512
diff changeset
334 if (dataRecord.form == 'Vloeibaar')
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
335 $("#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
336 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
337 $("#inventory").val(dataRecord.inventory * 1000);
14
d9dfd703df83 Added yeast inventory screens
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
338 $("#cost").val(dataRecord.cost);
d9dfd703df83 Added yeast inventory screens
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
339 $("#production_date").val(dataRecord.production_date);
d9dfd703df83 Added yeast inventory screens
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
340 $("#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
341 $("#cells").val(dataRecord.cells);
313
9f45d09c2071 Added alcohol tolerance field in the yeasts database.
Michiel Broek <mbroek@mbse.eu>
parents: 311
diff changeset
342 $("#tolerance").val(dataRecord.tolerance);
512
4451af8b6295 Added new fields in inventory_yeasts for Kveik and extra generic flags. Currently these fields do nothing but adding extra information in the database. Added Brett, Kveik and Hybrid yeast types.
Michiel Broek <mbroek@mbse.eu>
parents: 488
diff changeset
343 $("#sta1").val(dataRecord.sta1);
4451af8b6295 Added new fields in inventory_yeasts for Kveik and extra generic flags. Currently these fields do nothing but adding extra information in the database. Added Brett, Kveik and Hybrid yeast types.
Michiel Broek <mbroek@mbse.eu>
parents: 488
diff changeset
344 $("#bacteria").val(dataRecord.bacteria);
4451af8b6295 Added new fields in inventory_yeasts for Kveik and extra generic flags. Currently these fields do nothing but adding extra information in the database. Added Brett, Kveik and Hybrid yeast types.
Michiel Broek <mbroek@mbse.eu>
parents: 488
diff changeset
345 $("#harvest_top").val(dataRecord.harvest_top);
4451af8b6295 Added new fields in inventory_yeasts for Kveik and extra generic flags. Currently these fields do nothing but adding extra information in the database. Added Brett, Kveik and Hybrid yeast types.
Michiel Broek <mbroek@mbse.eu>
parents: 488
diff changeset
346 $("#harvest_time").val(dataRecord.harvest_time);
4451af8b6295 Added new fields in inventory_yeasts for Kveik and extra generic flags. Currently these fields do nothing but adding extra information in the database. Added Brett, Kveik and Hybrid yeast types.
Michiel Broek <mbroek@mbse.eu>
parents: 488
diff changeset
347 $("#pitch_temperature").val(parseFloat(dataRecord.pitch_temperature));
4451af8b6295 Added new fields in inventory_yeasts for Kveik and extra generic flags. Currently these fields do nothing but adding extra information in the database. Added Brett, Kveik and Hybrid yeast types.
Michiel Broek <mbroek@mbse.eu>
parents: 488
diff changeset
348 $("#pofpos").val(dataRecord.pofpos);
4451af8b6295 Added new fields in inventory_yeasts for Kveik and extra generic flags. Currently these fields do nothing but adding extra information in the database. Added Brett, Kveik and Hybrid yeast types.
Michiel Broek <mbroek@mbse.eu>
parents: 488
diff changeset
349 $("#zymocide").val(dataRecord.zymocide);
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
350 calcTotal();
14
d9dfd703df83 Added yeast inventory screens
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
351 // show the popup window.
d9dfd703df83 Added yeast inventory screens
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
352 $("#popupWindow").jqxWindow('open');
d9dfd703df83 Added yeast inventory screens
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
353 }
d9dfd703df83 Added yeast inventory screens
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
354 }
d9dfd703df83 Added yeast inventory screens
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
355 ]
d9dfd703df83 Added yeast inventory screens
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
356 });
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
357
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
358 $('#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
359 $("#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
360 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
361 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
362 });
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 $("#inventory").on('change', function (event) {
514
3c680d1dea35 Added dutch array strings to a global php script. Changed fermentables, hops, yeast and misc inventory scripts to use these strings between the database scripts and javascript scripts. This makes filtering on types strings useable. Added these changes to the product/recipe forum and print exports too.
Michiel Broek <mbroek@mbse.eu>
parents: 512
diff changeset
364 if (dataRecord.form == 'Vloeibaar')
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
365 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
366 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
367 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
368 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
369 });
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
370 $("#form").on('select', function (event) {
514
3c680d1dea35 Added dutch array strings to a global php script. Changed fermentables, hops, yeast and misc inventory scripts to use these strings between the database scripts and javascript scripts. This makes filtering on types strings useable. Added these changes to the product/recipe forum and print exports too.
Michiel Broek <mbroek@mbse.eu>
parents: 512
diff changeset
371 dataRecord.form = $("#form").val();
3c680d1dea35 Added dutch array strings to a global php script. Changed fermentables, hops, yeast and misc inventory scripts to use these strings between the database scripts and javascript scripts. This makes filtering on types strings useable. Added these changes to the product/recipe forum and print exports too.
Michiel Broek <mbroek@mbse.eu>
parents: 512
diff changeset
372 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
373 });
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
14
d9dfd703df83 Added yeast inventory screens
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
375 // initialize the popup window and buttons.
d9dfd703df83 Added yeast inventory screens
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
376 $("#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
377 width: 1050,
512
4451af8b6295 Added new fields in inventory_yeasts for Kveik and extra generic flags. Currently these fields do nothing but adding extra information in the database. Added Brett, Kveik and Hybrid yeast types.
Michiel Broek <mbroek@mbse.eu>
parents: 488
diff changeset
378 height: 625,
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 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
380 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
381 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
382 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
383 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
384 modalOpacity: 0.40
14
d9dfd703df83 Added yeast inventory screens
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
385 });
d9dfd703df83 Added yeast inventory screens
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
386 $("#popupWindow").on('open', function () {
d9dfd703df83 Added yeast inventory screens
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
387 $("#name").jqxInput('selectAll');
d9dfd703df83 Added yeast inventory screens
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
388 });
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
389 $("#Delete").jqxButton({ template: "danger", width: '90px', theme: theme });
481
fc21dcfbe51d Small code optimize for yeast inventory.
Michiel Broek <mbroek@mbse.eu>
parents: 395
diff changeset
390 $("#Delete").click(function() {
14
d9dfd703df83 Added yeast inventory screens
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
391 if (editrow >= 0) {
d9dfd703df83 Added yeast inventory screens
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
392 // Open a popup to confirm this action.
d9dfd703df83 Added yeast inventory screens
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
393 $('#eventWindow').jqxWindow('open');
d9dfd703df83 Added yeast inventory screens
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
394 $("#delOk").click(function () {
d9dfd703df83 Added yeast inventory screens
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
395 var rowID = $('#jqxgrid').jqxGrid('getrowid', editrow);
d9dfd703df83 Added yeast inventory screens
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
396 $("#jqxgrid").jqxGrid('deleterow', rowID);
d9dfd703df83 Added yeast inventory screens
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
397 });
d9dfd703df83 Added yeast inventory screens
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
398 }
d9dfd703df83 Added yeast inventory screens
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
399 $("#popupWindow").jqxWindow('hide');
d9dfd703df83 Added yeast inventory screens
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
400 });
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
401 $("#Cancel").jqxButton({ template: "primary", width: '90px', theme: theme });
314
f943efa07d9f Added yeast duplicate button
Michiel Broek <mbroek@mbse.eu>
parents: 313
diff changeset
402 $("#Clone").jqxButton({ template: "warning", width: '90px', theme: theme });
481
fc21dcfbe51d Small code optimize for yeast inventory.
Michiel Broek <mbroek@mbse.eu>
parents: 395
diff changeset
403 $("#Clone").click(function() {
314
f943efa07d9f Added yeast duplicate button
Michiel Broek <mbroek@mbse.eu>
parents: 313
diff changeset
404 var row = {
f943efa07d9f Added yeast duplicate button
Michiel Broek <mbroek@mbse.eu>
parents: 313
diff changeset
405 record: -1,
f943efa07d9f Added yeast duplicate button
Michiel Broek <mbroek@mbse.eu>
parents: 313
diff changeset
406 name: $("#name").val()+" kopie",
f943efa07d9f Added yeast duplicate button
Michiel Broek <mbroek@mbse.eu>
parents: 313
diff changeset
407 type: $("#type").val(),
f943efa07d9f Added yeast duplicate button
Michiel Broek <mbroek@mbse.eu>
parents: 313
diff changeset
408 form: $("#form").val(),
f943efa07d9f Added yeast duplicate button
Michiel Broek <mbroek@mbse.eu>
parents: 313
diff changeset
409 laboratory: $("#laboratory").val(),
f943efa07d9f Added yeast duplicate button
Michiel Broek <mbroek@mbse.eu>
parents: 313
diff changeset
410 product_id: $("#product_id").val(),
512
4451af8b6295 Added new fields in inventory_yeasts for Kveik and extra generic flags. Currently these fields do nothing but adding extra information in the database. Added Brett, Kveik and Hybrid yeast types.
Michiel Broek <mbroek@mbse.eu>
parents: 488
diff changeset
411 min_temperature: parseFloat($("#min_temperature").jqxNumberInput('decimal')),
4451af8b6295 Added new fields in inventory_yeasts for Kveik and extra generic flags. Currently these fields do nothing but adding extra information in the database. Added Brett, Kveik and Hybrid yeast types.
Michiel Broek <mbroek@mbse.eu>
parents: 488
diff changeset
412 max_temperature: parseFloat($("#max_temperature").jqxNumberInput('decimal')),
314
f943efa07d9f Added yeast duplicate button
Michiel Broek <mbroek@mbse.eu>
parents: 313
diff changeset
413 flocculation: $("#flocculation").val(),
f943efa07d9f Added yeast duplicate button
Michiel Broek <mbroek@mbse.eu>
parents: 313
diff changeset
414 attenuation: parseFloat($("#attenuation").jqxNumberInput('decimal')),
f943efa07d9f Added yeast duplicate button
Michiel Broek <mbroek@mbse.eu>
parents: 313
diff changeset
415 notes: $("#notes").val(),
f943efa07d9f Added yeast duplicate button
Michiel Broek <mbroek@mbse.eu>
parents: 313
diff changeset
416 best_for: $("#best_for").val(),
f943efa07d9f Added yeast duplicate button
Michiel Broek <mbroek@mbse.eu>
parents: 313
diff changeset
417 max_reuse: parseInt($("#max_reuse").jqxNumberInput('decimal')),
f943efa07d9f Added yeast duplicate button
Michiel Broek <mbroek@mbse.eu>
parents: 313
diff changeset
418 inventory: 0,
f943efa07d9f Added yeast duplicate button
Michiel Broek <mbroek@mbse.eu>
parents: 313
diff changeset
419 cost: parseFloat($("#cost").jqxNumberInput('decimal')),
f943efa07d9f Added yeast duplicate button
Michiel Broek <mbroek@mbse.eu>
parents: 313
diff changeset
420 production_date: '',
f943efa07d9f Added yeast duplicate button
Michiel Broek <mbroek@mbse.eu>
parents: 313
diff changeset
421 tht_date: '',
f943efa07d9f Added yeast duplicate button
Michiel Broek <mbroek@mbse.eu>
parents: 313
diff changeset
422 cells: parseFloat($("#cells").jqxNumberInput('decimal')),
512
4451af8b6295 Added new fields in inventory_yeasts for Kveik and extra generic flags. Currently these fields do nothing but adding extra information in the database. Added Brett, Kveik and Hybrid yeast types.
Michiel Broek <mbroek@mbse.eu>
parents: 488
diff changeset
423 tolerance: parseFloat($("#tolerance").jqxNumberInput('decimal')),
4451af8b6295 Added new fields in inventory_yeasts for Kveik and extra generic flags. Currently these fields do nothing but adding extra information in the database. Added Brett, Kveik and Hybrid yeast types.
Michiel Broek <mbroek@mbse.eu>
parents: 488
diff changeset
424 sta1: $("#sta1").val(),
4451af8b6295 Added new fields in inventory_yeasts for Kveik and extra generic flags. Currently these fields do nothing but adding extra information in the database. Added Brett, Kveik and Hybrid yeast types.
Michiel Broek <mbroek@mbse.eu>
parents: 488
diff changeset
425 bacteria: $("#bacteria").val(),
4451af8b6295 Added new fields in inventory_yeasts for Kveik and extra generic flags. Currently these fields do nothing but adding extra information in the database. Added Brett, Kveik and Hybrid yeast types.
Michiel Broek <mbroek@mbse.eu>
parents: 488
diff changeset
426 harvest_top: $("#harvest_top").val(),
4451af8b6295 Added new fields in inventory_yeasts for Kveik and extra generic flags. Currently these fields do nothing but adding extra information in the database. Added Brett, Kveik and Hybrid yeast types.
Michiel Broek <mbroek@mbse.eu>
parents: 488
diff changeset
427 harvest_time: $("#harvest_time").val(),
4451af8b6295 Added new fields in inventory_yeasts for Kveik and extra generic flags. Currently these fields do nothing but adding extra information in the database. Added Brett, Kveik and Hybrid yeast types.
Michiel Broek <mbroek@mbse.eu>
parents: 488
diff changeset
428 pitch_temperature: parseFloat($("#pitch_temperature").jqxNumberInput('decimal')),
4451af8b6295 Added new fields in inventory_yeasts for Kveik and extra generic flags. Currently these fields do nothing but adding extra information in the database. Added Brett, Kveik and Hybrid yeast types.
Michiel Broek <mbroek@mbse.eu>
parents: 488
diff changeset
429 pofpos: $("#pofpos").val(),
4451af8b6295 Added new fields in inventory_yeasts for Kveik and extra generic flags. Currently these fields do nothing but adding extra information in the database. Added Brett, Kveik and Hybrid yeast types.
Michiel Broek <mbroek@mbse.eu>
parents: 488
diff changeset
430 zymocide: $("#zymocide").val()
314
f943efa07d9f Added yeast duplicate button
Michiel Broek <mbroek@mbse.eu>
parents: 313
diff changeset
431 };
f943efa07d9f Added yeast duplicate button
Michiel Broek <mbroek@mbse.eu>
parents: 313
diff changeset
432 $('#jqxgrid').jqxGrid('addrow', null, row);
f943efa07d9f Added yeast duplicate button
Michiel Broek <mbroek@mbse.eu>
parents: 313
diff changeset
433 $("#popupWindow").jqxWindow('hide');
f943efa07d9f Added yeast duplicate button
Michiel Broek <mbroek@mbse.eu>
parents: 313
diff changeset
434 });
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
435 $("#Save").jqxButton({ template: "success", width: '90px', theme: theme });
14
d9dfd703df83 Added yeast inventory screens
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
436 // update the edited row when the user clicks the 'Save' button.
481
fc21dcfbe51d Small code optimize for yeast inventory.
Michiel Broek <mbroek@mbse.eu>
parents: 395
diff changeset
437 $("#Save").click(function() {
fc21dcfbe51d Small code optimize for yeast inventory.
Michiel Broek <mbroek@mbse.eu>
parents: 395
diff changeset
438 var n_inventory, row, rowID = -1;
14
d9dfd703df83 Added yeast inventory screens
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
439 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
440 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
441 }
514
3c680d1dea35 Added dutch array strings to a global php script. Changed fermentables, hops, yeast and misc inventory scripts to use these strings between the database scripts and javascript scripts. This makes filtering on types strings useable. Added these changes to the product/recipe forum and print exports too.
Michiel Broek <mbroek@mbse.eu>
parents: 512
diff changeset
442 if (dataRecord.form == 'Vloeibaar')
481
fc21dcfbe51d Small code optimize for yeast inventory.
Michiel Broek <mbroek@mbse.eu>
parents: 395
diff changeset
443 n_inventory = parseFloat($("#inventory").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
444 else
481
fc21dcfbe51d Small code optimize for yeast inventory.
Michiel Broek <mbroek@mbse.eu>
parents: 395
diff changeset
445 n_inventory = parseFloat($("#inventory").jqxNumberInput('decimal')) / 1000.0;
fc21dcfbe51d Small code optimize for yeast inventory.
Michiel Broek <mbroek@mbse.eu>
parents: 395
diff changeset
446 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
447 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
448 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
449 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
450 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
451 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
452 product_id: $("#product_id").val(),
512
4451af8b6295 Added new fields in inventory_yeasts for Kveik and extra generic flags. Currently these fields do nothing but adding extra information in the database. Added Brett, Kveik and Hybrid yeast types.
Michiel Broek <mbroek@mbse.eu>
parents: 488
diff changeset
453 min_temperature: parseFloat($("#min_temperature").jqxNumberInput('decimal')),
4451af8b6295 Added new fields in inventory_yeasts for Kveik and extra generic flags. Currently these fields do nothing but adding extra information in the database. Added Brett, Kveik and Hybrid yeast types.
Michiel Broek <mbroek@mbse.eu>
parents: 488
diff changeset
454 max_temperature: parseFloat($("#max_temperature").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
455 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
456 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
457 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
458 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
459 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
460 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
461 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
462 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
463 tht_date: $("#tht_date").val(),
313
9f45d09c2071 Added alcohol tolerance field in the yeasts database.
Michiel Broek <mbroek@mbse.eu>
parents: 311
diff changeset
464 cells: parseFloat($("#cells").jqxNumberInput('decimal')),
512
4451af8b6295 Added new fields in inventory_yeasts for Kveik and extra generic flags. Currently these fields do nothing but adding extra information in the database. Added Brett, Kveik and Hybrid yeast types.
Michiel Broek <mbroek@mbse.eu>
parents: 488
diff changeset
465 tolerance: parseFloat($("#tolerance").jqxNumberInput('decimal')),
4451af8b6295 Added new fields in inventory_yeasts for Kveik and extra generic flags. Currently these fields do nothing but adding extra information in the database. Added Brett, Kveik and Hybrid yeast types.
Michiel Broek <mbroek@mbse.eu>
parents: 488
diff changeset
466 sta1: $("#sta1").val(),
4451af8b6295 Added new fields in inventory_yeasts for Kveik and extra generic flags. Currently these fields do nothing but adding extra information in the database. Added Brett, Kveik and Hybrid yeast types.
Michiel Broek <mbroek@mbse.eu>
parents: 488
diff changeset
467 bacteria: $("#bacteria").val(),
4451af8b6295 Added new fields in inventory_yeasts for Kveik and extra generic flags. Currently these fields do nothing but adding extra information in the database. Added Brett, Kveik and Hybrid yeast types.
Michiel Broek <mbroek@mbse.eu>
parents: 488
diff changeset
468 harvest_top: $("#harvest_top").val(),
4451af8b6295 Added new fields in inventory_yeasts for Kveik and extra generic flags. Currently these fields do nothing but adding extra information in the database. Added Brett, Kveik and Hybrid yeast types.
Michiel Broek <mbroek@mbse.eu>
parents: 488
diff changeset
469 harvest_time: $("#harvest_time").val(),
4451af8b6295 Added new fields in inventory_yeasts for Kveik and extra generic flags. Currently these fields do nothing but adding extra information in the database. Added Brett, Kveik and Hybrid yeast types.
Michiel Broek <mbroek@mbse.eu>
parents: 488
diff changeset
470 pitch_temperature: parseFloat($("#pitch_temperature").jqxNumberInput('decimal')),
4451af8b6295 Added new fields in inventory_yeasts for Kveik and extra generic flags. Currently these fields do nothing but adding extra information in the database. Added Brett, Kveik and Hybrid yeast types.
Michiel Broek <mbroek@mbse.eu>
parents: 488
diff changeset
471 pofpos: $("#pofpos").val(),
4451af8b6295 Added new fields in inventory_yeasts for Kveik and extra generic flags. Currently these fields do nothing but adding extra information in the database. Added Brett, Kveik and Hybrid yeast types.
Michiel Broek <mbroek@mbse.eu>
parents: 488
diff changeset
472 zymocide: $("#zymocide").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
473 };
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
474 if (editrow >= 0) {
14
d9dfd703df83 Added yeast inventory screens
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
475 $('#jqxgrid').jqxGrid('updaterow', rowID, row);
d9dfd703df83 Added yeast inventory screens
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
476 } 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
477 $('#jqxgrid').jqxGrid('addrow', null, row);
14
d9dfd703df83 Added yeast inventory screens
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
478 }
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
479 $("#popupWindow").jqxWindow('hide');
14
d9dfd703df83 Added yeast inventory screens
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
480 });
d9dfd703df83 Added yeast inventory screens
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
481 createDelElements();
d9dfd703df83 Added yeast inventory screens
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
482 });
d9dfd703df83 Added yeast inventory screens
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
483

mercurial