www/js/inv_hops.js

Sat, 23 Feb 2019 21:56:36 +0100

author
Michiel Broek <mbroek@mbse.eu>
date
Sat, 23 Feb 2019 21:56:36 +0100
changeset 284
a93fcd87f561
parent 269
25696a91b395
child 286
124af734af68
permissions
-rw-r--r--

Hops can be cloned to allow new crop, or different forms.

12
c26af32428a4 Added hops inventory
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1 /*****************************************************************************
196
531d5458782f Hops database bool to int types. Dropdown lists are using tables with indexes. Dropdown lists display in Dutch. Save and delete in the database now use POST instead of GET. Removed the useat field. Redesigned the web page. Code cleanup.
Michiel Broek <mbroek@mbse.eu>
parents: 37
diff changeset
2 * Copyright (C) 2014-2019
12
c26af32428a4 Added hops inventory
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
3 *
c26af32428a4 Added hops inventory
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
4 * Michiel Broek <mbroek at mbse dot eu>
c26af32428a4 Added hops inventory
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
5 *
c26af32428a4 Added hops inventory
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
6 * This file is part of BrewCloud
c26af32428a4 Added hops inventory
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
7 *
c26af32428a4 Added hops inventory
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
8 * This is free software; you can redistribute it and/or modify it
c26af32428a4 Added hops inventory
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
9 * under the terms of the GNU General Public License as published by the
c26af32428a4 Added hops inventory
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
10 * Free Software Foundation; either version 2, or (at your option) any
c26af32428a4 Added hops inventory
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
11 * later version.
c26af32428a4 Added hops inventory
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
12 *
c26af32428a4 Added hops inventory
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
13 * BrewCloud is distributed in the hope that it will be useful, but
c26af32428a4 Added hops inventory
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
14 * WITHOUT ANY WARRANTY; without even the implied warranty of
c26af32428a4 Added hops inventory
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
c26af32428a4 Added hops inventory
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
16 * General Public License for more details.
c26af32428a4 Added hops inventory
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
17 *
c26af32428a4 Added hops inventory
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
18 * You should have received a copy of the GNU General Public License
c26af32428a4 Added hops inventory
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
19 * along with ThermFerm; see the file COPYING. If not, write to the Free
c26af32428a4 Added hops inventory
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
20 * Software Foundation, 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
c26af32428a4 Added hops inventory
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
21 *****************************************************************************/
c26af32428a4 Added hops inventory
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
22
c26af32428a4 Added hops inventory
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
23
c26af32428a4 Added hops inventory
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
24 function createDelElements() {
c26af32428a4 Added hops inventory
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
25 $('#eventWindow').jqxWindow({
c26af32428a4 Added hops inventory
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
26 theme: theme,
c26af32428a4 Added hops inventory
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
27 position: { x: 490, y: 210 },
c26af32428a4 Added hops inventory
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
28 width: 300,
34
a720353fada9 Formatting and measurements
Michiel Broek <mbroek@mbse.eu>
parents: 30
diff changeset
29 height: 175,
12
c26af32428a4 Added hops inventory
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
30 resizable: false,
c26af32428a4 Added hops inventory
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
31 isModal: true,
c26af32428a4 Added hops inventory
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
32 modalOpacity: 0.4,
c26af32428a4 Added hops inventory
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
33 okButton: $('#delOk'),
c26af32428a4 Added hops inventory
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
34 cancelButton: $('#delCancel'),
c26af32428a4 Added hops inventory
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
35 initContent: function () {
196
531d5458782f Hops database bool to int types. Dropdown lists are using tables with indexes. Dropdown lists display in Dutch. Save and delete in the database now use POST instead of GET. Removed the useat field. Redesigned the web page. Code cleanup.
Michiel Broek <mbroek@mbse.eu>
parents: 37
diff changeset
36 $('#delOk').jqxButton({ template: "danger", width: '65px', theme: theme });
531d5458782f Hops database bool to int types. Dropdown lists are using tables with indexes. Dropdown lists display in Dutch. Save and delete in the database now use POST instead of GET. Removed the useat field. Redesigned the web page. Code cleanup.
Michiel Broek <mbroek@mbse.eu>
parents: 37
diff changeset
37 $('#delCancel').jqxButton({ template: "success", width: '65px', theme: theme });
12
c26af32428a4 Added hops inventory
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
38 $('#delCancel').focus();
c26af32428a4 Added hops inventory
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
39 }
c26af32428a4 Added hops inventory
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
40 });
c26af32428a4 Added hops inventory
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
41 $('#eventWindow').jqxWindow('hide');
c26af32428a4 Added hops inventory
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
42 }
c26af32428a4 Added hops inventory
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
43
c26af32428a4 Added hops inventory
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
44
c26af32428a4 Added hops inventory
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
45 $(document).ready(function () {
199
dad62ec9af18 Added total cost values to the fermenter and hop editor screens.
Michiel Broek <mbroek@mbse.eu>
parents: 196
diff changeset
46
dad62ec9af18 Added total cost values to the fermenter and hop editor screens.
Michiel Broek <mbroek@mbse.eu>
parents: 196
diff changeset
47 var dataRecord = {};
dad62ec9af18 Added total cost values to the fermenter and hop editor screens.
Michiel Broek <mbroek@mbse.eu>
parents: 196
diff changeset
48
dad62ec9af18 Added total cost values to the fermenter and hop editor screens.
Michiel Broek <mbroek@mbse.eu>
parents: 196
diff changeset
49 function calcTotal(cost, inventory) {
dad62ec9af18 Added total cost values to the fermenter and hop editor screens.
Michiel Broek <mbroek@mbse.eu>
parents: 196
diff changeset
50
dad62ec9af18 Added total cost values to the fermenter and hop editor screens.
Michiel Broek <mbroek@mbse.eu>
parents: 196
diff changeset
51 $('#totval').val(cost * (inventory / 1000));
dad62ec9af18 Added total cost values to the fermenter and hop editor screens.
Michiel Broek <mbroek@mbse.eu>
parents: 196
diff changeset
52 }
dad62ec9af18 Added total cost values to the fermenter and hop editor screens.
Michiel Broek <mbroek@mbse.eu>
parents: 196
diff changeset
53
12
c26af32428a4 Added hops inventory
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
54 var url = "includes/db_inventory_hops.php";
c26af32428a4 Added hops inventory
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
55 // prepare the data
c26af32428a4 Added hops inventory
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
56 var source = {
c26af32428a4 Added hops inventory
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
57 datatype: "json",
c26af32428a4 Added hops inventory
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
58 cache: false,
c26af32428a4 Added hops inventory
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
59 datafields: [
c26af32428a4 Added hops inventory
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
60 { name: 'record', type: 'number' },
c26af32428a4 Added hops inventory
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
61 { name: 'name', type: 'string' },
c26af32428a4 Added hops inventory
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
62 { name: 'alpha', type: 'float' },
c26af32428a4 Added hops inventory
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
63 { name: 'beta', type: 'float' },
c26af32428a4 Added hops inventory
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
64 { name: 'humulene', type: 'float' },
c26af32428a4 Added hops inventory
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
65 { name: 'caryophyllene', type: 'float' },
c26af32428a4 Added hops inventory
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
66 { name: 'cohumulone', type: 'float' },
c26af32428a4 Added hops inventory
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
67 { name: 'myrcene', type: 'float' },
13
b8c3ca152984 Added hops inventory
Michiel Broek <mbroek@mbse.eu>
parents: 12
diff changeset
68 { name: 'hsi', type: 'float' },
196
531d5458782f Hops database bool to int types. Dropdown lists are using tables with indexes. Dropdown lists display in Dutch. Save and delete in the database now use POST instead of GET. Removed the useat field. Redesigned the web page. Code cleanup.
Michiel Broek <mbroek@mbse.eu>
parents: 37
diff changeset
69 { name: 'type', type: 'int' },
531d5458782f Hops database bool to int types. Dropdown lists are using tables with indexes. Dropdown lists display in Dutch. Save and delete in the database now use POST instead of GET. Removed the useat field. Redesigned the web page. Code cleanup.
Michiel Broek <mbroek@mbse.eu>
parents: 37
diff changeset
70 { name: 'form', type: 'int' },
12
c26af32428a4 Added hops inventory
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
71 { name: 'notes', type: 'string' },
c26af32428a4 Added hops inventory
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
72 { name: 'origin', type: 'string' },
c26af32428a4 Added hops inventory
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
73 { name: 'substitutes', type: 'string' },
196
531d5458782f Hops database bool to int types. Dropdown lists are using tables with indexes. Dropdown lists display in Dutch. Save and delete in the database now use POST instead of GET. Removed the useat field. Redesigned the web page. Code cleanup.
Michiel Broek <mbroek@mbse.eu>
parents: 37
diff changeset
74 { name: 'always_on_stock', type: 'int' },
12
c26af32428a4 Added hops inventory
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
75 { name: 'inventory', type: 'float' },
c26af32428a4 Added hops inventory
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
76 { name: 'cost', type: 'float' },
c26af32428a4 Added hops inventory
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
77 { name: 'production_date', type: 'string' },
c26af32428a4 Added hops inventory
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
78 { name: 'tht_date', type: 'string' },
13
b8c3ca152984 Added hops inventory
Michiel Broek <mbroek@mbse.eu>
parents: 12
diff changeset
79 { name: 'total_oil', type: 'float' }
12
c26af32428a4 Added hops inventory
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
80 ],
c26af32428a4 Added hops inventory
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
81 id: 'record',
c26af32428a4 Added hops inventory
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
82 url: url,
c26af32428a4 Added hops inventory
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
83 deleterow: function (rowid, commit) {
c26af32428a4 Added hops inventory
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
84 // synchronize with the server - send delete command
c26af32428a4 Added hops inventory
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
85 var data = "delete=true&" + $.param({ record: rowid });
c26af32428a4 Added hops inventory
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
86 $.ajax({
c26af32428a4 Added hops inventory
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
87 dataType: 'json',
c26af32428a4 Added hops inventory
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
88 url: url,
c26af32428a4 Added hops inventory
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
89 cache: false,
c26af32428a4 Added hops inventory
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
90 data: data,
196
531d5458782f Hops database bool to int types. Dropdown lists are using tables with indexes. Dropdown lists display in Dutch. Save and delete in the database now use POST instead of GET. Removed the useat field. Redesigned the web page. Code cleanup.
Michiel Broek <mbroek@mbse.eu>
parents: 37
diff changeset
91 type: "POST",
12
c26af32428a4 Added hops inventory
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
92 success: function (data, status, xhr) {
c26af32428a4 Added hops inventory
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
93 // delete command is executed.
c26af32428a4 Added hops inventory
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
94 commit(true);
c26af32428a4 Added hops inventory
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
95 },
c26af32428a4 Added hops inventory
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
96 error: function (jqXHR, textStatus, errorThrown) {
c26af32428a4 Added hops inventory
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
97 commit(false);
c26af32428a4 Added hops inventory
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
98 }
c26af32428a4 Added hops inventory
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
99 });
c26af32428a4 Added hops inventory
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
100 },
c26af32428a4 Added hops inventory
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
101 addrow: function (rowid, rowdata, position, commit) {
c26af32428a4 Added hops inventory
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
102 var data = "insert=true&" + $.param(rowdata);
c26af32428a4 Added hops inventory
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
103 $.ajax({
c26af32428a4 Added hops inventory
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
104 dataType: 'json',
c26af32428a4 Added hops inventory
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
105 url: url,
c26af32428a4 Added hops inventory
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
106 cache: false,
c26af32428a4 Added hops inventory
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
107 data: data,
196
531d5458782f Hops database bool to int types. Dropdown lists are using tables with indexes. Dropdown lists display in Dutch. Save and delete in the database now use POST instead of GET. Removed the useat field. Redesigned the web page. Code cleanup.
Michiel Broek <mbroek@mbse.eu>
parents: 37
diff changeset
108 type: "POST",
12
c26af32428a4 Added hops inventory
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
109 success: function (data, status, xhr) {
c26af32428a4 Added hops inventory
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
110 commit(true);
c26af32428a4 Added hops inventory
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
111 },
c26af32428a4 Added hops inventory
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
112 error: function(jqXHR, textStatus, errorThrown) {
c26af32428a4 Added hops inventory
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
113 commit(false);
c26af32428a4 Added hops inventory
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
114 }
c26af32428a4 Added hops inventory
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
115 });
c26af32428a4 Added hops inventory
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
116 },
c26af32428a4 Added hops inventory
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
117 updaterow: function (rowid, rowdata, commit) {
c26af32428a4 Added hops inventory
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
118 var data = "update=true&" + $.param(rowdata);
c26af32428a4 Added hops inventory
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
119 $.ajax({
c26af32428a4 Added hops inventory
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
120 dataType: 'json',
c26af32428a4 Added hops inventory
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
121 url: url,
c26af32428a4 Added hops inventory
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
122 cache: false,
c26af32428a4 Added hops inventory
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
123 data: data,
196
531d5458782f Hops database bool to int types. Dropdown lists are using tables with indexes. Dropdown lists display in Dutch. Save and delete in the database now use POST instead of GET. Removed the useat field. Redesigned the web page. Code cleanup.
Michiel Broek <mbroek@mbse.eu>
parents: 37
diff changeset
124 type: "POST",
12
c26af32428a4 Added hops inventory
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
125 success: function (data, status, xhr) {
c26af32428a4 Added hops inventory
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
126 // update command is executed.
c26af32428a4 Added hops inventory
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
127 commit(true);
c26af32428a4 Added hops inventory
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
128 },
c26af32428a4 Added hops inventory
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
129 error: function(jqXHR, textStatus, errorThrown) {
c26af32428a4 Added hops inventory
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
130 commit(false);
c26af32428a4 Added hops inventory
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
131 }
c26af32428a4 Added hops inventory
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
132 });
c26af32428a4 Added hops inventory
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
133 }
c26af32428a4 Added hops inventory
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
134 };
c26af32428a4 Added hops inventory
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
135 // initialize the input fields.
196
531d5458782f Hops database bool to int types. Dropdown lists are using tables with indexes. Dropdown lists display in Dutch. Save and delete in the database now use POST instead of GET. Removed the useat field. Redesigned the web page. Code cleanup.
Michiel Broek <mbroek@mbse.eu>
parents: 37
diff changeset
136 $("#name").jqxInput({ theme: theme, width: 640, height: 23 });
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: 203
diff changeset
137 $("#alpha").jqxNumberInput( Perc1dec );
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: 203
diff changeset
138 $("#beta").jqxNumberInput( Perc1dec );
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: 203
diff changeset
139 $("#humulene").jqxNumberInput( Perc1dec );
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: 203
diff changeset
140 $("#caryophyllene").jqxNumberInput( Perc1dec );
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: 203
diff changeset
141 $("#cohumulone").jqxNumberInput( Perc1dec );
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: 203
diff changeset
142 $("#myrcene").jqxNumberInput( Perc1dec );
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: 203
diff changeset
143 $("#hsi").jqxNumberInput( Perc1dec );
12
c26af32428a4 Added hops inventory
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
144
196
531d5458782f Hops database bool to int types. Dropdown lists are using tables with indexes. Dropdown lists display in Dutch. Save and delete in the database now use POST instead of GET. Removed the useat field. Redesigned the web page. Code cleanup.
Michiel Broek <mbroek@mbse.eu>
parents: 37
diff changeset
145 $("#type").jqxDropDownList({
531d5458782f Hops database bool to int types. Dropdown lists are using tables with indexes. Dropdown lists display in Dutch. Save and delete in the database now use POST instead of GET. Removed the useat field. Redesigned the web page. Code cleanup.
Michiel Broek <mbroek@mbse.eu>
parents: 37
diff changeset
146 theme: theme,
531d5458782f Hops database bool to int types. Dropdown lists are using tables with indexes. Dropdown lists display in Dutch. Save and delete in the database now use POST instead of GET. Removed the useat field. Redesigned the web page. Code cleanup.
Michiel Broek <mbroek@mbse.eu>
parents: 37
diff changeset
147 source: HopTypeAdapter,
531d5458782f Hops database bool to int types. Dropdown lists are using tables with indexes. Dropdown lists display in Dutch. Save and delete in the database now use POST instead of GET. Removed the useat field. Redesigned the web page. Code cleanup.
Michiel Broek <mbroek@mbse.eu>
parents: 37
diff changeset
148 valueMember: 'id',
531d5458782f Hops database bool to int types. Dropdown lists are using tables with indexes. Dropdown lists display in Dutch. Save and delete in the database now use POST instead of GET. Removed the useat field. Redesigned the web page. Code cleanup.
Michiel Broek <mbroek@mbse.eu>
parents: 37
diff changeset
149 displayMember: 'nl',
531d5458782f Hops database bool to int types. Dropdown lists are using tables with indexes. Dropdown lists display in Dutch. Save and delete in the database now use POST instead of GET. Removed the useat field. Redesigned the web page. Code cleanup.
Michiel Broek <mbroek@mbse.eu>
parents: 37
diff changeset
150 width: 150,
531d5458782f Hops database bool to int types. Dropdown lists are using tables with indexes. Dropdown lists display in Dutch. Save and delete in the database now use POST instead of GET. Removed the useat field. Redesigned the web page. Code cleanup.
Michiel Broek <mbroek@mbse.eu>
parents: 37
diff changeset
151 height: 23,
531d5458782f Hops database bool to int types. Dropdown lists are using tables with indexes. Dropdown lists display in Dutch. Save and delete in the database now use POST instead of GET. Removed the useat field. Redesigned the web page. Code cleanup.
Michiel Broek <mbroek@mbse.eu>
parents: 37
diff changeset
152 autoDropDownHeight: true
531d5458782f Hops database bool to int types. Dropdown lists are using tables with indexes. Dropdown lists display in Dutch. Save and delete in the database now use POST instead of GET. Removed the useat field. Redesigned the web page. Code cleanup.
Michiel Broek <mbroek@mbse.eu>
parents: 37
diff changeset
153 });
531d5458782f Hops database bool to int types. Dropdown lists are using tables with indexes. Dropdown lists display in Dutch. Save and delete in the database now use POST instead of GET. Removed the useat field. Redesigned the web page. Code cleanup.
Michiel Broek <mbroek@mbse.eu>
parents: 37
diff changeset
154 $("#form").jqxDropDownList({
531d5458782f Hops database bool to int types. Dropdown lists are using tables with indexes. Dropdown lists display in Dutch. Save and delete in the database now use POST instead of GET. Removed the useat field. Redesigned the web page. Code cleanup.
Michiel Broek <mbroek@mbse.eu>
parents: 37
diff changeset
155 theme: theme,
531d5458782f Hops database bool to int types. Dropdown lists are using tables with indexes. Dropdown lists display in Dutch. Save and delete in the database now use POST instead of GET. Removed the useat field. Redesigned the web page. Code cleanup.
Michiel Broek <mbroek@mbse.eu>
parents: 37
diff changeset
156 source: HopFormAdapter,
531d5458782f Hops database bool to int types. Dropdown lists are using tables with indexes. Dropdown lists display in Dutch. Save and delete in the database now use POST instead of GET. Removed the useat field. Redesigned the web page. Code cleanup.
Michiel Broek <mbroek@mbse.eu>
parents: 37
diff changeset
157 valueMember: 'id',
531d5458782f Hops database bool to int types. Dropdown lists are using tables with indexes. Dropdown lists display in Dutch. Save and delete in the database now use POST instead of GET. Removed the useat field. Redesigned the web page. Code cleanup.
Michiel Broek <mbroek@mbse.eu>
parents: 37
diff changeset
158 displayMember: 'nl',
531d5458782f Hops database bool to int types. Dropdown lists are using tables with indexes. Dropdown lists display in Dutch. Save and delete in the database now use POST instead of GET. Removed the useat field. Redesigned the web page. Code cleanup.
Michiel Broek <mbroek@mbse.eu>
parents: 37
diff changeset
159 width: 150,
531d5458782f Hops database bool to int types. Dropdown lists are using tables with indexes. Dropdown lists display in Dutch. Save and delete in the database now use POST instead of GET. Removed the useat field. Redesigned the web page. Code cleanup.
Michiel Broek <mbroek@mbse.eu>
parents: 37
diff changeset
160 height: 23,
531d5458782f Hops database bool to int types. Dropdown lists are using tables with indexes. Dropdown lists display in Dutch. Save and delete in the database now use POST instead of GET. Removed the useat field. Redesigned the web page. Code cleanup.
Michiel Broek <mbroek@mbse.eu>
parents: 37
diff changeset
161 autoDropDownHeight: true
531d5458782f Hops database bool to int types. Dropdown lists are using tables with indexes. Dropdown lists display in Dutch. Save and delete in the database now use POST instead of GET. Removed the useat field. Redesigned the web page. Code cleanup.
Michiel Broek <mbroek@mbse.eu>
parents: 37
diff changeset
162 });
13
b8c3ca152984 Added hops inventory
Michiel Broek <mbroek@mbse.eu>
parents: 12
diff changeset
163 $("#notes").jqxInput({ theme: theme, width: 640, height: 100 });
196
531d5458782f Hops database bool to int types. Dropdown lists are using tables with indexes. Dropdown lists display in Dutch. Save and delete in the database now use POST instead of GET. Removed the useat field. Redesigned the web page. Code cleanup.
Michiel Broek <mbroek@mbse.eu>
parents: 37
diff changeset
164 $("#origin").jqxInput({ theme: theme, width: 320, height: 23 });
531d5458782f Hops database bool to int types. Dropdown lists are using tables with indexes. Dropdown lists display in Dutch. Save and delete in the database now use POST instead of GET. Removed the useat field. Redesigned the web page. Code cleanup.
Michiel Broek <mbroek@mbse.eu>
parents: 37
diff changeset
165 $("#substitutes").jqxInput({ theme: theme, width: 320, height: 23 });
12
c26af32428a4 Added hops inventory
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
166 $("#always_on_stock").jqxCheckBox({ theme: theme, width: 120, height: 23 });
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: 203
diff changeset
167 $("#inventory").jqxNumberInput( Spin1dec );
196
531d5458782f Hops database bool to int types. Dropdown lists are using tables with indexes. Dropdown lists display in Dutch. Save and delete in the database now use POST instead of GET. Removed the useat field. Redesigned the web page. Code cleanup.
Michiel Broek <mbroek@mbse.eu>
parents: 37
diff changeset
168 $("#production_date").jqxDateTimeInput( Dateopts );
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: 203
diff changeset
169 $("#cost").jqxNumberInput( Spin2dec );
196
531d5458782f Hops database bool to int types. Dropdown lists are using tables with indexes. Dropdown lists display in Dutch. Save and delete in the database now use POST instead of GET. Removed the useat field. Redesigned the web page. Code cleanup.
Michiel Broek <mbroek@mbse.eu>
parents: 37
diff changeset
170 $("#tht_date").jqxDateTimeInput( Dateopts );
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: 203
diff changeset
171 $("#total_oil").jqxNumberInput( Perc1dec );
269
25696a91b395 Code cleanup
Michiel Broek <mbroek@mbse.eu>
parents: 245
diff changeset
172 $("#totval").jqxNumberInput( Show2dec );
199
dad62ec9af18 Added total cost values to the fermenter and hop editor screens.
Michiel Broek <mbroek@mbse.eu>
parents: 196
diff changeset
173
12
c26af32428a4 Added hops inventory
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
174 var dataAdapter = new $.jqx.dataAdapter(source);
c26af32428a4 Added hops inventory
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
175 var editrow = -1;
c26af32428a4 Added hops inventory
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
176 // initialize jqxGrid
c26af32428a4 Added hops inventory
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
177 $("#jqxgrid").jqxGrid({
c26af32428a4 Added hops inventory
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
178 width: 1280,
c26af32428a4 Added hops inventory
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
179 height: 630,
c26af32428a4 Added hops inventory
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
180 source: dataAdapter,
c26af32428a4 Added hops inventory
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
181 theme: theme,
c26af32428a4 Added hops inventory
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
182 showstatusbar: true,
13
b8c3ca152984 Added hops inventory
Michiel Broek <mbroek@mbse.eu>
parents: 12
diff changeset
183 localization: getLocalization(),
12
c26af32428a4 Added hops inventory
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
184 renderstatusbar: function (statusbar) {
c26af32428a4 Added hops inventory
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
185 var container = $("<div style='overflow: hidden; position: relative; margin: 5px;'></div>");
34
a720353fada9 Formatting and measurements
Michiel Broek <mbroek@mbse.eu>
parents: 30
diff changeset
186 var addButton = $("<div style='float: right; margin-right: 15px;'><img style='position: relative; margin-top: 2px;' src='images/add.png'/><span style='margin-left: 4px; position: relative; top: -3px;'>Nieuw</span></div>");
12
c26af32428a4 Added hops inventory
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
187 container.append(addButton);
c26af32428a4 Added hops inventory
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
188 statusbar.append(container);
196
531d5458782f Hops database bool to int types. Dropdown lists are using tables with indexes. Dropdown lists display in Dutch. Save and delete in the database now use POST instead of GET. Removed the useat field. Redesigned the web page. Code cleanup.
Michiel Broek <mbroek@mbse.eu>
parents: 37
diff changeset
189 addButton.jqxButton({ theme: theme, width: 90, height: 20 });
12
c26af32428a4 Added hops inventory
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
190 // add new row.
c26af32428a4 Added hops inventory
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
191 addButton.click(function (event) {
c26af32428a4 Added hops inventory
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
192 editrow = -1;
196
531d5458782f Hops database bool to int types. Dropdown lists are using tables with indexes. Dropdown lists display in Dutch. Save and delete in the database now use POST instead of GET. Removed the useat field. Redesigned the web page. Code cleanup.
Michiel Broek <mbroek@mbse.eu>
parents: 37
diff changeset
193 $("#popupWindow").jqxWindow({ position: { x: 110, y: 30 } });
531d5458782f Hops database bool to int types. Dropdown lists are using tables with indexes. Dropdown lists display in Dutch. Save and delete in the database now use POST instead of GET. Removed the useat field. Redesigned the web page. Code cleanup.
Michiel Broek <mbroek@mbse.eu>
parents: 37
diff changeset
194 $("#name").val('Nieuwe hop');
531d5458782f Hops database bool to int types. Dropdown lists are using tables with indexes. Dropdown lists display in Dutch. Save and delete in the database now use POST instead of GET. Removed the useat field. Redesigned the web page. Code cleanup.
Michiel Broek <mbroek@mbse.eu>
parents: 37
diff changeset
195 $("#alpha").val(0);
531d5458782f Hops database bool to int types. Dropdown lists are using tables with indexes. Dropdown lists display in Dutch. Save and delete in the database now use POST instead of GET. Removed the useat field. Redesigned the web page. Code cleanup.
Michiel Broek <mbroek@mbse.eu>
parents: 37
diff changeset
196 $("#beta").val(0);
531d5458782f Hops database bool to int types. Dropdown lists are using tables with indexes. Dropdown lists display in Dutch. Save and delete in the database now use POST instead of GET. Removed the useat field. Redesigned the web page. Code cleanup.
Michiel Broek <mbroek@mbse.eu>
parents: 37
diff changeset
197 $("#humulene").val(0);
531d5458782f Hops database bool to int types. Dropdown lists are using tables with indexes. Dropdown lists display in Dutch. Save and delete in the database now use POST instead of GET. Removed the useat field. Redesigned the web page. Code cleanup.
Michiel Broek <mbroek@mbse.eu>
parents: 37
diff changeset
198 $("#caryophyllene").val(0);
531d5458782f Hops database bool to int types. Dropdown lists are using tables with indexes. Dropdown lists display in Dutch. Save and delete in the database now use POST instead of GET. Removed the useat field. Redesigned the web page. Code cleanup.
Michiel Broek <mbroek@mbse.eu>
parents: 37
diff changeset
199 $("#cohumulone").val(0);
531d5458782f Hops database bool to int types. Dropdown lists are using tables with indexes. Dropdown lists display in Dutch. Save and delete in the database now use POST instead of GET. Removed the useat field. Redesigned the web page. Code cleanup.
Michiel Broek <mbroek@mbse.eu>
parents: 37
diff changeset
200 $("#myrcene").val(0);
531d5458782f Hops database bool to int types. Dropdown lists are using tables with indexes. Dropdown lists display in Dutch. Save and delete in the database now use POST instead of GET. Removed the useat field. Redesigned the web page. Code cleanup.
Michiel Broek <mbroek@mbse.eu>
parents: 37
diff changeset
201 $("#hsi").val(0);
531d5458782f Hops database bool to int types. Dropdown lists are using tables with indexes. Dropdown lists display in Dutch. Save and delete in the database now use POST instead of GET. Removed the useat field. Redesigned the web page. Code cleanup.
Michiel Broek <mbroek@mbse.eu>
parents: 37
diff changeset
202 $("#type").val(0);
531d5458782f Hops database bool to int types. Dropdown lists are using tables with indexes. Dropdown lists display in Dutch. Save and delete in the database now use POST instead of GET. Removed the useat field. Redesigned the web page. Code cleanup.
Michiel Broek <mbroek@mbse.eu>
parents: 37
diff changeset
203 $("#form").val(0);
12
c26af32428a4 Added hops inventory
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
204 $("#notes").val('');
c26af32428a4 Added hops inventory
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
205 $("#origin").val('');
c26af32428a4 Added hops inventory
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
206 $("#substitutes").val('');
196
531d5458782f Hops database bool to int types. Dropdown lists are using tables with indexes. Dropdown lists display in Dutch. Save and delete in the database now use POST instead of GET. Removed the useat field. Redesigned the web page. Code cleanup.
Michiel Broek <mbroek@mbse.eu>
parents: 37
diff changeset
207 $("#always_on_stock").val(0);
531d5458782f Hops database bool to int types. Dropdown lists are using tables with indexes. Dropdown lists display in Dutch. Save and delete in the database now use POST instead of GET. Removed the useat field. Redesigned the web page. Code cleanup.
Michiel Broek <mbroek@mbse.eu>
parents: 37
diff changeset
208 $("#inventory").val(0);
531d5458782f Hops database bool to int types. Dropdown lists are using tables with indexes. Dropdown lists display in Dutch. Save and delete in the database now use POST instead of GET. Removed the useat field. Redesigned the web page. Code cleanup.
Michiel Broek <mbroek@mbse.eu>
parents: 37
diff changeset
209 $("#cost").val(0);
12
c26af32428a4 Added hops inventory
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
210 $("#production_date").val('');
c26af32428a4 Added hops inventory
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
211 $("#tht_date").val('');
196
531d5458782f Hops database bool to int types. Dropdown lists are using tables with indexes. Dropdown lists display in Dutch. Save and delete in the database now use POST instead of GET. Removed the useat field. Redesigned the web page. Code cleanup.
Michiel Broek <mbroek@mbse.eu>
parents: 37
diff changeset
212 $("#total_oil").val(0);
12
c26af32428a4 Added hops inventory
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
213 $("#popupWindow").jqxWindow('open');
c26af32428a4 Added hops inventory
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
214 });
c26af32428a4 Added hops inventory
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
215 },
c26af32428a4 Added hops inventory
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
216 filterable: true,
c26af32428a4 Added hops inventory
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
217 filtermode: 'excel',
c26af32428a4 Added hops inventory
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
218 columns: [
203
e29b53962cd1 Hops inventory disable filter menu on some fields. Friendy display of stock inventory.
Michiel Broek <mbroek@mbse.eu>
parents: 199
diff changeset
219 { text: 'Herkomst', datafield: 'origin', width: 150 },
e29b53962cd1 Hops inventory disable filter menu on some fields. Friendy display of stock inventory.
Michiel Broek <mbroek@mbse.eu>
parents: 199
diff changeset
220 { text: 'Hop Naam', datafield: 'name', menu: false },
e29b53962cd1 Hops inventory disable filter menu on some fields. Friendy display of stock inventory.
Michiel Broek <mbroek@mbse.eu>
parents: 199
diff changeset
221 { text: 'Soort', datafield: 'type', align: 'center', menu: false, width: 90,
196
531d5458782f Hops database bool to int types. Dropdown lists are using tables with indexes. Dropdown lists display in Dutch. Save and delete in the database now use POST instead of GET. Removed the useat field. Redesigned the web page. Code cleanup.
Michiel Broek <mbroek@mbse.eu>
parents: 37
diff changeset
222 cellsrenderer: function (index, datafield, value, defaultvalue, column, rowdata) {
531d5458782f Hops database bool to int types. Dropdown lists are using tables with indexes. Dropdown lists display in Dutch. Save and delete in the database now use POST instead of GET. Removed the useat field. Redesigned the web page. Code cleanup.
Michiel Broek <mbroek@mbse.eu>
parents: 37
diff changeset
223 return "<div style='margin: 4px;' class='jqx-center-align'>" + HopTypeData[value].nl + "</div>";
531d5458782f Hops database bool to int types. Dropdown lists are using tables with indexes. Dropdown lists display in Dutch. Save and delete in the database now use POST instead of GET. Removed the useat field. Redesigned the web page. Code cleanup.
Michiel Broek <mbroek@mbse.eu>
parents: 37
diff changeset
224 }
531d5458782f Hops database bool to int types. Dropdown lists are using tables with indexes. Dropdown lists display in Dutch. Save and delete in the database now use POST instead of GET. Removed the useat field. Redesigned the web page. Code cleanup.
Michiel Broek <mbroek@mbse.eu>
parents: 37
diff changeset
225 },
203
e29b53962cd1 Hops inventory disable filter menu on some fields. Friendy display of stock inventory.
Michiel Broek <mbroek@mbse.eu>
parents: 199
diff changeset
226 { text: 'Vorm', datafield: 'form', align: 'center', menu: false, width: 90,
196
531d5458782f Hops database bool to int types. Dropdown lists are using tables with indexes. Dropdown lists display in Dutch. Save and delete in the database now use POST instead of GET. Removed the useat field. Redesigned the web page. Code cleanup.
Michiel Broek <mbroek@mbse.eu>
parents: 37
diff changeset
227 cellsrenderer: function (index, datafield, value, defaultvalue, column, rowdata) {
531d5458782f Hops database bool to int types. Dropdown lists are using tables with indexes. Dropdown lists display in Dutch. Save and delete in the database now use POST instead of GET. Removed the useat field. Redesigned the web page. Code cleanup.
Michiel Broek <mbroek@mbse.eu>
parents: 37
diff changeset
228 return "<div style='margin: 4px;' class='jqx-center-align'>" + HopFormData[value].nl + "</div>";
531d5458782f Hops database bool to int types. Dropdown lists are using tables with indexes. Dropdown lists display in Dutch. Save and delete in the database now use POST instead of GET. Removed the useat field. Redesigned the web page. Code cleanup.
Michiel Broek <mbroek@mbse.eu>
parents: 37
diff changeset
229 }
531d5458782f Hops database bool to int types. Dropdown lists are using tables with indexes. Dropdown lists display in Dutch. Save and delete in the database now use POST instead of GET. Removed the useat field. Redesigned the web page. Code cleanup.
Michiel Broek <mbroek@mbse.eu>
parents: 37
diff changeset
230 },
203
e29b53962cd1 Hops inventory disable filter menu on some fields. Friendy display of stock inventory.
Michiel Broek <mbroek@mbse.eu>
parents: 199
diff changeset
231 { text: 'Alpha %', datafield: 'alpha', width: 80, align: 'right', cellsalign: 'right', menu: false, cellsformat: 'p1' },
e29b53962cd1 Hops inventory disable filter menu on some fields. Friendy display of stock inventory.
Michiel Broek <mbroek@mbse.eu>
parents: 199
diff changeset
232 { text: 'Beta %', datafield: 'beta', width: 80, align: 'right', cellsalign: 'right', menu: false, cellsformat: 'p1' },
e29b53962cd1 Hops inventory disable filter menu on some fields. Friendy display of stock inventory.
Michiel Broek <mbroek@mbse.eu>
parents: 199
diff changeset
233 { text: 'Cohumuloon %%', datafield: 'cohumulone', width: 80, align: 'right', cellsalign: 'right', menu: false, cellsformat: 'p1' },
e29b53962cd1 Hops inventory disable filter menu on some fields. Friendy display of stock inventory.
Michiel Broek <mbroek@mbse.eu>
parents: 199
diff changeset
234 { text: 'HSI', datafield: 'hsi', width: 60, align: 'right', cellsalign: 'right', menu: false, cellsformat: 'f1' },
e29b53962cd1 Hops inventory disable filter menu on some fields. Friendy display of stock inventory.
Michiel Broek <mbroek@mbse.eu>
parents: 199
diff changeset
235 { text: 'Oogst datum', datafield: 'production_date', align: 'center', cellsalign: 'center', menu: false, width: 110 },
e29b53962cd1 Hops inventory disable filter menu on some fields. Friendy display of stock inventory.
Michiel Broek <mbroek@mbse.eu>
parents: 199
diff changeset
236 { text: 'Voorraad', datafield: 'inventory', width: 100, align: 'right', cellsalign: 'right', menu: false, cellsformat: 'f1',
e29b53962cd1 Hops inventory disable filter menu on some fields. Friendy display of stock inventory.
Michiel Broek <mbroek@mbse.eu>
parents: 199
diff changeset
237 cellsrenderer: function (index, datafield, value, defaultvalue, column, rowdata) {
e29b53962cd1 Hops inventory disable filter menu on some fields. Friendy display of stock inventory.
Michiel Broek <mbroek@mbse.eu>
parents: 199
diff changeset
238 if (value == 0)
e29b53962cd1 Hops inventory disable filter menu on some fields. Friendy display of stock inventory.
Michiel Broek <mbroek@mbse.eu>
parents: 199
diff changeset
239 return "<div style='margin: 4px;' class='jqx-right-align'></div>";
e29b53962cd1 Hops inventory disable filter menu on some fields. Friendy display of stock inventory.
Michiel Broek <mbroek@mbse.eu>
parents: 199
diff changeset
240 if (value < 1000)
e29b53962cd1 Hops inventory disable filter menu on some fields. Friendy display of stock inventory.
Michiel Broek <mbroek@mbse.eu>
parents: 199
diff changeset
241 return "<div style='margin: 4px;' class='jqx-right-align'>"+dataAdapter.formatNumber(value,"f1")+" gr</div>";
e29b53962cd1 Hops inventory disable filter menu on some fields. Friendy display of stock inventory.
Michiel Broek <mbroek@mbse.eu>
parents: 199
diff changeset
242 return "<div style='margin: 4px;' class='jqx-right-align'>"+dataAdapter.formatNumber(value / 1000.0,"f1")+" kg</div>";
e29b53962cd1 Hops inventory disable filter menu on some fields. Friendy display of stock inventory.
Michiel Broek <mbroek@mbse.eu>
parents: 199
diff changeset
243 }
e29b53962cd1 Hops inventory disable filter menu on some fields. Friendy display of stock inventory.
Michiel Broek <mbroek@mbse.eu>
parents: 199
diff changeset
244 },
e29b53962cd1 Hops inventory disable filter menu on some fields. Friendy display of stock inventory.
Michiel Broek <mbroek@mbse.eu>
parents: 199
diff changeset
245 { text: 'Wijzig', datafield: 'Wijzig', columntype: 'button', width: 100, align: 'center', menu: false, cellsrenderer: function () {
34
a720353fada9 Formatting and measurements
Michiel Broek <mbroek@mbse.eu>
parents: 30
diff changeset
246 return "Wijzig";
12
c26af32428a4 Added hops inventory
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
247 }, buttonclick: function (row) {
c26af32428a4 Added hops inventory
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
248 // open the popup window when the user clicks a button.
c26af32428a4 Added hops inventory
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
249 editrow = row;
196
531d5458782f Hops database bool to int types. Dropdown lists are using tables with indexes. Dropdown lists display in Dutch. Save and delete in the database now use POST instead of GET. Removed the useat field. Redesigned the web page. Code cleanup.
Michiel Broek <mbroek@mbse.eu>
parents: 37
diff changeset
250 $("#popupWindow").jqxWindow({ position: { x: 110, y: 30 } });
12
c26af32428a4 Added hops inventory
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
251 // get the clicked row's data and initialize the input fields.
199
dad62ec9af18 Added total cost values to the fermenter and hop editor screens.
Michiel Broek <mbroek@mbse.eu>
parents: 196
diff changeset
252 dataRecord = $("#jqxgrid").jqxGrid('getrowdata', editrow);
12
c26af32428a4 Added hops inventory
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
253 $("#name").val(dataRecord.name);
c26af32428a4 Added hops inventory
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
254 $("#alpha").val(dataRecord.alpha);
c26af32428a4 Added hops inventory
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
255 $("#beta").val(dataRecord.beta);
c26af32428a4 Added hops inventory
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
256 $("#humulene").val(dataRecord.humulene);
c26af32428a4 Added hops inventory
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
257 $("#caryophyllene").val(dataRecord.caryophyllene);
c26af32428a4 Added hops inventory
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
258 $("#cohumulone").val(dataRecord.cohumulone);
c26af32428a4 Added hops inventory
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
259 $("#myrcene").val(dataRecord.myrcene);
13
b8c3ca152984 Added hops inventory
Michiel Broek <mbroek@mbse.eu>
parents: 12
diff changeset
260 $("#hsi").val(dataRecord.hsi);
12
c26af32428a4 Added hops inventory
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
261 $("#type").val(dataRecord.type);
c26af32428a4 Added hops inventory
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
262 $("#form").val(dataRecord.form);
c26af32428a4 Added hops inventory
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
263 $("#notes").val(dataRecord.notes);
c26af32428a4 Added hops inventory
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
264 $("#origin").val(dataRecord.origin);
c26af32428a4 Added hops inventory
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
265 $("#substitutes").val(dataRecord.substitutes);
c26af32428a4 Added hops inventory
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
266 $("#always_on_stock").val(dataRecord.always_on_stock);
c26af32428a4 Added hops inventory
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
267 $("#inventory").val(dataRecord.inventory);
c26af32428a4 Added hops inventory
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
268 $("#cost").val(dataRecord.cost);
c26af32428a4 Added hops inventory
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
269 $("#production_date").val(dataRecord.production_date);
c26af32428a4 Added hops inventory
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
270 $("#tht_date").val(dataRecord.tht_date);
13
b8c3ca152984 Added hops inventory
Michiel Broek <mbroek@mbse.eu>
parents: 12
diff changeset
271 $("#total_oil").val(dataRecord.total_oil);
199
dad62ec9af18 Added total cost values to the fermenter and hop editor screens.
Michiel Broek <mbroek@mbse.eu>
parents: 196
diff changeset
272 calcTotal(dataRecord.cost, dataRecord.inventory);
12
c26af32428a4 Added hops inventory
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
273 // show the popup window.
c26af32428a4 Added hops inventory
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
274 $("#popupWindow").jqxWindow('open');
c26af32428a4 Added hops inventory
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
275 }
c26af32428a4 Added hops inventory
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
276 }
c26af32428a4 Added hops inventory
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
277 ]
c26af32428a4 Added hops inventory
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
278 });
199
dad62ec9af18 Added total cost values to the fermenter and hop editor screens.
Michiel Broek <mbroek@mbse.eu>
parents: 196
diff changeset
279
dad62ec9af18 Added total cost values to the fermenter and hop editor screens.
Michiel Broek <mbroek@mbse.eu>
parents: 196
diff changeset
280 $("#cost").on('change', function (event) {
dad62ec9af18 Added total cost values to the fermenter and hop editor screens.
Michiel Broek <mbroek@mbse.eu>
parents: 196
diff changeset
281 dataRecord.cost = parseFloat(event.args.value);
dad62ec9af18 Added total cost values to the fermenter and hop editor screens.
Michiel Broek <mbroek@mbse.eu>
parents: 196
diff changeset
282 calcTotal(dataRecord.cost, dataRecord.inventory);
dad62ec9af18 Added total cost values to the fermenter and hop editor screens.
Michiel Broek <mbroek@mbse.eu>
parents: 196
diff changeset
283 });
dad62ec9af18 Added total cost values to the fermenter and hop editor screens.
Michiel Broek <mbroek@mbse.eu>
parents: 196
diff changeset
284 $("#inventory").on('change', function (event) {
dad62ec9af18 Added total cost values to the fermenter and hop editor screens.
Michiel Broek <mbroek@mbse.eu>
parents: 196
diff changeset
285 dataRecord.inventory = parseFloat(event.args.value);
dad62ec9af18 Added total cost values to the fermenter and hop editor screens.
Michiel Broek <mbroek@mbse.eu>
parents: 196
diff changeset
286 calcTotal(dataRecord.cost, dataRecord.inventory);
dad62ec9af18 Added total cost values to the fermenter and hop editor screens.
Michiel Broek <mbroek@mbse.eu>
parents: 196
diff changeset
287 });
dad62ec9af18 Added total cost values to the fermenter and hop editor screens.
Michiel Broek <mbroek@mbse.eu>
parents: 196
diff changeset
288
12
c26af32428a4 Added hops inventory
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
289 // initialize the popup window and buttons.
c26af32428a4 Added hops inventory
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
290 $("#popupWindow").jqxWindow({
196
531d5458782f Hops database bool to int types. Dropdown lists are using tables with indexes. Dropdown lists display in Dutch. Save and delete in the database now use POST instead of GET. Removed the useat field. Redesigned the web page. Code cleanup.
Michiel Broek <mbroek@mbse.eu>
parents: 37
diff changeset
291 width: 1050,
531d5458782f Hops database bool to int types. Dropdown lists are using tables with indexes. Dropdown lists display in Dutch. Save and delete in the database now use POST instead of GET. Removed the useat field. Redesigned the web page. Code cleanup.
Michiel Broek <mbroek@mbse.eu>
parents: 37
diff changeset
292 height: 550,
531d5458782f Hops database bool to int types. Dropdown lists are using tables with indexes. Dropdown lists display in Dutch. Save and delete in the database now use POST instead of GET. Removed the useat field. Redesigned the web page. Code cleanup.
Michiel Broek <mbroek@mbse.eu>
parents: 37
diff changeset
293 resizable: false,
531d5458782f Hops database bool to int types. Dropdown lists are using tables with indexes. Dropdown lists display in Dutch. Save and delete in the database now use POST instead of GET. Removed the useat field. Redesigned the web page. Code cleanup.
Michiel Broek <mbroek@mbse.eu>
parents: 37
diff changeset
294 theme: theme,
531d5458782f Hops database bool to int types. Dropdown lists are using tables with indexes. Dropdown lists display in Dutch. Save and delete in the database now use POST instead of GET. Removed the useat field. Redesigned the web page. Code cleanup.
Michiel Broek <mbroek@mbse.eu>
parents: 37
diff changeset
295 isModal: true,
531d5458782f Hops database bool to int types. Dropdown lists are using tables with indexes. Dropdown lists display in Dutch. Save and delete in the database now use POST instead of GET. Removed the useat field. Redesigned the web page. Code cleanup.
Michiel Broek <mbroek@mbse.eu>
parents: 37
diff changeset
296 autoOpen: false,
531d5458782f Hops database bool to int types. Dropdown lists are using tables with indexes. Dropdown lists display in Dutch. Save and delete in the database now use POST instead of GET. Removed the useat field. Redesigned the web page. Code cleanup.
Michiel Broek <mbroek@mbse.eu>
parents: 37
diff changeset
297 cancelButton: $("#Cancel"),
531d5458782f Hops database bool to int types. Dropdown lists are using tables with indexes. Dropdown lists display in Dutch. Save and delete in the database now use POST instead of GET. Removed the useat field. Redesigned the web page. Code cleanup.
Michiel Broek <mbroek@mbse.eu>
parents: 37
diff changeset
298 modalOpacity: 0.40
12
c26af32428a4 Added hops inventory
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
299 });
c26af32428a4 Added hops inventory
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
300 $("#popupWindow").on('open', function () {
c26af32428a4 Added hops inventory
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
301 $("#name").jqxInput('selectAll');
c26af32428a4 Added hops inventory
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
302 });
196
531d5458782f Hops database bool to int types. Dropdown lists are using tables with indexes. Dropdown lists display in Dutch. Save and delete in the database now use POST instead of GET. Removed the useat field. Redesigned the web page. Code cleanup.
Michiel Broek <mbroek@mbse.eu>
parents: 37
diff changeset
303 $("#Delete").jqxButton({ template: "danger", width: '90px', theme: theme });
12
c26af32428a4 Added hops inventory
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
304 $("#Delete").click(function () {
c26af32428a4 Added hops inventory
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
305 if (editrow >= 0) {
c26af32428a4 Added hops inventory
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
306 // Open a popup to confirm this action.
c26af32428a4 Added hops inventory
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
307 $('#eventWindow').jqxWindow('open');
c26af32428a4 Added hops inventory
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
308 $("#delOk").click(function () {
c26af32428a4 Added hops inventory
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
309 var rowID = $('#jqxgrid').jqxGrid('getrowid', editrow);
c26af32428a4 Added hops inventory
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
310 $("#jqxgrid").jqxGrid('deleterow', rowID);
c26af32428a4 Added hops inventory
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
311 });
c26af32428a4 Added hops inventory
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
312 }
c26af32428a4 Added hops inventory
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
313 $("#popupWindow").jqxWindow('hide');
c26af32428a4 Added hops inventory
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
314 });
196
531d5458782f Hops database bool to int types. Dropdown lists are using tables with indexes. Dropdown lists display in Dutch. Save and delete in the database now use POST instead of GET. Removed the useat field. Redesigned the web page. Code cleanup.
Michiel Broek <mbroek@mbse.eu>
parents: 37
diff changeset
315 $("#Cancel").jqxButton({ template: "primary", width: '90px', theme: theme });
284
a93fcd87f561 Hops can be cloned to allow new crop, or different forms.
Michiel Broek <mbroek@mbse.eu>
parents: 269
diff changeset
316 $("#Clone").jqxButton({ template: "warning", width: '90px', theme: theme });
a93fcd87f561 Hops can be cloned to allow new crop, or different forms.
Michiel Broek <mbroek@mbse.eu>
parents: 269
diff changeset
317 $("#Clone").click(function () {
a93fcd87f561 Hops can be cloned to allow new crop, or different forms.
Michiel Broek <mbroek@mbse.eu>
parents: 269
diff changeset
318 var row = {
a93fcd87f561 Hops can be cloned to allow new crop, or different forms.
Michiel Broek <mbroek@mbse.eu>
parents: 269
diff changeset
319 record: -1,
a93fcd87f561 Hops can be cloned to allow new crop, or different forms.
Michiel Broek <mbroek@mbse.eu>
parents: 269
diff changeset
320 name: $("#name").val()+" kopie",
a93fcd87f561 Hops can be cloned to allow new crop, or different forms.
Michiel Broek <mbroek@mbse.eu>
parents: 269
diff changeset
321 alpha: parseFloat($("#alpha").jqxNumberInput('decimal')),
a93fcd87f561 Hops can be cloned to allow new crop, or different forms.
Michiel Broek <mbroek@mbse.eu>
parents: 269
diff changeset
322 beta: parseFloat($("#beta").jqxNumberInput('decimal')),
a93fcd87f561 Hops can be cloned to allow new crop, or different forms.
Michiel Broek <mbroek@mbse.eu>
parents: 269
diff changeset
323 humulene: parseFloat($("#humulene").jqxNumberInput('decimal')),
a93fcd87f561 Hops can be cloned to allow new crop, or different forms.
Michiel Broek <mbroek@mbse.eu>
parents: 269
diff changeset
324 caryophyllene: parseFloat($("#caryophyllene").jqxNumberInput('decimal')),
a93fcd87f561 Hops can be cloned to allow new crop, or different forms.
Michiel Broek <mbroek@mbse.eu>
parents: 269
diff changeset
325 cohumulone: parseFloat($("#cohumulone").jqxNumberInput('decimal')),
a93fcd87f561 Hops can be cloned to allow new crop, or different forms.
Michiel Broek <mbroek@mbse.eu>
parents: 269
diff changeset
326 myrcene: parseFloat($("#myrcene").jqxNumberInput('decimal')),
a93fcd87f561 Hops can be cloned to allow new crop, or different forms.
Michiel Broek <mbroek@mbse.eu>
parents: 269
diff changeset
327 hsi: parseFloat($("#hsi").jqxNumberInput('decimal')),
a93fcd87f561 Hops can be cloned to allow new crop, or different forms.
Michiel Broek <mbroek@mbse.eu>
parents: 269
diff changeset
328 type: $("#type").val(),
a93fcd87f561 Hops can be cloned to allow new crop, or different forms.
Michiel Broek <mbroek@mbse.eu>
parents: 269
diff changeset
329 form: $("#form").val(),
a93fcd87f561 Hops can be cloned to allow new crop, or different forms.
Michiel Broek <mbroek@mbse.eu>
parents: 269
diff changeset
330 notes: $("#notes").val(),
a93fcd87f561 Hops can be cloned to allow new crop, or different forms.
Michiel Broek <mbroek@mbse.eu>
parents: 269
diff changeset
331 origin: $("#origin").val(),
a93fcd87f561 Hops can be cloned to allow new crop, or different forms.
Michiel Broek <mbroek@mbse.eu>
parents: 269
diff changeset
332 substitutes: $("#substitutes").val(),
a93fcd87f561 Hops can be cloned to allow new crop, or different forms.
Michiel Broek <mbroek@mbse.eu>
parents: 269
diff changeset
333 always_on_stock: $("#always_on_stock").val(),
a93fcd87f561 Hops can be cloned to allow new crop, or different forms.
Michiel Broek <mbroek@mbse.eu>
parents: 269
diff changeset
334 inventory: 0,
a93fcd87f561 Hops can be cloned to allow new crop, or different forms.
Michiel Broek <mbroek@mbse.eu>
parents: 269
diff changeset
335 cost: parseFloat($("#cost").jqxNumberInput('decimal')),
a93fcd87f561 Hops can be cloned to allow new crop, or different forms.
Michiel Broek <mbroek@mbse.eu>
parents: 269
diff changeset
336 production_date: '',
a93fcd87f561 Hops can be cloned to allow new crop, or different forms.
Michiel Broek <mbroek@mbse.eu>
parents: 269
diff changeset
337 tht_date: '',
a93fcd87f561 Hops can be cloned to allow new crop, or different forms.
Michiel Broek <mbroek@mbse.eu>
parents: 269
diff changeset
338 total_oil: parseFloat($("#total_oil").jqxNumberInput('decimal'))
a93fcd87f561 Hops can be cloned to allow new crop, or different forms.
Michiel Broek <mbroek@mbse.eu>
parents: 269
diff changeset
339 };
a93fcd87f561 Hops can be cloned to allow new crop, or different forms.
Michiel Broek <mbroek@mbse.eu>
parents: 269
diff changeset
340 $('#jqxgrid').jqxGrid('addrow', null, row);
a93fcd87f561 Hops can be cloned to allow new crop, or different forms.
Michiel Broek <mbroek@mbse.eu>
parents: 269
diff changeset
341 $("#popupWindow").jqxWindow('hide');
a93fcd87f561 Hops can be cloned to allow new crop, or different forms.
Michiel Broek <mbroek@mbse.eu>
parents: 269
diff changeset
342 location.reload( true ); // reload ourself.
a93fcd87f561 Hops can be cloned to allow new crop, or different forms.
Michiel Broek <mbroek@mbse.eu>
parents: 269
diff changeset
343 });
196
531d5458782f Hops database bool to int types. Dropdown lists are using tables with indexes. Dropdown lists display in Dutch. Save and delete in the database now use POST instead of GET. Removed the useat field. Redesigned the web page. Code cleanup.
Michiel Broek <mbroek@mbse.eu>
parents: 37
diff changeset
344 $("#Save").jqxButton({ template: "success", width: '90px', theme: theme });
12
c26af32428a4 Added hops inventory
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
345 // update the edited row when the user clicks the 'Save' button.
c26af32428a4 Added hops inventory
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
346 $("#Save").click(function () {
196
531d5458782f Hops database bool to int types. Dropdown lists are using tables with indexes. Dropdown lists display in Dutch. Save and delete in the database now use POST instead of GET. Removed the useat field. Redesigned the web page. Code cleanup.
Michiel Broek <mbroek@mbse.eu>
parents: 37
diff changeset
347 var rowID = -1;
12
c26af32428a4 Added hops inventory
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
348 if (editrow >= 0) {
c26af32428a4 Added hops inventory
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
349 var rowID = $('#jqxgrid').jqxGrid('getrowid', editrow);
196
531d5458782f Hops database bool to int types. Dropdown lists are using tables with indexes. Dropdown lists display in Dutch. Save and delete in the database now use POST instead of GET. Removed the useat field. Redesigned the web page. Code cleanup.
Michiel Broek <mbroek@mbse.eu>
parents: 37
diff changeset
350 }
531d5458782f Hops database bool to int types. Dropdown lists are using tables with indexes. Dropdown lists display in Dutch. Save and delete in the database now use POST instead of GET. Removed the useat field. Redesigned the web page. Code cleanup.
Michiel Broek <mbroek@mbse.eu>
parents: 37
diff changeset
351 var row = {
531d5458782f Hops database bool to int types. Dropdown lists are using tables with indexes. Dropdown lists display in Dutch. Save and delete in the database now use POST instead of GET. Removed the useat field. Redesigned the web page. Code cleanup.
Michiel Broek <mbroek@mbse.eu>
parents: 37
diff changeset
352 record: rowID,
531d5458782f Hops database bool to int types. Dropdown lists are using tables with indexes. Dropdown lists display in Dutch. Save and delete in the database now use POST instead of GET. Removed the useat field. Redesigned the web page. Code cleanup.
Michiel Broek <mbroek@mbse.eu>
parents: 37
diff changeset
353 name: $("#name").val(),
531d5458782f Hops database bool to int types. Dropdown lists are using tables with indexes. Dropdown lists display in Dutch. Save and delete in the database now use POST instead of GET. Removed the useat field. Redesigned the web page. Code cleanup.
Michiel Broek <mbroek@mbse.eu>
parents: 37
diff changeset
354 alpha: parseFloat($("#alpha").jqxNumberInput('decimal')),
531d5458782f Hops database bool to int types. Dropdown lists are using tables with indexes. Dropdown lists display in Dutch. Save and delete in the database now use POST instead of GET. Removed the useat field. Redesigned the web page. Code cleanup.
Michiel Broek <mbroek@mbse.eu>
parents: 37
diff changeset
355 beta: parseFloat($("#beta").jqxNumberInput('decimal')),
531d5458782f Hops database bool to int types. Dropdown lists are using tables with indexes. Dropdown lists display in Dutch. Save and delete in the database now use POST instead of GET. Removed the useat field. Redesigned the web page. Code cleanup.
Michiel Broek <mbroek@mbse.eu>
parents: 37
diff changeset
356 humulene: parseFloat($("#humulene").jqxNumberInput('decimal')),
531d5458782f Hops database bool to int types. Dropdown lists are using tables with indexes. Dropdown lists display in Dutch. Save and delete in the database now use POST instead of GET. Removed the useat field. Redesigned the web page. Code cleanup.
Michiel Broek <mbroek@mbse.eu>
parents: 37
diff changeset
357 caryophyllene: parseFloat($("#caryophyllene").jqxNumberInput('decimal')),
531d5458782f Hops database bool to int types. Dropdown lists are using tables with indexes. Dropdown lists display in Dutch. Save and delete in the database now use POST instead of GET. Removed the useat field. Redesigned the web page. Code cleanup.
Michiel Broek <mbroek@mbse.eu>
parents: 37
diff changeset
358 cohumulone: parseFloat($("#cohumulone").jqxNumberInput('decimal')),
531d5458782f Hops database bool to int types. Dropdown lists are using tables with indexes. Dropdown lists display in Dutch. Save and delete in the database now use POST instead of GET. Removed the useat field. Redesigned the web page. Code cleanup.
Michiel Broek <mbroek@mbse.eu>
parents: 37
diff changeset
359 myrcene: parseFloat($("#myrcene").jqxNumberInput('decimal')),
531d5458782f Hops database bool to int types. Dropdown lists are using tables with indexes. Dropdown lists display in Dutch. Save and delete in the database now use POST instead of GET. Removed the useat field. Redesigned the web page. Code cleanup.
Michiel Broek <mbroek@mbse.eu>
parents: 37
diff changeset
360 hsi: parseFloat($("#hsi").jqxNumberInput('decimal')),
531d5458782f Hops database bool to int types. Dropdown lists are using tables with indexes. Dropdown lists display in Dutch. Save and delete in the database now use POST instead of GET. Removed the useat field. Redesigned the web page. Code cleanup.
Michiel Broek <mbroek@mbse.eu>
parents: 37
diff changeset
361 type: $("#type").val(),
531d5458782f Hops database bool to int types. Dropdown lists are using tables with indexes. Dropdown lists display in Dutch. Save and delete in the database now use POST instead of GET. Removed the useat field. Redesigned the web page. Code cleanup.
Michiel Broek <mbroek@mbse.eu>
parents: 37
diff changeset
362 form: $("#form").val(),
531d5458782f Hops database bool to int types. Dropdown lists are using tables with indexes. Dropdown lists display in Dutch. Save and delete in the database now use POST instead of GET. Removed the useat field. Redesigned the web page. Code cleanup.
Michiel Broek <mbroek@mbse.eu>
parents: 37
diff changeset
363 notes: $("#notes").val(),
531d5458782f Hops database bool to int types. Dropdown lists are using tables with indexes. Dropdown lists display in Dutch. Save and delete in the database now use POST instead of GET. Removed the useat field. Redesigned the web page. Code cleanup.
Michiel Broek <mbroek@mbse.eu>
parents: 37
diff changeset
364 origin: $("#origin").val(),
531d5458782f Hops database bool to int types. Dropdown lists are using tables with indexes. Dropdown lists display in Dutch. Save and delete in the database now use POST instead of GET. Removed the useat field. Redesigned the web page. Code cleanup.
Michiel Broek <mbroek@mbse.eu>
parents: 37
diff changeset
365 substitutes: $("#substitutes").val(),
531d5458782f Hops database bool to int types. Dropdown lists are using tables with indexes. Dropdown lists display in Dutch. Save and delete in the database now use POST instead of GET. Removed the useat field. Redesigned the web page. Code cleanup.
Michiel Broek <mbroek@mbse.eu>
parents: 37
diff changeset
366 always_on_stock: $("#always_on_stock").val(),
531d5458782f Hops database bool to int types. Dropdown lists are using tables with indexes. Dropdown lists display in Dutch. Save and delete in the database now use POST instead of GET. Removed the useat field. Redesigned the web page. Code cleanup.
Michiel Broek <mbroek@mbse.eu>
parents: 37
diff changeset
367 inventory: parseFloat($("#inventory").jqxNumberInput('decimal')),
531d5458782f Hops database bool to int types. Dropdown lists are using tables with indexes. Dropdown lists display in Dutch. Save and delete in the database now use POST instead of GET. Removed the useat field. Redesigned the web page. Code cleanup.
Michiel Broek <mbroek@mbse.eu>
parents: 37
diff changeset
368 cost: parseFloat($("#cost").jqxNumberInput('decimal')),
531d5458782f Hops database bool to int types. Dropdown lists are using tables with indexes. Dropdown lists display in Dutch. Save and delete in the database now use POST instead of GET. Removed the useat field. Redesigned the web page. Code cleanup.
Michiel Broek <mbroek@mbse.eu>
parents: 37
diff changeset
369 production_date: $("#production_date").val(),
531d5458782f Hops database bool to int types. Dropdown lists are using tables with indexes. Dropdown lists display in Dutch. Save and delete in the database now use POST instead of GET. Removed the useat field. Redesigned the web page. Code cleanup.
Michiel Broek <mbroek@mbse.eu>
parents: 37
diff changeset
370 tht_date: $("#tht_date").val(),
531d5458782f Hops database bool to int types. Dropdown lists are using tables with indexes. Dropdown lists display in Dutch. Save and delete in the database now use POST instead of GET. Removed the useat field. Redesigned the web page. Code cleanup.
Michiel Broek <mbroek@mbse.eu>
parents: 37
diff changeset
371 total_oil: parseFloat($("#total_oil").jqxNumberInput('decimal'))
531d5458782f Hops database bool to int types. Dropdown lists are using tables with indexes. Dropdown lists display in Dutch. Save and delete in the database now use POST instead of GET. Removed the useat field. Redesigned the web page. Code cleanup.
Michiel Broek <mbroek@mbse.eu>
parents: 37
diff changeset
372 };
531d5458782f Hops database bool to int types. Dropdown lists are using tables with indexes. Dropdown lists display in Dutch. Save and delete in the database now use POST instead of GET. Removed the useat field. Redesigned the web page. Code cleanup.
Michiel Broek <mbroek@mbse.eu>
parents: 37
diff changeset
373 if (editrow >= 0) {
12
c26af32428a4 Added hops inventory
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
374 $('#jqxgrid').jqxGrid('updaterow', rowID, row);
c26af32428a4 Added hops inventory
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
375 } else {
196
531d5458782f Hops database bool to int types. Dropdown lists are using tables with indexes. Dropdown lists display in Dutch. Save and delete in the database now use POST instead of GET. Removed the useat field. Redesigned the web page. Code cleanup.
Michiel Broek <mbroek@mbse.eu>
parents: 37
diff changeset
376 $('#jqxgrid').jqxGrid('addrow', null, row);
12
c26af32428a4 Added hops inventory
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
377 }
196
531d5458782f Hops database bool to int types. Dropdown lists are using tables with indexes. Dropdown lists display in Dutch. Save and delete in the database now use POST instead of GET. Removed the useat field. Redesigned the web page. Code cleanup.
Michiel Broek <mbroek@mbse.eu>
parents: 37
diff changeset
378 $("#popupWindow").jqxWindow('hide');
531d5458782f Hops database bool to int types. Dropdown lists are using tables with indexes. Dropdown lists display in Dutch. Save and delete in the database now use POST instead of GET. Removed the useat field. Redesigned the web page. Code cleanup.
Michiel Broek <mbroek@mbse.eu>
parents: 37
diff changeset
379 location.reload( true ); // reload ourself.
12
c26af32428a4 Added hops inventory
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
380 });
c26af32428a4 Added hops inventory
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
381 createDelElements();
c26af32428a4 Added hops inventory
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
382 });
c26af32428a4 Added hops inventory
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
383

mercurial