www/js/inv_hops.js

Tue, 22 Jan 2019 22:46:58 +0100

author
Michiel Broek <mbroek@mbse.eu>
date
Tue, 22 Jan 2019 22:46:58 +0100
changeset 196
531d5458782f
parent 37
9362eb9e9e5b
child 199
dad62ec9af18
permissions
-rw-r--r--

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.

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 () {
c26af32428a4 Added hops inventory
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
46 var url = "includes/db_inventory_hops.php";
c26af32428a4 Added hops inventory
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
47 // prepare the data
c26af32428a4 Added hops inventory
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
48 var source = {
c26af32428a4 Added hops inventory
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
49 datatype: "json",
c26af32428a4 Added hops inventory
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
50 cache: false,
c26af32428a4 Added hops inventory
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
51 datafields: [
c26af32428a4 Added hops inventory
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
52 { name: 'record', type: 'number' },
c26af32428a4 Added hops inventory
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
53 { name: 'name', type: 'string' },
c26af32428a4 Added hops inventory
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
54 { name: 'alpha', type: 'float' },
c26af32428a4 Added hops inventory
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
55 { name: 'beta', type: 'float' },
c26af32428a4 Added hops inventory
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
56 { name: 'humulene', type: 'float' },
c26af32428a4 Added hops inventory
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
57 { name: 'caryophyllene', type: 'float' },
c26af32428a4 Added hops inventory
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
58 { name: 'cohumulone', type: 'float' },
c26af32428a4 Added hops inventory
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
59 { name: 'myrcene', type: 'float' },
13
b8c3ca152984 Added hops inventory
Michiel Broek <mbroek@mbse.eu>
parents: 12
diff changeset
60 { 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
61 { 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
62 { name: 'form', type: 'int' },
12
c26af32428a4 Added hops inventory
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
63 { name: 'notes', type: 'string' },
c26af32428a4 Added hops inventory
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
64 { name: 'origin', type: 'string' },
c26af32428a4 Added hops inventory
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
65 { 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
66 { name: 'always_on_stock', type: 'int' },
12
c26af32428a4 Added hops inventory
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
67 { name: 'inventory', type: 'float' },
c26af32428a4 Added hops inventory
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
68 { name: 'cost', type: 'float' },
c26af32428a4 Added hops inventory
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
69 { name: 'production_date', type: 'string' },
c26af32428a4 Added hops inventory
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
70 { name: 'tht_date', type: 'string' },
13
b8c3ca152984 Added hops inventory
Michiel Broek <mbroek@mbse.eu>
parents: 12
diff changeset
71 { name: 'total_oil', type: 'float' }
12
c26af32428a4 Added hops inventory
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
72 ],
c26af32428a4 Added hops inventory
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
73 id: 'record',
c26af32428a4 Added hops inventory
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
74 url: url,
c26af32428a4 Added hops inventory
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
75 deleterow: function (rowid, commit) {
c26af32428a4 Added hops inventory
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
76 // synchronize with the server - send delete command
c26af32428a4 Added hops inventory
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
77 var data = "delete=true&" + $.param({ record: rowid });
c26af32428a4 Added hops inventory
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
78 $.ajax({
c26af32428a4 Added hops inventory
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
79 dataType: 'json',
c26af32428a4 Added hops inventory
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
80 url: url,
c26af32428a4 Added hops inventory
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
81 cache: false,
c26af32428a4 Added hops inventory
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
82 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
83 type: "POST",
12
c26af32428a4 Added hops inventory
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
84 success: function (data, status, xhr) {
c26af32428a4 Added hops inventory
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
85 // delete command is executed.
c26af32428a4 Added hops inventory
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
86 commit(true);
c26af32428a4 Added hops inventory
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
87 },
c26af32428a4 Added hops inventory
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
88 error: function (jqXHR, textStatus, errorThrown) {
c26af32428a4 Added hops inventory
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
89 commit(false);
c26af32428a4 Added hops inventory
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
90 }
c26af32428a4 Added hops inventory
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
91 });
c26af32428a4 Added hops inventory
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
92 },
c26af32428a4 Added hops inventory
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
93 addrow: function (rowid, rowdata, position, commit) {
c26af32428a4 Added hops inventory
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
94 var data = "insert=true&" + $.param(rowdata);
c26af32428a4 Added hops inventory
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
95 $.ajax({
c26af32428a4 Added hops inventory
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
96 dataType: 'json',
c26af32428a4 Added hops inventory
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
97 url: url,
c26af32428a4 Added hops inventory
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
98 cache: false,
c26af32428a4 Added hops inventory
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
99 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
100 type: "POST",
12
c26af32428a4 Added hops inventory
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
101 success: function (data, status, xhr) {
c26af32428a4 Added hops inventory
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
102 commit(true);
c26af32428a4 Added hops inventory
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
103 },
c26af32428a4 Added hops inventory
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
104 error: function(jqXHR, textStatus, errorThrown) {
c26af32428a4 Added hops inventory
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
105 commit(false);
c26af32428a4 Added hops inventory
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
106 }
c26af32428a4 Added hops inventory
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
107 });
c26af32428a4 Added hops inventory
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
108 },
c26af32428a4 Added hops inventory
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
109 updaterow: function (rowid, rowdata, commit) {
c26af32428a4 Added hops inventory
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
110 var data = "update=true&" + $.param(rowdata);
c26af32428a4 Added hops inventory
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
111 $.ajax({
c26af32428a4 Added hops inventory
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
112 dataType: 'json',
c26af32428a4 Added hops inventory
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
113 url: url,
c26af32428a4 Added hops inventory
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
114 cache: false,
c26af32428a4 Added hops inventory
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
115 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
116 type: "POST",
12
c26af32428a4 Added hops inventory
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
117 success: function (data, status, xhr) {
c26af32428a4 Added hops inventory
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
118 // update command is executed.
c26af32428a4 Added hops inventory
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
119 commit(true);
c26af32428a4 Added hops inventory
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
120 },
c26af32428a4 Added hops inventory
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
121 error: function(jqXHR, textStatus, errorThrown) {
c26af32428a4 Added hops inventory
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
122 commit(false);
c26af32428a4 Added hops inventory
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
123 }
c26af32428a4 Added hops inventory
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
124 });
c26af32428a4 Added hops inventory
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
125 }
c26af32428a4 Added hops inventory
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
126 };
c26af32428a4 Added hops inventory
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
127 var srcType = [ "Bittering", "Aroma", "Both" ];
c26af32428a4 Added hops inventory
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
128 var srcForm = [ "Pellet", "Plug", "Leaf" ];
c26af32428a4 Added hops inventory
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
129 // 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
130 $("#name").jqxInput({ theme: theme, width: 640, 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
131 $("#alpha").jqxNumberInput( Perc1dec1 );
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
132 $("#beta").jqxNumberInput( Perc1dec1 );
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
133 $("#humulene").jqxNumberInput( Perc1dec1 );
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
134 $("#caryophyllene").jqxNumberInput( Perc1dec1 );
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
135 $("#cohumulone").jqxNumberInput( Perc1dec1 );
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 $("#myrcene").jqxNumberInput( Perc1dec1 );
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
137 $("#hsi").jqxNumberInput( Perc1dec5 );
12
c26af32428a4 Added hops inventory
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
138
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
139 $("#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
140 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
141 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
142 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
143 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
144 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
145 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
146 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
147 });
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 $("#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
149 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
150 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
151 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
152 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
153 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
154 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
155 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
156 });
13
b8c3ca152984 Added hops inventory
Michiel Broek <mbroek@mbse.eu>
parents: 12
diff changeset
157 $("#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
158 $("#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
159 $("#substitutes").jqxInput({ theme: theme, width: 320, height: 23 });
12
c26af32428a4 Added hops inventory
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
160 $("#always_on_stock").jqxCheckBox({ theme: theme, width: 120, height: 23 });
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
161 $("#inventory").jqxNumberInput( Spin1dec1 );
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 $("#production_date").jqxDateTimeInput( Dateopts );
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
163 $("#cost").jqxNumberInput( Spin2dec1 );
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 $("#tht_date").jqxDateTimeInput( Dateopts );
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 $("#total_oil").jqxNumberInput( Perc1dec1 );
12
c26af32428a4 Added hops inventory
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
166 var dataAdapter = new $.jqx.dataAdapter(source);
c26af32428a4 Added hops inventory
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
167 var editrow = -1;
c26af32428a4 Added hops inventory
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
168 // initialize jqxGrid
c26af32428a4 Added hops inventory
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
169 $("#jqxgrid").jqxGrid({
c26af32428a4 Added hops inventory
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
170 width: 1280,
c26af32428a4 Added hops inventory
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
171 height: 630,
c26af32428a4 Added hops inventory
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
172 source: dataAdapter,
c26af32428a4 Added hops inventory
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
173 theme: theme,
c26af32428a4 Added hops inventory
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
174 showstatusbar: true,
13
b8c3ca152984 Added hops inventory
Michiel Broek <mbroek@mbse.eu>
parents: 12
diff changeset
175 localization: getLocalization(),
12
c26af32428a4 Added hops inventory
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
176 renderstatusbar: function (statusbar) {
c26af32428a4 Added hops inventory
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
177 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
178 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
179 container.append(addButton);
c26af32428a4 Added hops inventory
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
180 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
181 addButton.jqxButton({ theme: theme, width: 90, height: 20 });
12
c26af32428a4 Added hops inventory
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
182 // add new row.
c26af32428a4 Added hops inventory
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
183 addButton.click(function (event) {
c26af32428a4 Added hops inventory
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
184 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
185 $("#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
186 $("#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
187 $("#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
188 $("#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
189 $("#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
190 $("#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
191 $("#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
192 $("#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
193 $("#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
194 $("#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
195 $("#form").val(0);
12
c26af32428a4 Added hops inventory
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
196 $("#notes").val('');
c26af32428a4 Added hops inventory
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
197 $("#origin").val('');
c26af32428a4 Added hops inventory
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
198 $("#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
199 $("#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
200 $("#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
201 $("#cost").val(0);
12
c26af32428a4 Added hops inventory
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
202 $("#production_date").val('');
c26af32428a4 Added hops inventory
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
203 $("#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
204 $("#total_oil").val(0);
12
c26af32428a4 Added hops inventory
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
205 $("#popupWindow").jqxWindow('open');
c26af32428a4 Added hops inventory
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
206 });
c26af32428a4 Added hops inventory
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
207 },
c26af32428a4 Added hops inventory
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
208 filterable: true,
c26af32428a4 Added hops inventory
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
209 filtermode: 'excel',
c26af32428a4 Added hops inventory
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
210 columns: [
37
9362eb9e9e5b Sorting the inventory and changes some grid tables.
Michiel Broek <mbroek@mbse.eu>
parents: 34
diff changeset
211 { text: 'Herkomst', datafield: 'origin', align: 'center', cellsalign: 'center', width: 150 },
9362eb9e9e5b Sorting the inventory and changes some grid tables.
Michiel Broek <mbroek@mbse.eu>
parents: 34
diff changeset
212 { text: 'Hop Naam', datafield: 'name' },
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
213 { text: 'Soort', datafield: 'type', align: 'center', cellsalign: 'center', width: 90,
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
214 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
215 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
216 }
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
217 },
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
218 { text: 'Vorm', datafield: 'form', align: 'center', cellsalign: 'center', width: 90,
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
219 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
220 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
221 }
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 },
30
f5ab22446aa5 Inventory fermentables and hops to standard weight format.
Michiel Broek <mbroek@mbse.eu>
parents: 19
diff changeset
223 { text: 'Alpha %', datafield: 'alpha', width: 80, align: 'right', cellsalign: 'right', cellsformat: 'p1' },
f5ab22446aa5 Inventory fermentables and hops to standard weight format.
Michiel Broek <mbroek@mbse.eu>
parents: 19
diff changeset
224 { text: 'Beta %', datafield: 'beta', width: 80, align: 'right', cellsalign: 'right', cellsformat: 'p1' },
f5ab22446aa5 Inventory fermentables and hops to standard weight format.
Michiel Broek <mbroek@mbse.eu>
parents: 19
diff changeset
225 { text: 'Cohumuloon %%', datafield: 'cohumulone', width: 80, align: 'right', cellsalign: 'right', cellsformat: 'p1' },
f5ab22446aa5 Inventory fermentables and hops to standard weight format.
Michiel Broek <mbroek@mbse.eu>
parents: 19
diff changeset
226 { text: 'HSI', datafield: 'hsi', width: 60, align: 'right', cellsalign: 'right', cellsformat: 'f1' },
f5ab22446aa5 Inventory fermentables and hops to standard weight format.
Michiel Broek <mbroek@mbse.eu>
parents: 19
diff changeset
227 { text: 'Oogst datum', datafield: 'production_date', align: 'center', cellsalign: 'center', width: 100 },
f5ab22446aa5 Inventory fermentables and hops to standard weight format.
Michiel Broek <mbroek@mbse.eu>
parents: 19
diff changeset
228 { text: 'Voor, gr.', datafield: 'inventory', width: 70, align: 'right', cellsalign: 'right', cellsformat: 'f1' },
f5ab22446aa5 Inventory fermentables and hops to standard weight format.
Michiel Broek <mbroek@mbse.eu>
parents: 19
diff changeset
229 { text: 'Prijs /kg', datafield: 'cost', width: 70, align: 'right', cellsalign: 'right', cellsformat: 'c2' },
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
230 { text: 'Wijzig', datafield: 'Wijzig', columntype: 'button', width: 100, align: 'center', cellsrenderer: function () {
34
a720353fada9 Formatting and measurements
Michiel Broek <mbroek@mbse.eu>
parents: 30
diff changeset
231 return "Wijzig";
12
c26af32428a4 Added hops inventory
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
232 }, buttonclick: function (row) {
c26af32428a4 Added hops inventory
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
233 // open the popup window when the user clicks a button.
c26af32428a4 Added hops inventory
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
234 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
235 $("#popupWindow").jqxWindow({ position: { x: 110, y: 30 } });
12
c26af32428a4 Added hops inventory
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
236 // get the clicked row's data and initialize the input fields.
c26af32428a4 Added hops inventory
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
237 var dataRecord = $("#jqxgrid").jqxGrid('getrowdata', editrow);
c26af32428a4 Added hops inventory
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
238 $("#name").val(dataRecord.name);
c26af32428a4 Added hops inventory
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
239 $("#alpha").val(dataRecord.alpha);
c26af32428a4 Added hops inventory
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
240 $("#beta").val(dataRecord.beta);
c26af32428a4 Added hops inventory
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
241 $("#humulene").val(dataRecord.humulene);
c26af32428a4 Added hops inventory
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
242 $("#caryophyllene").val(dataRecord.caryophyllene);
c26af32428a4 Added hops inventory
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
243 $("#cohumulone").val(dataRecord.cohumulone);
c26af32428a4 Added hops inventory
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
244 $("#myrcene").val(dataRecord.myrcene);
13
b8c3ca152984 Added hops inventory
Michiel Broek <mbroek@mbse.eu>
parents: 12
diff changeset
245 $("#hsi").val(dataRecord.hsi);
12
c26af32428a4 Added hops inventory
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
246 $("#type").val(dataRecord.type);
c26af32428a4 Added hops inventory
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
247 $("#form").val(dataRecord.form);
c26af32428a4 Added hops inventory
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
248 $("#notes").val(dataRecord.notes);
c26af32428a4 Added hops inventory
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
249 $("#origin").val(dataRecord.origin);
c26af32428a4 Added hops inventory
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
250 $("#substitutes").val(dataRecord.substitutes);
c26af32428a4 Added hops inventory
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
251 $("#always_on_stock").val(dataRecord.always_on_stock);
c26af32428a4 Added hops inventory
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
252 $("#inventory").val(dataRecord.inventory);
c26af32428a4 Added hops inventory
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
253 $("#cost").val(dataRecord.cost);
c26af32428a4 Added hops inventory
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
254 $("#production_date").val(dataRecord.production_date);
c26af32428a4 Added hops inventory
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
255 $("#tht_date").val(dataRecord.tht_date);
13
b8c3ca152984 Added hops inventory
Michiel Broek <mbroek@mbse.eu>
parents: 12
diff changeset
256 $("#total_oil").val(dataRecord.total_oil);
12
c26af32428a4 Added hops inventory
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
257 // show the popup window.
c26af32428a4 Added hops inventory
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
258 $("#popupWindow").jqxWindow('open');
c26af32428a4 Added hops inventory
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
259 }
c26af32428a4 Added hops inventory
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
260 }
c26af32428a4 Added hops inventory
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
261 ]
c26af32428a4 Added hops inventory
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
262 });
c26af32428a4 Added hops inventory
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
263 // initialize the popup window and buttons.
c26af32428a4 Added hops inventory
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
264 $("#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
265 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
266 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
267 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
268 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
269 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
270 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
271 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
272 modalOpacity: 0.40
12
c26af32428a4 Added hops inventory
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
273 });
c26af32428a4 Added hops inventory
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
274 $("#popupWindow").on('open', function () {
c26af32428a4 Added hops inventory
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
275 $("#name").jqxInput('selectAll');
c26af32428a4 Added hops inventory
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
276 });
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
277 $("#Delete").jqxButton({ template: "danger", width: '90px', theme: theme });
12
c26af32428a4 Added hops inventory
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
278 $("#Delete").click(function () {
c26af32428a4 Added hops inventory
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
279 if (editrow >= 0) {
c26af32428a4 Added hops inventory
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
280 // Open a popup to confirm this action.
c26af32428a4 Added hops inventory
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
281 $('#eventWindow').jqxWindow('open');
c26af32428a4 Added hops inventory
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
282 $("#delOk").click(function () {
c26af32428a4 Added hops inventory
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
283 var rowID = $('#jqxgrid').jqxGrid('getrowid', editrow);
c26af32428a4 Added hops inventory
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
284 $("#jqxgrid").jqxGrid('deleterow', rowID);
c26af32428a4 Added hops inventory
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
285 });
c26af32428a4 Added hops inventory
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
286 }
c26af32428a4 Added hops inventory
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
287 $("#popupWindow").jqxWindow('hide');
c26af32428a4 Added hops inventory
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
288 });
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
289 $("#Cancel").jqxButton({ template: "primary", width: '90px', 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
290 $("#Save").jqxButton({ template: "success", width: '90px', theme: theme });
12
c26af32428a4 Added hops inventory
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
291 // update the edited row when the user clicks the 'Save' button.
c26af32428a4 Added hops inventory
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
292 $("#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
293 var rowID = -1;
12
c26af32428a4 Added hops inventory
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
294 if (editrow >= 0) {
c26af32428a4 Added hops inventory
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
295 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
296 }
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 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
298 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
299 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
300 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
301 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
302 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
303 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
304 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
305 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
306 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
307 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
308 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
309 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
310 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
311 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
312 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
313 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
314 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
315 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
316 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
317 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
318 };
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
319 if (editrow >= 0) {
12
c26af32428a4 Added hops inventory
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
320 $('#jqxgrid').jqxGrid('updaterow', rowID, row);
c26af32428a4 Added hops inventory
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
321 } 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
322 $('#jqxgrid').jqxGrid('addrow', null, row);
12
c26af32428a4 Added hops inventory
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
323 }
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
324 $("#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
325 location.reload( true ); // reload ourself.
12
c26af32428a4 Added hops inventory
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
326 });
c26af32428a4 Added hops inventory
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
327 createDelElements();
c26af32428a4 Added hops inventory
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
328 });
c26af32428a4 Added hops inventory
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
329

mercurial