www/js/inv_yeasts.js

Thu, 24 Jan 2019 20:54:45 +0100

author
Michiel Broek <mbroek@mbse.eu>
date
Thu, 24 Jan 2019 20:54:45 +0100
changeset 200
7b2f11652d67
parent 198
f0ec83e1e01f
child 201
f9b7e3f6be7c
permissions
-rw-r--r--

Miscs from bool to ints. Miscs database uses POST instead of GET. Dropdowns are unsing indexes. Dynamic edit screen adjust for weight and liter. Edit screen redesigned. Friendly show duration of ingredients.

14
d9dfd703df83 Added yeast inventory screens
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1 /*****************************************************************************
198
f0ec83e1e01f Switches yeasts inventory to indexed names and translations. Database save is using POST instead of GET. Redesigned the web page. Added total cost display which updates on inventory changes.
Michiel Broek <mbroek@mbse.eu>
parents: 37
diff changeset
2 * Copyright (C) 2014-2019
14
d9dfd703df83 Added yeast inventory screens
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
3 *
d9dfd703df83 Added yeast inventory screens
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
4 * Michiel Broek <mbroek at mbse dot eu>
d9dfd703df83 Added yeast inventory screens
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
5 *
d9dfd703df83 Added yeast inventory screens
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
6 * This file is part of BrewCloud
d9dfd703df83 Added yeast inventory screens
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
7 *
d9dfd703df83 Added yeast inventory screens
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
8 * This is free software; you can redistribute it and/or modify it
d9dfd703df83 Added yeast inventory screens
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
9 * under the terms of the GNU General Public License as published by the
d9dfd703df83 Added yeast inventory screens
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
10 * Free Software Foundation; either version 2, or (at your option) any
d9dfd703df83 Added yeast inventory screens
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
11 * later version.
d9dfd703df83 Added yeast inventory screens
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
12 *
d9dfd703df83 Added yeast inventory screens
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
13 * BrewCloud is distributed in the hope that it will be useful, but
d9dfd703df83 Added yeast inventory screens
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
14 * WITHOUT ANY WARRANTY; without even the implied warranty of
d9dfd703df83 Added yeast inventory screens
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
d9dfd703df83 Added yeast inventory screens
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
16 * General Public License for more details.
d9dfd703df83 Added yeast inventory screens
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
17 *
d9dfd703df83 Added yeast inventory screens
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
18 * You should have received a copy of the GNU General Public License
d9dfd703df83 Added yeast inventory screens
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
19 * along with ThermFerm; see the file COPYING. If not, write to the Free
d9dfd703df83 Added yeast inventory screens
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
20 * Software Foundation, 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
d9dfd703df83 Added yeast inventory screens
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
21 *****************************************************************************/
d9dfd703df83 Added yeast inventory screens
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
22
d9dfd703df83 Added yeast inventory screens
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
23
d9dfd703df83 Added yeast inventory screens
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
24 function createDelElements() {
d9dfd703df83 Added yeast inventory screens
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
25 $('#eventWindow').jqxWindow({
d9dfd703df83 Added yeast inventory screens
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
26 theme: theme,
d9dfd703df83 Added yeast inventory screens
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
27 position: { x: 490, y: 210 },
d9dfd703df83 Added yeast inventory screens
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
28 width: 300,
34
a720353fada9 Formatting and measurements
Michiel Broek <mbroek@mbse.eu>
parents: 33
diff changeset
29 height: 175,
14
d9dfd703df83 Added yeast inventory screens
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
30 resizable: false,
d9dfd703df83 Added yeast inventory screens
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
31 isModal: true,
d9dfd703df83 Added yeast inventory screens
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
32 modalOpacity: 0.4,
d9dfd703df83 Added yeast inventory screens
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
33 okButton: $('#delOk'),
d9dfd703df83 Added yeast inventory screens
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
34 cancelButton: $('#delCancel'),
d9dfd703df83 Added yeast inventory screens
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
35 initContent: function () {
198
f0ec83e1e01f Switches yeasts inventory to indexed names and translations. Database save is using POST instead of GET. Redesigned the web page. Added total cost display which updates on inventory changes.
Michiel Broek <mbroek@mbse.eu>
parents: 37
diff changeset
36 $('#delOk').jqxButton({ template: "danger", width: '65px', theme: theme });
f0ec83e1e01f Switches yeasts inventory to indexed names and translations. Database save is using POST instead of GET. Redesigned the web page. Added total cost display which updates on inventory changes.
Michiel Broek <mbroek@mbse.eu>
parents: 37
diff changeset
37 $('#delCancel').jqxButton({ template: "success", width: '65px', theme: theme });
14
d9dfd703df83 Added yeast inventory screens
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
38 $('#delCancel').focus();
d9dfd703df83 Added yeast inventory screens
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
39 }
d9dfd703df83 Added yeast inventory screens
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
40 });
d9dfd703df83 Added yeast inventory screens
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
41 $('#eventWindow').jqxWindow('hide');
d9dfd703df83 Added yeast inventory screens
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
42 }
d9dfd703df83 Added yeast inventory screens
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
43
d9dfd703df83 Added yeast inventory screens
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
44
d9dfd703df83 Added yeast inventory screens
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
45 $(document).ready(function () {
198
f0ec83e1e01f Switches yeasts inventory to indexed names and translations. Database save is using POST instead of GET. Redesigned the web page. Added total cost display which updates on inventory changes.
Michiel Broek <mbroek@mbse.eu>
parents: 37
diff changeset
46
f0ec83e1e01f Switches yeasts inventory to indexed names and translations. Database save is using POST instead of GET. Redesigned the web page. Added total cost display which updates on inventory changes.
Michiel Broek <mbroek@mbse.eu>
parents: 37
diff changeset
47 var dataRecord = {};
f0ec83e1e01f Switches yeasts inventory to indexed names and translations. Database save is using POST instead of GET. Redesigned the web page. Added total cost display which updates on inventory changes.
Michiel Broek <mbroek@mbse.eu>
parents: 37
diff changeset
48
f0ec83e1e01f Switches yeasts inventory to indexed names and translations. Database save is using POST instead of GET. Redesigned the web page. Added total cost display which updates on inventory changes.
Michiel Broek <mbroek@mbse.eu>
parents: 37
diff changeset
49 function calcTotal(cost, inventory) {
f0ec83e1e01f Switches yeasts inventory to indexed names and translations. Database save is using POST instead of GET. Redesigned the web page. Added total cost display which updates on inventory changes.
Michiel Broek <mbroek@mbse.eu>
parents: 37
diff changeset
50
f0ec83e1e01f Switches yeasts inventory to indexed names and translations. Database save is using POST instead of GET. Redesigned the web page. Added total cost display which updates on inventory changes.
Michiel Broek <mbroek@mbse.eu>
parents: 37
diff changeset
51 $('#totval').val(cost * (inventory / 1000));
f0ec83e1e01f Switches yeasts inventory to indexed names and translations. Database save is using POST instead of GET. Redesigned the web page. Added total cost display which updates on inventory changes.
Michiel Broek <mbroek@mbse.eu>
parents: 37
diff changeset
52 }
f0ec83e1e01f Switches yeasts inventory to indexed names and translations. Database save is using POST instead of GET. Redesigned the web page. Added total cost display which updates on inventory changes.
Michiel Broek <mbroek@mbse.eu>
parents: 37
diff changeset
53
14
d9dfd703df83 Added yeast inventory screens
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
54 var url = "includes/db_inventory_yeasts.php";
d9dfd703df83 Added yeast inventory screens
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
55 // prepare the data
d9dfd703df83 Added yeast inventory screens
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
56 var source = {
d9dfd703df83 Added yeast inventory screens
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
57 datatype: "json",
d9dfd703df83 Added yeast inventory screens
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
58 cache: false,
d9dfd703df83 Added yeast inventory screens
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
59 datafields: [
d9dfd703df83 Added yeast inventory screens
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
60 { name: 'record', type: 'number' },
d9dfd703df83 Added yeast inventory screens
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
61 { name: 'name', type: 'string' },
198
f0ec83e1e01f Switches yeasts inventory to indexed names and translations. Database save is using POST instead of GET. Redesigned the web page. Added total cost display which updates on inventory changes.
Michiel Broek <mbroek@mbse.eu>
parents: 37
diff changeset
62 { name: 'type', type: 'int' },
f0ec83e1e01f Switches yeasts inventory to indexed names and translations. Database save is using POST instead of GET. Redesigned the web page. Added total cost display which updates on inventory changes.
Michiel Broek <mbroek@mbse.eu>
parents: 37
diff changeset
63 { name: 'form', type: 'int' },
14
d9dfd703df83 Added yeast inventory screens
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
64 { name: 'laboratory', type: 'string' },
d9dfd703df83 Added yeast inventory screens
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
65 { name: 'product_id', type: 'string' },
198
f0ec83e1e01f Switches yeasts inventory to indexed names and translations. Database save is using POST instead of GET. Redesigned the web page. Added total cost display which updates on inventory changes.
Michiel Broek <mbroek@mbse.eu>
parents: 37
diff changeset
66 { name: 'min_temperature', type: 'float' },
f0ec83e1e01f Switches yeasts inventory to indexed names and translations. Database save is using POST instead of GET. Redesigned the web page. Added total cost display which updates on inventory changes.
Michiel Broek <mbroek@mbse.eu>
parents: 37
diff changeset
67 { name: 'max_temperature', type: 'float' },
f0ec83e1e01f Switches yeasts inventory to indexed names and translations. Database save is using POST instead of GET. Redesigned the web page. Added total cost display which updates on inventory changes.
Michiel Broek <mbroek@mbse.eu>
parents: 37
diff changeset
68 { name: 'flocculation', type: 'int' },
14
d9dfd703df83 Added yeast inventory screens
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
69 { name: 'attenuation', type: 'float' },
d9dfd703df83 Added yeast inventory screens
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
70 { name: 'notes', type: 'string' },
d9dfd703df83 Added yeast inventory screens
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
71 { name: 'best_for', type: 'string' },
198
f0ec83e1e01f Switches yeasts inventory to indexed names and translations. Database save is using POST instead of GET. Redesigned the web page. Added total cost display which updates on inventory changes.
Michiel Broek <mbroek@mbse.eu>
parents: 37
diff changeset
72 { name: 'max_reuse', type: 'int' },
14
d9dfd703df83 Added yeast inventory screens
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
73 { name: 'inventory', type: 'float' },
d9dfd703df83 Added yeast inventory screens
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
74 { name: 'cost', type: 'float' },
d9dfd703df83 Added yeast inventory screens
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
75 { name: 'production_date', type: 'string' },
200
7b2f11652d67 Miscs from bool to ints. Miscs database uses POST instead of GET. Dropdowns are unsing indexes. Dynamic edit screen adjust for weight and liter. Edit screen redesigned. Friendly show duration of ingredients.
Michiel Broek <mbroek@mbse.eu>
parents: 198
diff changeset
76 { name: 'tht_date', type: 'string' },
7b2f11652d67 Miscs from bool to ints. Miscs database uses POST instead of GET. Dropdowns are unsing indexes. Dynamic edit screen adjust for weight and liter. Edit screen redesigned. Friendly show duration of ingredients.
Michiel Broek <mbroek@mbse.eu>
parents: 198
diff changeset
77 { name: 'cells', type: 'float' }
14
d9dfd703df83 Added yeast inventory screens
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
78 ],
d9dfd703df83 Added yeast inventory screens
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
79 id: 'record',
d9dfd703df83 Added yeast inventory screens
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
80 url: url,
d9dfd703df83 Added yeast inventory screens
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
81 deleterow: function (rowid, commit) {
d9dfd703df83 Added yeast inventory screens
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
82 // synchronize with the server - send delete command
d9dfd703df83 Added yeast inventory screens
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
83 var data = "delete=true&" + $.param({ record: rowid });
d9dfd703df83 Added yeast inventory screens
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
84 $.ajax({
d9dfd703df83 Added yeast inventory screens
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
85 dataType: 'json',
d9dfd703df83 Added yeast inventory screens
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
86 url: url,
d9dfd703df83 Added yeast inventory screens
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
87 cache: false,
d9dfd703df83 Added yeast inventory screens
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
88 data: data,
198
f0ec83e1e01f Switches yeasts inventory to indexed names and translations. Database save is using POST instead of GET. Redesigned the web page. Added total cost display which updates on inventory changes.
Michiel Broek <mbroek@mbse.eu>
parents: 37
diff changeset
89 type: "POST",
14
d9dfd703df83 Added yeast inventory screens
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
90 success: function (data, status, xhr) {
d9dfd703df83 Added yeast inventory screens
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
91 // delete command is executed.
d9dfd703df83 Added yeast inventory screens
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
92 commit(true);
d9dfd703df83 Added yeast inventory screens
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
93 },
d9dfd703df83 Added yeast inventory screens
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
94 error: function (jqXHR, textStatus, errorThrown) {
d9dfd703df83 Added yeast inventory screens
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
95 commit(false);
d9dfd703df83 Added yeast inventory screens
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
96 }
d9dfd703df83 Added yeast inventory screens
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
97 });
d9dfd703df83 Added yeast inventory screens
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
98 },
d9dfd703df83 Added yeast inventory screens
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
99 addrow: function (rowid, rowdata, position, commit) {
d9dfd703df83 Added yeast inventory screens
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
100 var data = "insert=true&" + $.param(rowdata);
d9dfd703df83 Added yeast inventory screens
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
101 $.ajax({
d9dfd703df83 Added yeast inventory screens
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
102 dataType: 'json',
d9dfd703df83 Added yeast inventory screens
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
103 url: url,
d9dfd703df83 Added yeast inventory screens
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
104 cache: false,
d9dfd703df83 Added yeast inventory screens
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
105 data: data,
198
f0ec83e1e01f Switches yeasts inventory to indexed names and translations. Database save is using POST instead of GET. Redesigned the web page. Added total cost display which updates on inventory changes.
Michiel Broek <mbroek@mbse.eu>
parents: 37
diff changeset
106 type: "POST",
14
d9dfd703df83 Added yeast inventory screens
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
107 success: function (data, status, xhr) {
d9dfd703df83 Added yeast inventory screens
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
108 commit(true);
d9dfd703df83 Added yeast inventory screens
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
109 },
d9dfd703df83 Added yeast inventory screens
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
110 error: function(jqXHR, textStatus, errorThrown) {
d9dfd703df83 Added yeast inventory screens
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
111 commit(false);
d9dfd703df83 Added yeast inventory screens
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
112 }
d9dfd703df83 Added yeast inventory screens
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
113 });
d9dfd703df83 Added yeast inventory screens
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
114 },
d9dfd703df83 Added yeast inventory screens
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
115 updaterow: function (rowid, rowdata, commit) {
d9dfd703df83 Added yeast inventory screens
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
116 var data = "update=true&" + $.param(rowdata);
d9dfd703df83 Added yeast inventory screens
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
117 $.ajax({
d9dfd703df83 Added yeast inventory screens
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
118 dataType: 'json',
d9dfd703df83 Added yeast inventory screens
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
119 url: url,
d9dfd703df83 Added yeast inventory screens
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
120 cache: false,
d9dfd703df83 Added yeast inventory screens
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
121 data: data,
198
f0ec83e1e01f Switches yeasts inventory to indexed names and translations. Database save is using POST instead of GET. Redesigned the web page. Added total cost display which updates on inventory changes.
Michiel Broek <mbroek@mbse.eu>
parents: 37
diff changeset
122 type: "POST",
14
d9dfd703df83 Added yeast inventory screens
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
123 success: function (data, status, xhr) {
d9dfd703df83 Added yeast inventory screens
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
124 // update command is executed.
d9dfd703df83 Added yeast inventory screens
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
125 commit(true);
d9dfd703df83 Added yeast inventory screens
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
126 },
d9dfd703df83 Added yeast inventory screens
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
127 error: function(jqXHR, textStatus, errorThrown) {
d9dfd703df83 Added yeast inventory screens
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
128 commit(false);
d9dfd703df83 Added yeast inventory screens
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
129 }
d9dfd703df83 Added yeast inventory screens
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
130 });
d9dfd703df83 Added yeast inventory screens
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
131 }
d9dfd703df83 Added yeast inventory screens
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
132 };
d9dfd703df83 Added yeast inventory screens
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
133 // initialize the input fields.
198
f0ec83e1e01f Switches yeasts inventory to indexed names and translations. Database save is using POST instead of GET. Redesigned the web page. Added total cost display which updates on inventory changes.
Michiel Broek <mbroek@mbse.eu>
parents: 37
diff changeset
134 $("#name").jqxInput({ theme: theme, width: 640, height: 23 });
f0ec83e1e01f Switches yeasts inventory to indexed names and translations. Database save is using POST instead of GET. Redesigned the web page. Added total cost display which updates on inventory changes.
Michiel Broek <mbroek@mbse.eu>
parents: 37
diff changeset
135 $("#laboratory").jqxInput({ theme: theme, width: 320, height: 23 });
f0ec83e1e01f Switches yeasts inventory to indexed names and translations. Database save is using POST instead of GET. Redesigned the web page. Added total cost display which updates on inventory changes.
Michiel Broek <mbroek@mbse.eu>
parents: 37
diff changeset
136 $("#product_id").jqxInput({ theme: theme, width: 320, height: 23 });
f0ec83e1e01f Switches yeasts inventory to indexed names and translations. Database save is using POST instead of GET. Redesigned the web page. Added total cost display which updates on inventory changes.
Michiel Broek <mbroek@mbse.eu>
parents: 37
diff changeset
137 $("#type").jqxDropDownList({
f0ec83e1e01f Switches yeasts inventory to indexed names and translations. Database save is using POST instead of GET. Redesigned the web page. Added total cost display which updates on inventory changes.
Michiel Broek <mbroek@mbse.eu>
parents: 37
diff changeset
138 theme: theme,
f0ec83e1e01f Switches yeasts inventory to indexed names and translations. Database save is using POST instead of GET. Redesigned the web page. Added total cost display which updates on inventory changes.
Michiel Broek <mbroek@mbse.eu>
parents: 37
diff changeset
139 source: YeastTypeAdapter,
f0ec83e1e01f Switches yeasts inventory to indexed names and translations. Database save is using POST instead of GET. Redesigned the web page. Added total cost display which updates on inventory changes.
Michiel Broek <mbroek@mbse.eu>
parents: 37
diff changeset
140 valueMember: 'id',
f0ec83e1e01f Switches yeasts inventory to indexed names and translations. Database save is using POST instead of GET. Redesigned the web page. Added total cost display which updates on inventory changes.
Michiel Broek <mbroek@mbse.eu>
parents: 37
diff changeset
141 displayMember: 'nl',
f0ec83e1e01f Switches yeasts inventory to indexed names and translations. Database save is using POST instead of GET. Redesigned the web page. Added total cost display which updates on inventory changes.
Michiel Broek <mbroek@mbse.eu>
parents: 37
diff changeset
142 width: 180,
f0ec83e1e01f Switches yeasts inventory to indexed names and translations. Database save is using POST instead of GET. Redesigned the web page. Added total cost display which updates on inventory changes.
Michiel Broek <mbroek@mbse.eu>
parents: 37
diff changeset
143 height: 23,
f0ec83e1e01f Switches yeasts inventory to indexed names and translations. Database save is using POST instead of GET. Redesigned the web page. Added total cost display which updates on inventory changes.
Michiel Broek <mbroek@mbse.eu>
parents: 37
diff changeset
144 autoDropDownHeight: true
f0ec83e1e01f Switches yeasts inventory to indexed names and translations. Database save is using POST instead of GET. Redesigned the web page. Added total cost display which updates on inventory changes.
Michiel Broek <mbroek@mbse.eu>
parents: 37
diff changeset
145 });
f0ec83e1e01f Switches yeasts inventory to indexed names and translations. Database save is using POST instead of GET. Redesigned the web page. Added total cost display which updates on inventory changes.
Michiel Broek <mbroek@mbse.eu>
parents: 37
diff changeset
146 $("#form").jqxDropDownList({
f0ec83e1e01f Switches yeasts inventory to indexed names and translations. Database save is using POST instead of GET. Redesigned the web page. Added total cost display which updates on inventory changes.
Michiel Broek <mbroek@mbse.eu>
parents: 37
diff changeset
147 theme: theme,
f0ec83e1e01f Switches yeasts inventory to indexed names and translations. Database save is using POST instead of GET. Redesigned the web page. Added total cost display which updates on inventory changes.
Michiel Broek <mbroek@mbse.eu>
parents: 37
diff changeset
148 source: YeastFormAdapter,
f0ec83e1e01f Switches yeasts inventory to indexed names and translations. Database save is using POST instead of GET. Redesigned the web page. Added total cost display which updates on inventory changes.
Michiel Broek <mbroek@mbse.eu>
parents: 37
diff changeset
149 valueMember: 'id',
f0ec83e1e01f Switches yeasts inventory to indexed names and translations. Database save is using POST instead of GET. Redesigned the web page. Added total cost display which updates on inventory changes.
Michiel Broek <mbroek@mbse.eu>
parents: 37
diff changeset
150 displayMember: 'nl',
f0ec83e1e01f Switches yeasts inventory to indexed names and translations. Database save is using POST instead of GET. Redesigned the web page. Added total cost display which updates on inventory changes.
Michiel Broek <mbroek@mbse.eu>
parents: 37
diff changeset
151 selectedIndex: 0,
f0ec83e1e01f Switches yeasts inventory to indexed names and translations. Database save is using POST instead of GET. Redesigned the web page. Added total cost display which updates on inventory changes.
Michiel Broek <mbroek@mbse.eu>
parents: 37
diff changeset
152 width: 180,
f0ec83e1e01f Switches yeasts inventory to indexed names and translations. Database save is using POST instead of GET. Redesigned the web page. Added total cost display which updates on inventory changes.
Michiel Broek <mbroek@mbse.eu>
parents: 37
diff changeset
153 height: 23,
f0ec83e1e01f Switches yeasts inventory to indexed names and translations. Database save is using POST instead of GET. Redesigned the web page. Added total cost display which updates on inventory changes.
Michiel Broek <mbroek@mbse.eu>
parents: 37
diff changeset
154 autoDropDownHeight: true
f0ec83e1e01f Switches yeasts inventory to indexed names and translations. Database save is using POST instead of GET. Redesigned the web page. Added total cost display which updates on inventory changes.
Michiel Broek <mbroek@mbse.eu>
parents: 37
diff changeset
155 });
f0ec83e1e01f Switches yeasts inventory to indexed names and translations. Database save is using POST instead of GET. Redesigned the web page. Added total cost display which updates on inventory changes.
Michiel Broek <mbroek@mbse.eu>
parents: 37
diff changeset
156 $("#notes").jqxInput({ theme: theme, width: 800, height: 120 });
f0ec83e1e01f Switches yeasts inventory to indexed names and translations. Database save is using POST instead of GET. Redesigned the web page. Added total cost display which updates on inventory changes.
Michiel Broek <mbroek@mbse.eu>
parents: 37
diff changeset
157 $("#best_for").jqxInput({ theme: theme, width: 320, height: 50 });
f0ec83e1e01f Switches yeasts inventory to indexed names and translations. Database save is using POST instead of GET. Redesigned the web page. Added total cost display which updates on inventory changes.
Michiel Broek <mbroek@mbse.eu>
parents: 37
diff changeset
158 $("#inventory").jqxNumberInput( Spin1dec1 );
f0ec83e1e01f Switches yeasts inventory to indexed names and translations. Database save is using POST instead of GET. Redesigned the web page. Added total cost display which updates on inventory changes.
Michiel Broek <mbroek@mbse.eu>
parents: 37
diff changeset
159 $("#production_date").jqxDateTimeInput( Dateopts );
f0ec83e1e01f Switches yeasts inventory to indexed names and translations. Database save is using POST instead of GET. Redesigned the web page. Added total cost display which updates on inventory changes.
Michiel Broek <mbroek@mbse.eu>
parents: 37
diff changeset
160 $("#min_temperature").jqxNumberInput( YeastT );
f0ec83e1e01f Switches yeasts inventory to indexed names and translations. Database save is using POST instead of GET. Redesigned the web page. Added total cost display which updates on inventory changes.
Michiel Broek <mbroek@mbse.eu>
parents: 37
diff changeset
161 $("#max_temperature").jqxNumberInput( YeastT );
f0ec83e1e01f Switches yeasts inventory to indexed names and translations. Database save is using POST instead of GET. Redesigned the web page. Added total cost display which updates on inventory changes.
Michiel Broek <mbroek@mbse.eu>
parents: 37
diff changeset
162 $("#flocculation").jqxDropDownList({
f0ec83e1e01f Switches yeasts inventory to indexed names and translations. Database save is using POST instead of GET. Redesigned the web page. Added total cost display which updates on inventory changes.
Michiel Broek <mbroek@mbse.eu>
parents: 37
diff changeset
163 theme: theme,
f0ec83e1e01f Switches yeasts inventory to indexed names and translations. Database save is using POST instead of GET. Redesigned the web page. Added total cost display which updates on inventory changes.
Michiel Broek <mbroek@mbse.eu>
parents: 37
diff changeset
164 source: FlocculationAdapter,
f0ec83e1e01f Switches yeasts inventory to indexed names and translations. Database save is using POST instead of GET. Redesigned the web page. Added total cost display which updates on inventory changes.
Michiel Broek <mbroek@mbse.eu>
parents: 37
diff changeset
165 valueMember: 'id',
f0ec83e1e01f Switches yeasts inventory to indexed names and translations. Database save is using POST instead of GET. Redesigned the web page. Added total cost display which updates on inventory changes.
Michiel Broek <mbroek@mbse.eu>
parents: 37
diff changeset
166 displayMember: 'nl',
f0ec83e1e01f Switches yeasts inventory to indexed names and translations. Database save is using POST instead of GET. Redesigned the web page. Added total cost display which updates on inventory changes.
Michiel Broek <mbroek@mbse.eu>
parents: 37
diff changeset
167 width: 180,
f0ec83e1e01f Switches yeasts inventory to indexed names and translations. Database save is using POST instead of GET. Redesigned the web page. Added total cost display which updates on inventory changes.
Michiel Broek <mbroek@mbse.eu>
parents: 37
diff changeset
168 height: 23,
f0ec83e1e01f Switches yeasts inventory to indexed names and translations. Database save is using POST instead of GET. Redesigned the web page. Added total cost display which updates on inventory changes.
Michiel Broek <mbroek@mbse.eu>
parents: 37
diff changeset
169 autoDropDownHeight: true
f0ec83e1e01f Switches yeasts inventory to indexed names and translations. Database save is using POST instead of GET. Redesigned the web page. Added total cost display which updates on inventory changes.
Michiel Broek <mbroek@mbse.eu>
parents: 37
diff changeset
170 });
f0ec83e1e01f Switches yeasts inventory to indexed names and translations. Database save is using POST instead of GET. Redesigned the web page. Added total cost display which updates on inventory changes.
Michiel Broek <mbroek@mbse.eu>
parents: 37
diff changeset
171 $("#attenuation").jqxNumberInput( Perc1dec1 );
f0ec83e1e01f Switches yeasts inventory to indexed names and translations. Database save is using POST instead of GET. Redesigned the web page. Added total cost display which updates on inventory changes.
Michiel Broek <mbroek@mbse.eu>
parents: 37
diff changeset
172 $("#max_reuse").jqxNumberInput( PosInt );
f0ec83e1e01f Switches yeasts inventory to indexed names and translations. Database save is using POST instead of GET. Redesigned the web page. Added total cost display which updates on inventory changes.
Michiel Broek <mbroek@mbse.eu>
parents: 37
diff changeset
173 $("#max_reuse").jqxNumberInput({ max: 10 });
f0ec83e1e01f Switches yeasts inventory to indexed names and translations. Database save is using POST instead of GET. Redesigned the web page. Added total cost display which updates on inventory changes.
Michiel Broek <mbroek@mbse.eu>
parents: 37
diff changeset
174 $("#cost").jqxNumberInput( Spin2dec1 );
f0ec83e1e01f Switches yeasts inventory to indexed names and translations. Database save is using POST instead of GET. Redesigned the web page. Added total cost display which updates on inventory changes.
Michiel Broek <mbroek@mbse.eu>
parents: 37
diff changeset
175 $("#tht_date").jqxDateTimeInput( Dateopts );
f0ec83e1e01f Switches yeasts inventory to indexed names and translations. Database save is using POST instead of GET. Redesigned the web page. Added total cost display which updates on inventory changes.
Michiel Broek <mbroek@mbse.eu>
parents: 37
diff changeset
176 $("#totval").jqxNumberInput( Spin2dec1 );
f0ec83e1e01f Switches yeasts inventory to indexed names and translations. Database save is using POST instead of GET. Redesigned the web page. Added total cost display which updates on inventory changes.
Michiel Broek <mbroek@mbse.eu>
parents: 37
diff changeset
177 $("#totval").jqxNumberInput({ width: 90, readOnly: true, spinButtons: false });
14
d9dfd703df83 Added yeast inventory screens
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
178
d9dfd703df83 Added yeast inventory screens
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
179 var dataAdapter = new $.jqx.dataAdapter(source);
d9dfd703df83 Added yeast inventory screens
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
180 var editrow = -1;
d9dfd703df83 Added yeast inventory screens
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
181 // initialize jqxGrid
d9dfd703df83 Added yeast inventory screens
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
182 $("#jqxgrid").jqxGrid({
d9dfd703df83 Added yeast inventory screens
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
183 width: 1280,
d9dfd703df83 Added yeast inventory screens
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
184 height: 630,
d9dfd703df83 Added yeast inventory screens
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
185 source: dataAdapter,
d9dfd703df83 Added yeast inventory screens
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
186 theme: theme,
d9dfd703df83 Added yeast inventory screens
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
187 showstatusbar: true,
d9dfd703df83 Added yeast inventory screens
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
188 localization: getLocalization(),
d9dfd703df83 Added yeast inventory screens
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
189 renderstatusbar: function (statusbar) {
d9dfd703df83 Added yeast inventory screens
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
190 var container = $("<div style='overflow: hidden; position: relative; margin: 5px;'></div>");
34
a720353fada9 Formatting and measurements
Michiel Broek <mbroek@mbse.eu>
parents: 33
diff changeset
191 var addButton = $("<div style='float: right; margin-right: 15px;'><img style='position: relative; margin-top: 2px;' src='images/add.png'/><span style='margin-left: 4px; position: relative; top: -3px;'>Nieuw</span></div>");
14
d9dfd703df83 Added yeast inventory screens
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
192 container.append(addButton);
d9dfd703df83 Added yeast inventory screens
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
193 statusbar.append(container);
198
f0ec83e1e01f Switches yeasts inventory to indexed names and translations. Database save is using POST instead of GET. Redesigned the web page. Added total cost display which updates on inventory changes.
Michiel Broek <mbroek@mbse.eu>
parents: 37
diff changeset
194 addButton.jqxButton({ theme: theme, width: 90, height: 20 });
14
d9dfd703df83 Added yeast inventory screens
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
195 // add new row.
d9dfd703df83 Added yeast inventory screens
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
196 addButton.click(function (event) {
d9dfd703df83 Added yeast inventory screens
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
197 editrow = -1;
198
f0ec83e1e01f Switches yeasts inventory to indexed names and translations. Database save is using POST instead of GET. Redesigned the web page. Added total cost display which updates on inventory changes.
Michiel Broek <mbroek@mbse.eu>
parents: 37
diff changeset
198 $("#popupWindow").jqxWindow({ position: { x: 110, y: 30 } });
14
d9dfd703df83 Added yeast inventory screens
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
199 $("#name").val('');
d9dfd703df83 Added yeast inventory screens
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
200 $("#laboratory").val('');
d9dfd703df83 Added yeast inventory screens
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
201 $("#product_id").val('');
198
f0ec83e1e01f Switches yeasts inventory to indexed names and translations. Database save is using POST instead of GET. Redesigned the web page. Added total cost display which updates on inventory changes.
Michiel Broek <mbroek@mbse.eu>
parents: 37
diff changeset
202 $("#type").val(0);
f0ec83e1e01f Switches yeasts inventory to indexed names and translations. Database save is using POST instead of GET. Redesigned the web page. Added total cost display which updates on inventory changes.
Michiel Broek <mbroek@mbse.eu>
parents: 37
diff changeset
203 $("#form").val(0);
f0ec83e1e01f Switches yeasts inventory to indexed names and translations. Database save is using POST instead of GET. Redesigned the web page. Added total cost display which updates on inventory changes.
Michiel Broek <mbroek@mbse.eu>
parents: 37
diff changeset
204 $("#min_temperature").val(18);
f0ec83e1e01f Switches yeasts inventory to indexed names and translations. Database save is using POST instead of GET. Redesigned the web page. Added total cost display which updates on inventory changes.
Michiel Broek <mbroek@mbse.eu>
parents: 37
diff changeset
205 $("#max_temperature").val(22);
f0ec83e1e01f Switches yeasts inventory to indexed names and translations. Database save is using POST instead of GET. Redesigned the web page. Added total cost display which updates on inventory changes.
Michiel Broek <mbroek@mbse.eu>
parents: 37
diff changeset
206 $("#flocculation").val(0);
f0ec83e1e01f Switches yeasts inventory to indexed names and translations. Database save is using POST instead of GET. Redesigned the web page. Added total cost display which updates on inventory changes.
Michiel Broek <mbroek@mbse.eu>
parents: 37
diff changeset
207 $("#attenuation").val(77);
14
d9dfd703df83 Added yeast inventory screens
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
208 $("#notes").val('');
d9dfd703df83 Added yeast inventory screens
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
209 $("#best_for").val('');
198
f0ec83e1e01f Switches yeasts inventory to indexed names and translations. Database save is using POST instead of GET. Redesigned the web page. Added total cost display which updates on inventory changes.
Michiel Broek <mbroek@mbse.eu>
parents: 37
diff changeset
210 $("#max_reuse").val(10);
f0ec83e1e01f Switches yeasts inventory to indexed names and translations. Database save is using POST instead of GET. Redesigned the web page. Added total cost display which updates on inventory changes.
Michiel Broek <mbroek@mbse.eu>
parents: 37
diff changeset
211 $("#inventory").val(0);
f0ec83e1e01f Switches yeasts inventory to indexed names and translations. Database save is using POST instead of GET. Redesigned the web page. Added total cost display which updates on inventory changes.
Michiel Broek <mbroek@mbse.eu>
parents: 37
diff changeset
212 $("#cost").val(0);
14
d9dfd703df83 Added yeast inventory screens
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
213 $("#production_date").val('');
d9dfd703df83 Added yeast inventory screens
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
214 $("#tht_date").val('');
d9dfd703df83 Added yeast inventory screens
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
215 $("#popupWindow").jqxWindow('open');
d9dfd703df83 Added yeast inventory screens
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
216 });
d9dfd703df83 Added yeast inventory screens
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
217 },
d9dfd703df83 Added yeast inventory screens
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
218 filterable: true,
d9dfd703df83 Added yeast inventory screens
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
219 filtermode: 'excel',
d9dfd703df83 Added yeast inventory screens
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
220 columns: [
d9dfd703df83 Added yeast inventory screens
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
221 { text: 'Laboratorium', datafield: 'laboratory', width: 150 },
d9dfd703df83 Added yeast inventory screens
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
222 { text: 'Product ID', datafield: 'product_id', width: 120 },
37
9362eb9e9e5b Sorting the inventory and changes some grid tables.
Michiel Broek <mbroek@mbse.eu>
parents: 34
diff changeset
223 { text: 'Gist naam', datafield: 'name' },
198
f0ec83e1e01f Switches yeasts inventory to indexed names and translations. Database save is using POST instead of GET. Redesigned the web page. Added total cost display which updates on inventory changes.
Michiel Broek <mbroek@mbse.eu>
parents: 37
diff changeset
224 { text: 'Type', datafield: 'type', align: 'center', cellsalign: 'center', width: 90,
f0ec83e1e01f Switches yeasts inventory to indexed names and translations. Database save is using POST instead of GET. Redesigned the web page. Added total cost display which updates on inventory changes.
Michiel Broek <mbroek@mbse.eu>
parents: 37
diff changeset
225 cellsrenderer: function (index, datafield, value, defaultvalue, column, rowdata) {
f0ec83e1e01f Switches yeasts inventory to indexed names and translations. Database save is using POST instead of GET. Redesigned the web page. Added total cost display which updates on inventory changes.
Michiel Broek <mbroek@mbse.eu>
parents: 37
diff changeset
226 return "<div style='margin: 4px;' class='jqx-center-align'>" + YeastTypeData[value].nl + "</div>";
f0ec83e1e01f Switches yeasts inventory to indexed names and translations. Database save is using POST instead of GET. Redesigned the web page. Added total cost display which updates on inventory changes.
Michiel Broek <mbroek@mbse.eu>
parents: 37
diff changeset
227 }
f0ec83e1e01f Switches yeasts inventory to indexed names and translations. Database save is using POST instead of GET. Redesigned the web page. Added total cost display which updates on inventory changes.
Michiel Broek <mbroek@mbse.eu>
parents: 37
diff changeset
228 },
f0ec83e1e01f Switches yeasts inventory to indexed names and translations. Database save is using POST instead of GET. Redesigned the web page. Added total cost display which updates on inventory changes.
Michiel Broek <mbroek@mbse.eu>
parents: 37
diff changeset
229 { text: 'Vorm', datafield: 'form', align: 'center', cellsalign: 'center', width: 90,
f0ec83e1e01f Switches yeasts inventory to indexed names and translations. Database save is using POST instead of GET. Redesigned the web page. Added total cost display which updates on inventory changes.
Michiel Broek <mbroek@mbse.eu>
parents: 37
diff changeset
230 cellsrenderer: function (index, datafield, value, defaultvalue, column, rowdata) {
f0ec83e1e01f Switches yeasts inventory to indexed names and translations. Database save is using POST instead of GET. Redesigned the web page. Added total cost display which updates on inventory changes.
Michiel Broek <mbroek@mbse.eu>
parents: 37
diff changeset
231 return "<div style='margin: 4px;' class='jqx-center-align'>" + YeastFormData[value].nl + "</div>";
f0ec83e1e01f Switches yeasts inventory to indexed names and translations. Database save is using POST instead of GET. Redesigned the web page. Added total cost display which updates on inventory changes.
Michiel Broek <mbroek@mbse.eu>
parents: 37
diff changeset
232 }
f0ec83e1e01f Switches yeasts inventory to indexed names and translations. Database save is using POST instead of GET. Redesigned the web page. Added total cost display which updates on inventory changes.
Michiel Broek <mbroek@mbse.eu>
parents: 37
diff changeset
233 },
33
2ee6ad5d6f14 More weight/volmes standards in the database.
Michiel Broek <mbroek@mbse.eu>
parents: 20
diff changeset
234 { text: 'Vergistingsgraad', datafield: 'attenuation', width: 120, align: 'right', cellsalign: 'right', cellsformat: 'p0' },
2ee6ad5d6f14 More weight/volmes standards in the database.
Michiel Broek <mbroek@mbse.eu>
parents: 20
diff changeset
235 { text: 'Voor. gr/ml', datafield: 'inventory', width: 100, align: 'right', cellsalign: 'right', cellsformat: 'f1' },
2ee6ad5d6f14 More weight/volmes standards in the database.
Michiel Broek <mbroek@mbse.eu>
parents: 20
diff changeset
236 { text: 'Prijs kg/l', datafield: 'cost', width: 100, align: 'right', cellsalign: 'right', cellsformat: 'c2' },
198
f0ec83e1e01f Switches yeasts inventory to indexed names and translations. Database save is using POST instead of GET. Redesigned the web page. Added total cost display which updates on inventory changes.
Michiel Broek <mbroek@mbse.eu>
parents: 37
diff changeset
237 { text: 'Wijzig', datafield: 'Edit', columntype: 'button', width: 100, align: 'center', cellsrenderer: function () {
34
a720353fada9 Formatting and measurements
Michiel Broek <mbroek@mbse.eu>
parents: 33
diff changeset
238 return "Wijzig";
14
d9dfd703df83 Added yeast inventory screens
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
239 }, buttonclick: function (row) {
d9dfd703df83 Added yeast inventory screens
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
240 // open the popup window when the user clicks a button.
d9dfd703df83 Added yeast inventory screens
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
241 editrow = row;
198
f0ec83e1e01f Switches yeasts inventory to indexed names and translations. Database save is using POST instead of GET. Redesigned the web page. Added total cost display which updates on inventory changes.
Michiel Broek <mbroek@mbse.eu>
parents: 37
diff changeset
242 $("#popupWindow").jqxWindow({ position: { x: 110, y: 30 } });
14
d9dfd703df83 Added yeast inventory screens
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
243 // get the clicked row's data and initialize the input fields.
198
f0ec83e1e01f Switches yeasts inventory to indexed names and translations. Database save is using POST instead of GET. Redesigned the web page. Added total cost display which updates on inventory changes.
Michiel Broek <mbroek@mbse.eu>
parents: 37
diff changeset
244 dataRecord = $("#jqxgrid").jqxGrid('getrowdata', editrow);
14
d9dfd703df83 Added yeast inventory screens
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
245 $("#name").val(dataRecord.name);
d9dfd703df83 Added yeast inventory screens
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
246 $("#laboratory").val(dataRecord.laboratory);
d9dfd703df83 Added yeast inventory screens
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
247 $("#product_id").val(dataRecord.product_id);
d9dfd703df83 Added yeast inventory screens
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
248 $("#type").val(dataRecord.type);
d9dfd703df83 Added yeast inventory screens
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
249 $("#form").val(dataRecord.form);
d9dfd703df83 Added yeast inventory screens
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
250 $("#min_temperature").val(dataRecord.min_temperature);
d9dfd703df83 Added yeast inventory screens
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
251 $("#max_temperature").val(dataRecord.max_temperature);
d9dfd703df83 Added yeast inventory screens
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
252 $("#flocculation").val(dataRecord.flocculation);
d9dfd703df83 Added yeast inventory screens
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
253 $("#attenuation").val(dataRecord.attenuation);
d9dfd703df83 Added yeast inventory screens
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
254 $("#notes").val(dataRecord.notes);
d9dfd703df83 Added yeast inventory screens
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
255 $("#best_for").val(dataRecord.best_for);
d9dfd703df83 Added yeast inventory screens
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
256 $("#max_reuse").val(dataRecord.max_reuse);
d9dfd703df83 Added yeast inventory screens
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
257 $("#inventory").val(dataRecord.inventory);
d9dfd703df83 Added yeast inventory screens
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
258 $("#cost").val(dataRecord.cost);
d9dfd703df83 Added yeast inventory screens
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
259 $("#production_date").val(dataRecord.production_date);
d9dfd703df83 Added yeast inventory screens
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
260 $("#tht_date").val(dataRecord.tht_date);
198
f0ec83e1e01f Switches yeasts inventory to indexed names and translations. Database save is using POST instead of GET. Redesigned the web page. Added total cost display which updates on inventory changes.
Michiel Broek <mbroek@mbse.eu>
parents: 37
diff changeset
261 calcTotal(dataRecord.cost, dataRecord.inventory);
14
d9dfd703df83 Added yeast inventory screens
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
262 // show the popup window.
d9dfd703df83 Added yeast inventory screens
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
263 $("#popupWindow").jqxWindow('open');
d9dfd703df83 Added yeast inventory screens
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
264 }
d9dfd703df83 Added yeast inventory screens
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
265 }
d9dfd703df83 Added yeast inventory screens
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
266 ]
d9dfd703df83 Added yeast inventory screens
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
267 });
198
f0ec83e1e01f Switches yeasts inventory to indexed names and translations. Database save is using POST instead of GET. Redesigned the web page. Added total cost display which updates on inventory changes.
Michiel Broek <mbroek@mbse.eu>
parents: 37
diff changeset
268
f0ec83e1e01f Switches yeasts inventory to indexed names and translations. Database save is using POST instead of GET. Redesigned the web page. Added total cost display which updates on inventory changes.
Michiel Broek <mbroek@mbse.eu>
parents: 37
diff changeset
269 $("#cost").on('change', function (event) {
f0ec83e1e01f Switches yeasts inventory to indexed names and translations. Database save is using POST instead of GET. Redesigned the web page. Added total cost display which updates on inventory changes.
Michiel Broek <mbroek@mbse.eu>
parents: 37
diff changeset
270 dataRecord.cost = parseFloat(event.args.value);
f0ec83e1e01f Switches yeasts inventory to indexed names and translations. Database save is using POST instead of GET. Redesigned the web page. Added total cost display which updates on inventory changes.
Michiel Broek <mbroek@mbse.eu>
parents: 37
diff changeset
271 calcTotal(dataRecord.cost, dataRecord.inventory);
f0ec83e1e01f Switches yeasts inventory to indexed names and translations. Database save is using POST instead of GET. Redesigned the web page. Added total cost display which updates on inventory changes.
Michiel Broek <mbroek@mbse.eu>
parents: 37
diff changeset
272 });
f0ec83e1e01f Switches yeasts inventory to indexed names and translations. Database save is using POST instead of GET. Redesigned the web page. Added total cost display which updates on inventory changes.
Michiel Broek <mbroek@mbse.eu>
parents: 37
diff changeset
273 $("#inventory").on('change', function (event) {
f0ec83e1e01f Switches yeasts inventory to indexed names and translations. Database save is using POST instead of GET. Redesigned the web page. Added total cost display which updates on inventory changes.
Michiel Broek <mbroek@mbse.eu>
parents: 37
diff changeset
274 dataRecord.inventory = parseFloat(event.args.value);
f0ec83e1e01f Switches yeasts inventory to indexed names and translations. Database save is using POST instead of GET. Redesigned the web page. Added total cost display which updates on inventory changes.
Michiel Broek <mbroek@mbse.eu>
parents: 37
diff changeset
275 calcTotal(dataRecord.cost, dataRecord.inventory);
f0ec83e1e01f Switches yeasts inventory to indexed names and translations. Database save is using POST instead of GET. Redesigned the web page. Added total cost display which updates on inventory changes.
Michiel Broek <mbroek@mbse.eu>
parents: 37
diff changeset
276 });
f0ec83e1e01f Switches yeasts inventory to indexed names and translations. Database save is using POST instead of GET. Redesigned the web page. Added total cost display which updates on inventory changes.
Michiel Broek <mbroek@mbse.eu>
parents: 37
diff changeset
277
14
d9dfd703df83 Added yeast inventory screens
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
278 // initialize the popup window and buttons.
d9dfd703df83 Added yeast inventory screens
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
279 $("#popupWindow").jqxWindow({
198
f0ec83e1e01f Switches yeasts inventory to indexed names and translations. Database save is using POST instead of GET. Redesigned the web page. Added total cost display which updates on inventory changes.
Michiel Broek <mbroek@mbse.eu>
parents: 37
diff changeset
280 width: 1050,
f0ec83e1e01f Switches yeasts inventory to indexed names and translations. Database save is using POST instead of GET. Redesigned the web page. Added total cost display which updates on inventory changes.
Michiel Broek <mbroek@mbse.eu>
parents: 37
diff changeset
281 height: 550,
f0ec83e1e01f Switches yeasts inventory to indexed names and translations. Database save is using POST instead of GET. Redesigned the web page. Added total cost display which updates on inventory changes.
Michiel Broek <mbroek@mbse.eu>
parents: 37
diff changeset
282 resizable: false,
f0ec83e1e01f Switches yeasts inventory to indexed names and translations. Database save is using POST instead of GET. Redesigned the web page. Added total cost display which updates on inventory changes.
Michiel Broek <mbroek@mbse.eu>
parents: 37
diff changeset
283 theme: theme,
f0ec83e1e01f Switches yeasts inventory to indexed names and translations. Database save is using POST instead of GET. Redesigned the web page. Added total cost display which updates on inventory changes.
Michiel Broek <mbroek@mbse.eu>
parents: 37
diff changeset
284 isModal: true,
f0ec83e1e01f Switches yeasts inventory to indexed names and translations. Database save is using POST instead of GET. Redesigned the web page. Added total cost display which updates on inventory changes.
Michiel Broek <mbroek@mbse.eu>
parents: 37
diff changeset
285 autoOpen: false,
f0ec83e1e01f Switches yeasts inventory to indexed names and translations. Database save is using POST instead of GET. Redesigned the web page. Added total cost display which updates on inventory changes.
Michiel Broek <mbroek@mbse.eu>
parents: 37
diff changeset
286 cancelButton: $("#Cancel"),
f0ec83e1e01f Switches yeasts inventory to indexed names and translations. Database save is using POST instead of GET. Redesigned the web page. Added total cost display which updates on inventory changes.
Michiel Broek <mbroek@mbse.eu>
parents: 37
diff changeset
287 modalOpacity: 0.40
14
d9dfd703df83 Added yeast inventory screens
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
288 });
d9dfd703df83 Added yeast inventory screens
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
289 $("#popupWindow").on('open', function () {
d9dfd703df83 Added yeast inventory screens
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
290 $("#name").jqxInput('selectAll');
d9dfd703df83 Added yeast inventory screens
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
291 });
198
f0ec83e1e01f Switches yeasts inventory to indexed names and translations. Database save is using POST instead of GET. Redesigned the web page. Added total cost display which updates on inventory changes.
Michiel Broek <mbroek@mbse.eu>
parents: 37
diff changeset
292 $("#Delete").jqxButton({ template: "danger", width: '90px', theme: theme });
14
d9dfd703df83 Added yeast inventory screens
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
293 $("#Delete").click(function () {
d9dfd703df83 Added yeast inventory screens
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
294 if (editrow >= 0) {
d9dfd703df83 Added yeast inventory screens
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
295 // Open a popup to confirm this action.
d9dfd703df83 Added yeast inventory screens
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
296 $('#eventWindow').jqxWindow('open');
d9dfd703df83 Added yeast inventory screens
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
297 $("#delOk").click(function () {
d9dfd703df83 Added yeast inventory screens
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
298 var rowID = $('#jqxgrid').jqxGrid('getrowid', editrow);
d9dfd703df83 Added yeast inventory screens
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
299 $("#jqxgrid").jqxGrid('deleterow', rowID);
d9dfd703df83 Added yeast inventory screens
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
300 });
d9dfd703df83 Added yeast inventory screens
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
301 }
d9dfd703df83 Added yeast inventory screens
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
302 $("#popupWindow").jqxWindow('hide');
d9dfd703df83 Added yeast inventory screens
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
303 });
198
f0ec83e1e01f Switches yeasts inventory to indexed names and translations. Database save is using POST instead of GET. Redesigned the web page. Added total cost display which updates on inventory changes.
Michiel Broek <mbroek@mbse.eu>
parents: 37
diff changeset
304 $("#Cancel").jqxButton({ template: "primary", width: '90px', theme: theme });
f0ec83e1e01f Switches yeasts inventory to indexed names and translations. Database save is using POST instead of GET. Redesigned the web page. Added total cost display which updates on inventory changes.
Michiel Broek <mbroek@mbse.eu>
parents: 37
diff changeset
305 $("#Save").jqxButton({ template: "success", width: '90px', theme: theme });
14
d9dfd703df83 Added yeast inventory screens
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
306 // update the edited row when the user clicks the 'Save' button.
d9dfd703df83 Added yeast inventory screens
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
307 $("#Save").click(function () {
198
f0ec83e1e01f Switches yeasts inventory to indexed names and translations. Database save is using POST instead of GET. Redesigned the web page. Added total cost display which updates on inventory changes.
Michiel Broek <mbroek@mbse.eu>
parents: 37
diff changeset
308 var rowID = -1;
14
d9dfd703df83 Added yeast inventory screens
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
309 if (editrow >= 0) {
198
f0ec83e1e01f Switches yeasts inventory to indexed names and translations. Database save is using POST instead of GET. Redesigned the web page. Added total cost display which updates on inventory changes.
Michiel Broek <mbroek@mbse.eu>
parents: 37
diff changeset
310 rowID = $('#jqxgrid').jqxGrid('getrowid', editrow);
f0ec83e1e01f Switches yeasts inventory to indexed names and translations. Database save is using POST instead of GET. Redesigned the web page. Added total cost display which updates on inventory changes.
Michiel Broek <mbroek@mbse.eu>
parents: 37
diff changeset
311 }
f0ec83e1e01f Switches yeasts inventory to indexed names and translations. Database save is using POST instead of GET. Redesigned the web page. Added total cost display which updates on inventory changes.
Michiel Broek <mbroek@mbse.eu>
parents: 37
diff changeset
312 var row = {
f0ec83e1e01f Switches yeasts inventory to indexed names and translations. Database save is using POST instead of GET. Redesigned the web page. Added total cost display which updates on inventory changes.
Michiel Broek <mbroek@mbse.eu>
parents: 37
diff changeset
313 record: rowID,
f0ec83e1e01f Switches yeasts inventory to indexed names and translations. Database save is using POST instead of GET. Redesigned the web page. Added total cost display which updates on inventory changes.
Michiel Broek <mbroek@mbse.eu>
parents: 37
diff changeset
314 name: $("#name").val(),
f0ec83e1e01f Switches yeasts inventory to indexed names and translations. Database save is using POST instead of GET. Redesigned the web page. Added total cost display which updates on inventory changes.
Michiel Broek <mbroek@mbse.eu>
parents: 37
diff changeset
315 type: $("#type").val(),
f0ec83e1e01f Switches yeasts inventory to indexed names and translations. Database save is using POST instead of GET. Redesigned the web page. Added total cost display which updates on inventory changes.
Michiel Broek <mbroek@mbse.eu>
parents: 37
diff changeset
316 form: $("#form").val(),
f0ec83e1e01f Switches yeasts inventory to indexed names and translations. Database save is using POST instead of GET. Redesigned the web page. Added total cost display which updates on inventory changes.
Michiel Broek <mbroek@mbse.eu>
parents: 37
diff changeset
317 laboratory: $("#laboratory").val(),
f0ec83e1e01f Switches yeasts inventory to indexed names and translations. Database save is using POST instead of GET. Redesigned the web page. Added total cost display which updates on inventory changes.
Michiel Broek <mbroek@mbse.eu>
parents: 37
diff changeset
318 product_id: $("#product_id").val(),
f0ec83e1e01f Switches yeasts inventory to indexed names and translations. Database save is using POST instead of GET. Redesigned the web page. Added total cost display which updates on inventory changes.
Michiel Broek <mbroek@mbse.eu>
parents: 37
diff changeset
319 min_temperature: parseInt($("#min_temperature").jqxNumberInput('decimal')),
f0ec83e1e01f Switches yeasts inventory to indexed names and translations. Database save is using POST instead of GET. Redesigned the web page. Added total cost display which updates on inventory changes.
Michiel Broek <mbroek@mbse.eu>
parents: 37
diff changeset
320 max_temperature: parseInt($("#max_temperature").jqxNumberInput('decimal')),
f0ec83e1e01f Switches yeasts inventory to indexed names and translations. Database save is using POST instead of GET. Redesigned the web page. Added total cost display which updates on inventory changes.
Michiel Broek <mbroek@mbse.eu>
parents: 37
diff changeset
321 flocculation: $("#flocculation").val(),
f0ec83e1e01f Switches yeasts inventory to indexed names and translations. Database save is using POST instead of GET. Redesigned the web page. Added total cost display which updates on inventory changes.
Michiel Broek <mbroek@mbse.eu>
parents: 37
diff changeset
322 attenuation: parseFloat($("#attenuation").jqxNumberInput('decimal')),
f0ec83e1e01f Switches yeasts inventory to indexed names and translations. Database save is using POST instead of GET. Redesigned the web page. Added total cost display which updates on inventory changes.
Michiel Broek <mbroek@mbse.eu>
parents: 37
diff changeset
323 notes: $("#notes").val(),
f0ec83e1e01f Switches yeasts inventory to indexed names and translations. Database save is using POST instead of GET. Redesigned the web page. Added total cost display which updates on inventory changes.
Michiel Broek <mbroek@mbse.eu>
parents: 37
diff changeset
324 best_for: $("#best_for").val(),
f0ec83e1e01f Switches yeasts inventory to indexed names and translations. Database save is using POST instead of GET. Redesigned the web page. Added total cost display which updates on inventory changes.
Michiel Broek <mbroek@mbse.eu>
parents: 37
diff changeset
325 max_reuse: parseInt($("#max_reuse").jqxNumberInput('decimal')),
f0ec83e1e01f Switches yeasts inventory to indexed names and translations. Database save is using POST instead of GET. Redesigned the web page. Added total cost display which updates on inventory changes.
Michiel Broek <mbroek@mbse.eu>
parents: 37
diff changeset
326 inventory: parseFloat($("#inventory").jqxNumberInput('decimal')),
f0ec83e1e01f Switches yeasts inventory to indexed names and translations. Database save is using POST instead of GET. Redesigned the web page. Added total cost display which updates on inventory changes.
Michiel Broek <mbroek@mbse.eu>
parents: 37
diff changeset
327 cost: parseFloat($("#cost").jqxNumberInput('decimal')),
f0ec83e1e01f Switches yeasts inventory to indexed names and translations. Database save is using POST instead of GET. Redesigned the web page. Added total cost display which updates on inventory changes.
Michiel Broek <mbroek@mbse.eu>
parents: 37
diff changeset
328 production_date: $("#production_date").val(),
f0ec83e1e01f Switches yeasts inventory to indexed names and translations. Database save is using POST instead of GET. Redesigned the web page. Added total cost display which updates on inventory changes.
Michiel Broek <mbroek@mbse.eu>
parents: 37
diff changeset
329 tht_date: $("#tht_date").val()
f0ec83e1e01f Switches yeasts inventory to indexed names and translations. Database save is using POST instead of GET. Redesigned the web page. Added total cost display which updates on inventory changes.
Michiel Broek <mbroek@mbse.eu>
parents: 37
diff changeset
330 };
f0ec83e1e01f Switches yeasts inventory to indexed names and translations. Database save is using POST instead of GET. Redesigned the web page. Added total cost display which updates on inventory changes.
Michiel Broek <mbroek@mbse.eu>
parents: 37
diff changeset
331 if (editrow >= 0) {
14
d9dfd703df83 Added yeast inventory screens
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
332 $('#jqxgrid').jqxGrid('updaterow', rowID, row);
d9dfd703df83 Added yeast inventory screens
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
333 } else {
198
f0ec83e1e01f Switches yeasts inventory to indexed names and translations. Database save is using POST instead of GET. Redesigned the web page. Added total cost display which updates on inventory changes.
Michiel Broek <mbroek@mbse.eu>
parents: 37
diff changeset
334 $('#jqxgrid').jqxGrid('addrow', null, row);
14
d9dfd703df83 Added yeast inventory screens
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
335 }
198
f0ec83e1e01f Switches yeasts inventory to indexed names and translations. Database save is using POST instead of GET. Redesigned the web page. Added total cost display which updates on inventory changes.
Michiel Broek <mbroek@mbse.eu>
parents: 37
diff changeset
336 $("#popupWindow").jqxWindow('hide');
f0ec83e1e01f Switches yeasts inventory to indexed names and translations. Database save is using POST instead of GET. Redesigned the web page. Added total cost display which updates on inventory changes.
Michiel Broek <mbroek@mbse.eu>
parents: 37
diff changeset
337 location.reload( true ); // reload ourself.
14
d9dfd703df83 Added yeast inventory screens
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
338 });
d9dfd703df83 Added yeast inventory screens
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
339 createDelElements();
d9dfd703df83 Added yeast inventory screens
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
340 });
d9dfd703df83 Added yeast inventory screens
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
341

mercurial