www/js/profile_styles.js

Sun, 02 Jun 2019 12:48:54 +0200

author
Michiel Broek <mbroek@mbse.eu>
date
Sun, 02 Jun 2019 12:48:54 +0200
changeset 392
544d7d0183b2
parent 311
f6fafccd8a6d
child 444
7e563dbbee32
permissions
-rw-r--r--

Added 15 fields to the recipes table. Added 18 fields to the products table. These are calculated values that are now stored in the database so export programs can use these values without calculating them again. Product and recipe print have water and mash schedule added. Product print has brewday results added if the brewday is over. The ingredients layout changed in the product and recipe prints.

28
ac959f98e107 Added inventory styles
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1 /*****************************************************************************
217
318aab371497 Profile style is using indexes. Profile styles and fermentation switched to POST. Standard edit screens.
Michiel Broek <mbroek@mbse.eu>
parents: 66
diff changeset
2 * Copyright (C) 2014-2019
28
ac959f98e107 Added inventory styles
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
3 *
ac959f98e107 Added inventory styles
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
4 * Michiel Broek <mbroek at mbse dot eu>
ac959f98e107 Added inventory styles
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
5 *
ac959f98e107 Added inventory styles
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
6 * This file is part of BrewCloud
ac959f98e107 Added inventory styles
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
7 *
ac959f98e107 Added inventory styles
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
8 * This is free software; you can redistribute it and/or modify it
ac959f98e107 Added inventory styles
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
9 * under the terms of the GNU General Public License as published by the
ac959f98e107 Added inventory styles
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
10 * Free Software Foundation; either version 2, or (at your option) any
ac959f98e107 Added inventory styles
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
11 * later version.
ac959f98e107 Added inventory styles
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
12 *
ac959f98e107 Added inventory styles
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
13 * BrewCloud is distributed in the hope that it will be useful, but
ac959f98e107 Added inventory styles
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
14 * WITHOUT ANY WARRANTY; without even the implied warranty of
ac959f98e107 Added inventory styles
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
ac959f98e107 Added inventory styles
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
16 * General Public License for more details.
ac959f98e107 Added inventory styles
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
17 *
ac959f98e107 Added inventory styles
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
18 * You should have received a copy of the GNU General Public License
ac959f98e107 Added inventory styles
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
19 * along with ThermFerm; see the file COPYING. If not, write to the Free
ac959f98e107 Added inventory styles
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
20 * Software Foundation, 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
ac959f98e107 Added inventory styles
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
21 *****************************************************************************/
ac959f98e107 Added inventory styles
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
22
ac959f98e107 Added inventory styles
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
23
ac959f98e107 Added inventory styles
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
24 function createDelElements() {
ac959f98e107 Added inventory styles
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
25 $('#eventWindow').jqxWindow({
ac959f98e107 Added inventory styles
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
26 theme: theme,
ac959f98e107 Added inventory styles
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
27 position: { x: 490, y: 210 },
ac959f98e107 Added inventory styles
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
28 width: 300,
34
a720353fada9 Formatting and measurements
Michiel Broek <mbroek@mbse.eu>
parents: 28
diff changeset
29 height: 175,
28
ac959f98e107 Added inventory styles
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
30 resizable: false,
ac959f98e107 Added inventory styles
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
31 isModal: true,
ac959f98e107 Added inventory styles
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
32 modalOpacity: 0.4,
ac959f98e107 Added inventory styles
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
33 okButton: $('#delOk'),
ac959f98e107 Added inventory styles
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
34 cancelButton: $('#delCancel'),
ac959f98e107 Added inventory styles
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
35 initContent: function () {
217
318aab371497 Profile style is using indexes. Profile styles and fermentation switched to POST. Standard edit screens.
Michiel Broek <mbroek@mbse.eu>
parents: 66
diff changeset
36 $('#delOk').jqxButton({ template: "danger", width: '65px', theme: theme });
318aab371497 Profile style is using indexes. Profile styles and fermentation switched to POST. Standard edit screens.
Michiel Broek <mbroek@mbse.eu>
parents: 66
diff changeset
37 $('#delCancel').jqxButton({ template: "success", width: '65px', theme: theme });
28
ac959f98e107 Added inventory styles
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
38 $('#delCancel').focus();
ac959f98e107 Added inventory styles
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
39 }
ac959f98e107 Added inventory styles
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
40 });
ac959f98e107 Added inventory styles
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
41 $('#eventWindow').jqxWindow('hide');
ac959f98e107 Added inventory styles
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
42 }
ac959f98e107 Added inventory styles
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
43
ac959f98e107 Added inventory styles
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
44
ac959f98e107 Added inventory styles
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
45 $(document).ready(function () {
217
318aab371497 Profile style is using indexes. Profile styles and fermentation switched to POST. Standard edit screens.
Michiel Broek <mbroek@mbse.eu>
parents: 66
diff changeset
46
318aab371497 Profile style is using indexes. Profile styles and fermentation switched to POST. Standard edit screens.
Michiel Broek <mbroek@mbse.eu>
parents: 66
diff changeset
47 var dataRecord = {};
45
95251bedfab4 Moved three inventory tables and screens to profiles
Michiel Broek <mbroek@mbse.eu>
parents: 34
diff changeset
48 var url = "includes/db_profile_styles.php";
217
318aab371497 Profile style is using indexes. Profile styles and fermentation switched to POST. Standard edit screens.
Michiel Broek <mbroek@mbse.eu>
parents: 66
diff changeset
49
28
ac959f98e107 Added inventory styles
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
50 // prepare the data
ac959f98e107 Added inventory styles
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
51 var source = {
ac959f98e107 Added inventory styles
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
52 datatype: "json",
ac959f98e107 Added inventory styles
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
53 cache: false,
ac959f98e107 Added inventory styles
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
54 datafields: [
ac959f98e107 Added inventory styles
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
55 { name: 'record', type: 'number' },
ac959f98e107 Added inventory styles
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
56 { name: 'name', type: 'string' },
ac959f98e107 Added inventory styles
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
57 { name: 'category', type: 'string' },
ac959f98e107 Added inventory styles
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
58 { name: 'category_number', type: 'number' },
ac959f98e107 Added inventory styles
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
59 { name: 'style_letter', type: 'string' },
ac959f98e107 Added inventory styles
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
60 { name: 'style_guide', type: 'string' },
217
318aab371497 Profile style is using indexes. Profile styles and fermentation switched to POST. Standard edit screens.
Michiel Broek <mbroek@mbse.eu>
parents: 66
diff changeset
61 { name: 'type', type: 'int' },
28
ac959f98e107 Added inventory styles
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
62 { name: 'og_min', type: 'float' },
ac959f98e107 Added inventory styles
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
63 { name: 'og_max', type: 'float' },
ac959f98e107 Added inventory styles
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
64 { name: 'fg_min', type: 'float' },
ac959f98e107 Added inventory styles
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
65 { name: 'fg_max', type: 'float' },
ac959f98e107 Added inventory styles
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
66 { name: 'ibu_min', type: 'float' },
ac959f98e107 Added inventory styles
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
67 { name: 'ibu_max', type: 'float' },
ac959f98e107 Added inventory styles
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
68 { name: 'color_min', type: 'float' },
ac959f98e107 Added inventory styles
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
69 { name: 'color_max', type: 'float' },
ac959f98e107 Added inventory styles
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
70 { name: 'carb_min', type: 'float' },
ac959f98e107 Added inventory styles
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
71 { name: 'carb_max', type: 'float' },
ac959f98e107 Added inventory styles
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
72 { name: 'abv_min', type: 'float' },
ac959f98e107 Added inventory styles
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
73 { name: 'abv_max', type: 'float' },
ac959f98e107 Added inventory styles
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
74 { name: 'notes', type: 'string' },
ac959f98e107 Added inventory styles
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
75 { name: 'profile', type: 'string' },
ac959f98e107 Added inventory styles
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
76 { name: 'ingredients', type: 'string' },
ac959f98e107 Added inventory styles
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
77 { name: 'examples', type: 'string' }
ac959f98e107 Added inventory styles
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
78 ],
ac959f98e107 Added inventory styles
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
79 id: 'record',
ac959f98e107 Added inventory styles
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
80 url: url,
ac959f98e107 Added inventory styles
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
81 deleterow: function (rowid, commit) {
ac959f98e107 Added inventory styles
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
82 // synchronize with the server - send delete command
ac959f98e107 Added inventory styles
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
83 var data = "delete=true&" + $.param({ record: rowid });
ac959f98e107 Added inventory styles
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
84 $.ajax({
ac959f98e107 Added inventory styles
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
85 dataType: 'json',
ac959f98e107 Added inventory styles
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
86 url: url,
ac959f98e107 Added inventory styles
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
87 cache: false,
ac959f98e107 Added inventory styles
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
88 data: data,
217
318aab371497 Profile style is using indexes. Profile styles and fermentation switched to POST. Standard edit screens.
Michiel Broek <mbroek@mbse.eu>
parents: 66
diff changeset
89 type: "POST",
28
ac959f98e107 Added inventory styles
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
90 success: function (data, status, xhr) {
ac959f98e107 Added inventory styles
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
91 // delete command is executed.
ac959f98e107 Added inventory styles
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
92 commit(true);
ac959f98e107 Added inventory styles
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
93 },
ac959f98e107 Added inventory styles
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
94 error: function (jqXHR, textStatus, errorThrown) {
ac959f98e107 Added inventory styles
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
95 commit(false);
ac959f98e107 Added inventory styles
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
96 }
ac959f98e107 Added inventory styles
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
97 });
ac959f98e107 Added inventory styles
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
98 },
ac959f98e107 Added inventory styles
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
99 addrow: function (rowid, rowdata, position, commit) {
ac959f98e107 Added inventory styles
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
100 var data = "insert=true&" + $.param(rowdata);
ac959f98e107 Added inventory styles
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
101 $.ajax({
ac959f98e107 Added inventory styles
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
102 dataType: 'json',
ac959f98e107 Added inventory styles
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
103 url: url,
ac959f98e107 Added inventory styles
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
104 cache: false,
ac959f98e107 Added inventory styles
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
105 data: data,
217
318aab371497 Profile style is using indexes. Profile styles and fermentation switched to POST. Standard edit screens.
Michiel Broek <mbroek@mbse.eu>
parents: 66
diff changeset
106 type: "POST",
28
ac959f98e107 Added inventory styles
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
107 success: function (data, status, xhr) {
ac959f98e107 Added inventory styles
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
108 commit(true);
ac959f98e107 Added inventory styles
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
109 },
ac959f98e107 Added inventory styles
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
110 error: function(jqXHR, textStatus, errorThrown) {
ac959f98e107 Added inventory styles
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
111 commit(false);
ac959f98e107 Added inventory styles
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
112 }
ac959f98e107 Added inventory styles
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
113 });
ac959f98e107 Added inventory styles
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
114 },
ac959f98e107 Added inventory styles
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
115 updaterow: function (rowid, rowdata, commit) {
ac959f98e107 Added inventory styles
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
116 var data = "update=true&" + $.param(rowdata);
ac959f98e107 Added inventory styles
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
117 $.ajax({
ac959f98e107 Added inventory styles
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
118 dataType: 'json',
ac959f98e107 Added inventory styles
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
119 url: url,
ac959f98e107 Added inventory styles
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
120 cache: false,
ac959f98e107 Added inventory styles
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
121 data: data,
217
318aab371497 Profile style is using indexes. Profile styles and fermentation switched to POST. Standard edit screens.
Michiel Broek <mbroek@mbse.eu>
parents: 66
diff changeset
122 type: "POST",
28
ac959f98e107 Added inventory styles
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
123 success: function (data, status, xhr) {
ac959f98e107 Added inventory styles
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
124 // update command is executed.
ac959f98e107 Added inventory styles
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
125 commit(true);
ac959f98e107 Added inventory styles
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
126 },
ac959f98e107 Added inventory styles
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
127 error: function(jqXHR, textStatus, errorThrown) {
ac959f98e107 Added inventory styles
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
128 commit(false);
ac959f98e107 Added inventory styles
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
129 }
ac959f98e107 Added inventory styles
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
130 });
ac959f98e107 Added inventory styles
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
131 }
ac959f98e107 Added inventory styles
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
132 };
ac959f98e107 Added inventory styles
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
133 // initialize the input fields.
217
318aab371497 Profile style is using indexes. Profile styles and fermentation switched to POST. Standard edit screens.
Michiel Broek <mbroek@mbse.eu>
parents: 66
diff changeset
134 $("#name").jqxInput({ theme: theme, width: 320, height: 23 });
318aab371497 Profile style is using indexes. Profile styles and fermentation switched to POST. Standard edit screens.
Michiel Broek <mbroek@mbse.eu>
parents: 66
diff changeset
135 $("#category").jqxInput({ theme: theme, width: 320, height: 23 });
318aab371497 Profile style is using indexes. Profile styles and fermentation switched to POST. Standard edit screens.
Michiel Broek <mbroek@mbse.eu>
parents: 66
diff changeset
136 $("#category_number").jqxNumberInput( PosInt );
28
ac959f98e107 Added inventory styles
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
137 $("#style_letter").jqxInput({ theme: theme, width: 250, height: 23 });
217
318aab371497 Profile style is using indexes. Profile styles and fermentation switched to POST. Standard edit screens.
Michiel Broek <mbroek@mbse.eu>
parents: 66
diff changeset
138 $("#style_guide").jqxInput({ theme: theme, width: 320, height: 23 });
318aab371497 Profile style is using indexes. Profile styles and fermentation switched to POST. Standard edit screens.
Michiel Broek <mbroek@mbse.eu>
parents: 66
diff changeset
139 $("#type").jqxDropDownList({
318aab371497 Profile style is using indexes. Profile styles and fermentation switched to POST. Standard edit screens.
Michiel Broek <mbroek@mbse.eu>
parents: 66
diff changeset
140 theme: theme,
318aab371497 Profile style is using indexes. Profile styles and fermentation switched to POST. Standard edit screens.
Michiel Broek <mbroek@mbse.eu>
parents: 66
diff changeset
141 source: StyleTypeAdapter,
318aab371497 Profile style is using indexes. Profile styles and fermentation switched to POST. Standard edit screens.
Michiel Broek <mbroek@mbse.eu>
parents: 66
diff changeset
142 valueMember: 'id',
318aab371497 Profile style is using indexes. Profile styles and fermentation switched to POST. Standard edit screens.
Michiel Broek <mbroek@mbse.eu>
parents: 66
diff changeset
143 displayMember: 'nl',
318aab371497 Profile style is using indexes. Profile styles and fermentation switched to POST. Standard edit screens.
Michiel Broek <mbroek@mbse.eu>
parents: 66
diff changeset
144 width: 180,
318aab371497 Profile style is using indexes. Profile styles and fermentation switched to POST. Standard edit screens.
Michiel Broek <mbroek@mbse.eu>
parents: 66
diff changeset
145 height: 23,
318aab371497 Profile style is using indexes. Profile styles and fermentation switched to POST. Standard edit screens.
Michiel Broek <mbroek@mbse.eu>
parents: 66
diff changeset
146 autoDropDownHeight: true
318aab371497 Profile style is using indexes. Profile styles and fermentation switched to POST. Standard edit screens.
Michiel Broek <mbroek@mbse.eu>
parents: 66
diff changeset
147 });
318aab371497 Profile style is using indexes. Profile styles and fermentation switched to POST. Standard edit screens.
Michiel Broek <mbroek@mbse.eu>
parents: 66
diff changeset
148 $("#og_min").jqxNumberInput( SGopts );
318aab371497 Profile style is using indexes. Profile styles and fermentation switched to POST. Standard edit screens.
Michiel Broek <mbroek@mbse.eu>
parents: 66
diff changeset
149 $("#og_max").jqxNumberInput( SGopts );
318aab371497 Profile style is using indexes. Profile styles and fermentation switched to POST. Standard edit screens.
Michiel Broek <mbroek@mbse.eu>
parents: 66
diff changeset
150 $("#fg_min").jqxNumberInput( SGopts );
318aab371497 Profile style is using indexes. Profile styles and fermentation switched to POST. Standard edit screens.
Michiel Broek <mbroek@mbse.eu>
parents: 66
diff changeset
151 $("#fg_max").jqxNumberInput( SGopts );
318aab371497 Profile style is using indexes. Profile styles and fermentation switched to POST. Standard edit screens.
Michiel Broek <mbroek@mbse.eu>
parents: 66
diff changeset
152 $("#ibu_min").jqxNumberInput( PosInt );
318aab371497 Profile style is using indexes. Profile styles and fermentation switched to POST. Standard edit screens.
Michiel Broek <mbroek@mbse.eu>
parents: 66
diff changeset
153 $("#ibu_min").jqxNumberInput({ max: 200 });
318aab371497 Profile style is using indexes. Profile styles and fermentation switched to POST. Standard edit screens.
Michiel Broek <mbroek@mbse.eu>
parents: 66
diff changeset
154 $("#ibu_max").jqxNumberInput( PosInt );
318aab371497 Profile style is using indexes. Profile styles and fermentation switched to POST. Standard edit screens.
Michiel Broek <mbroek@mbse.eu>
parents: 66
diff changeset
155 $("#ibu_max").jqxNumberInput({ max: 200 });
318aab371497 Profile style is using indexes. Profile styles and fermentation switched to POST. Standard edit screens.
Michiel Broek <mbroek@mbse.eu>
parents: 66
diff changeset
156 $("#color_min").jqxNumberInput( PosInt );
318aab371497 Profile style is using indexes. Profile styles and fermentation switched to POST. Standard edit screens.
Michiel Broek <mbroek@mbse.eu>
parents: 66
diff changeset
157 $("#color_min").jqxNumberInput({ max: 200 });
318aab371497 Profile style is using indexes. Profile styles and fermentation switched to POST. Standard edit screens.
Michiel Broek <mbroek@mbse.eu>
parents: 66
diff changeset
158 $("#color_max").jqxNumberInput( PosInt );
318aab371497 Profile style is using indexes. Profile styles and fermentation switched to POST. Standard edit screens.
Michiel Broek <mbroek@mbse.eu>
parents: 66
diff changeset
159 $("#color_max").jqxNumberInput({ max: 200 });
245
3649c3d31d15 Fixed the mousewheel, spinner buttons to use the full min/max ranges. The 1.002 SG block to be precise.
Michiel Broek <mbroek@mbse.eu>
parents: 217
diff changeset
160 $("#carb_min").jqxNumberInput( Spin1dec );
217
318aab371497 Profile style is using indexes. Profile styles and fermentation switched to POST. Standard edit screens.
Michiel Broek <mbroek@mbse.eu>
parents: 66
diff changeset
161 $("#carb_min").jqxNumberInput({ max: 5 });
245
3649c3d31d15 Fixed the mousewheel, spinner buttons to use the full min/max ranges. The 1.002 SG block to be precise.
Michiel Broek <mbroek@mbse.eu>
parents: 217
diff changeset
162 $("#carb_max").jqxNumberInput( Spin1dec );
217
318aab371497 Profile style is using indexes. Profile styles and fermentation switched to POST. Standard edit screens.
Michiel Broek <mbroek@mbse.eu>
parents: 66
diff changeset
163 $("#carb_max").jqxNumberInput({ max: 5 });
245
3649c3d31d15 Fixed the mousewheel, spinner buttons to use the full min/max ranges. The 1.002 SG block to be precise.
Michiel Broek <mbroek@mbse.eu>
parents: 217
diff changeset
164 $("#abv_min").jqxNumberInput( Spin1dec );
217
318aab371497 Profile style is using indexes. Profile styles and fermentation switched to POST. Standard edit screens.
Michiel Broek <mbroek@mbse.eu>
parents: 66
diff changeset
165 $("#abv_min").jqxNumberInput({ max: 20 });
245
3649c3d31d15 Fixed the mousewheel, spinner buttons to use the full min/max ranges. The 1.002 SG block to be precise.
Michiel Broek <mbroek@mbse.eu>
parents: 217
diff changeset
166 $("#abv_max").jqxNumberInput( Spin1dec );
217
318aab371497 Profile style is using indexes. Profile styles and fermentation switched to POST. Standard edit screens.
Michiel Broek <mbroek@mbse.eu>
parents: 66
diff changeset
167 $("#abv_max").jqxNumberInput({ max: 20 });
318aab371497 Profile style is using indexes. Profile styles and fermentation switched to POST. Standard edit screens.
Michiel Broek <mbroek@mbse.eu>
parents: 66
diff changeset
168 $("#notes").jqxInput({ theme: theme, width: 800, height: 100 });
318aab371497 Profile style is using indexes. Profile styles and fermentation switched to POST. Standard edit screens.
Michiel Broek <mbroek@mbse.eu>
parents: 66
diff changeset
169 $("#profile").jqxInput({ theme: theme, width: 800, height: 48 });
318aab371497 Profile style is using indexes. Profile styles and fermentation switched to POST. Standard edit screens.
Michiel Broek <mbroek@mbse.eu>
parents: 66
diff changeset
170 $("#ingredients").jqxInput({ theme: theme, width: 800, height: 23 });
318aab371497 Profile style is using indexes. Profile styles and fermentation switched to POST. Standard edit screens.
Michiel Broek <mbroek@mbse.eu>
parents: 66
diff changeset
171 $("#examples").jqxInput({ theme: theme, width: 800, height: 48 });
28
ac959f98e107 Added inventory styles
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
172
ac959f98e107 Added inventory styles
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
173 var dataAdapter = new $.jqx.dataAdapter(source);
ac959f98e107 Added inventory styles
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
174 var editrow = -1;
ac959f98e107 Added inventory styles
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
175 // initialize jqxGrid
ac959f98e107 Added inventory styles
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
176 $("#jqxgrid").jqxGrid({
ac959f98e107 Added inventory styles
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
177 width: 1280,
ac959f98e107 Added inventory styles
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
178 height: 630,
ac959f98e107 Added inventory styles
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
179 source: dataAdapter,
ac959f98e107 Added inventory styles
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
180 theme: theme,
ac959f98e107 Added inventory styles
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
181 showstatusbar: true,
ac959f98e107 Added inventory styles
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
182 renderstatusbar: function (statusbar) {
ac959f98e107 Added inventory styles
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
183 var container = $("<div style='overflow: hidden; position: relative; margin: 5px;'></div>");
34
a720353fada9 Formatting and measurements
Michiel Broek <mbroek@mbse.eu>
parents: 28
diff changeset
184 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>");
311
f6fafccd8a6d Added xml import for fermentables, hops, miscs, yeasts and styles. Fixed update IBU calculation in the editor hop popups.
Michiel Broek <mbroek@mbse.eu>
parents: 286
diff changeset
185 var impButton = $("<div style='float: right; margin-right: 50px;'><img style='position: relative; margin-top: 2px;' src='images/add.png'/><span style='margin-left: 4px; position: relative; top: -3px;'>Import</span></div>");
28
ac959f98e107 Added inventory styles
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
186 container.append(addButton);
311
f6fafccd8a6d Added xml import for fermentables, hops, miscs, yeasts and styles. Fixed update IBU calculation in the editor hop popups.
Michiel Broek <mbroek@mbse.eu>
parents: 286
diff changeset
187 container.append(impButton);
28
ac959f98e107 Added inventory styles
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
188 statusbar.append(container);
217
318aab371497 Profile style is using indexes. Profile styles and fermentation switched to POST. Standard edit screens.
Michiel Broek <mbroek@mbse.eu>
parents: 66
diff changeset
189 addButton.jqxButton({ theme: theme, width: 90, height: 20 });
311
f6fafccd8a6d Added xml import for fermentables, hops, miscs, yeasts and styles. Fixed update IBU calculation in the editor hop popups.
Michiel Broek <mbroek@mbse.eu>
parents: 286
diff changeset
190 impButton.jqxButton({ theme: theme, width: 90, height: 20 });
28
ac959f98e107 Added inventory styles
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
191 // add new row.
ac959f98e107 Added inventory styles
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
192 addButton.click(function (event) {
ac959f98e107 Added inventory styles
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
193 editrow = -1;
217
318aab371497 Profile style is using indexes. Profile styles and fermentation switched to POST. Standard edit screens.
Michiel Broek <mbroek@mbse.eu>
parents: 66
diff changeset
194 $("#name").val('Nieuwe stijl');
28
ac959f98e107 Added inventory styles
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
195 $("#category").val('');
ac959f98e107 Added inventory styles
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
196 $("#category_number").val('');
ac959f98e107 Added inventory styles
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
197 $("#style_letter").val('');
217
318aab371497 Profile style is using indexes. Profile styles and fermentation switched to POST. Standard edit screens.
Michiel Broek <mbroek@mbse.eu>
parents: 66
diff changeset
198 $("#style_guide").val('BKG 2015');
318aab371497 Profile style is using indexes. Profile styles and fermentation switched to POST. Standard edit screens.
Michiel Broek <mbroek@mbse.eu>
parents: 66
diff changeset
199 $("#type").val(0);
318aab371497 Profile style is using indexes. Profile styles and fermentation switched to POST. Standard edit screens.
Michiel Broek <mbroek@mbse.eu>
parents: 66
diff changeset
200 $("#og_min").val(1.030);
318aab371497 Profile style is using indexes. Profile styles and fermentation switched to POST. Standard edit screens.
Michiel Broek <mbroek@mbse.eu>
parents: 66
diff changeset
201 $("#og_max").val(1.050);
318aab371497 Profile style is using indexes. Profile styles and fermentation switched to POST. Standard edit screens.
Michiel Broek <mbroek@mbse.eu>
parents: 66
diff changeset
202 $("#fg_min").val(1.005);
318aab371497 Profile style is using indexes. Profile styles and fermentation switched to POST. Standard edit screens.
Michiel Broek <mbroek@mbse.eu>
parents: 66
diff changeset
203 $("#fg_max").val(1.010);
318aab371497 Profile style is using indexes. Profile styles and fermentation switched to POST. Standard edit screens.
Michiel Broek <mbroek@mbse.eu>
parents: 66
diff changeset
204 $("#ibu_min").val(20);
318aab371497 Profile style is using indexes. Profile styles and fermentation switched to POST. Standard edit screens.
Michiel Broek <mbroek@mbse.eu>
parents: 66
diff changeset
205 $("#ibu_max").val(30);
318aab371497 Profile style is using indexes. Profile styles and fermentation switched to POST. Standard edit screens.
Michiel Broek <mbroek@mbse.eu>
parents: 66
diff changeset
206 $("#color_min").val(52);
318aab371497 Profile style is using indexes. Profile styles and fermentation switched to POST. Standard edit screens.
Michiel Broek <mbroek@mbse.eu>
parents: 66
diff changeset
207 $("#color_max").val(79);
318aab371497 Profile style is using indexes. Profile styles and fermentation switched to POST. Standard edit screens.
Michiel Broek <mbroek@mbse.eu>
parents: 66
diff changeset
208 $("#carb_min").val(2.0);
318aab371497 Profile style is using indexes. Profile styles and fermentation switched to POST. Standard edit screens.
Michiel Broek <mbroek@mbse.eu>
parents: 66
diff changeset
209 $("#carb_max").val(2.5);
318aab371497 Profile style is using indexes. Profile styles and fermentation switched to POST. Standard edit screens.
Michiel Broek <mbroek@mbse.eu>
parents: 66
diff changeset
210 $("#abv_min").val(4.0);
318aab371497 Profile style is using indexes. Profile styles and fermentation switched to POST. Standard edit screens.
Michiel Broek <mbroek@mbse.eu>
parents: 66
diff changeset
211 $("#abv_max").val(5.0);
28
ac959f98e107 Added inventory styles
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
212 $("#notes").val('');
ac959f98e107 Added inventory styles
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
213 $("#profile").val('');
ac959f98e107 Added inventory styles
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
214 $("#ingredients").val('');
ac959f98e107 Added inventory styles
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
215 $("#examples").val('');
ac959f98e107 Added inventory styles
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
216 $("#popupWindow").jqxWindow('open');
ac959f98e107 Added inventory styles
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
217 });
311
f6fafccd8a6d Added xml import for fermentables, hops, miscs, yeasts and styles. Fixed update IBU calculation in the editor hop popups.
Michiel Broek <mbroek@mbse.eu>
parents: 286
diff changeset
218 impButton.click(function (event) {
f6fafccd8a6d Added xml import for fermentables, hops, miscs, yeasts and styles. Fixed update IBU calculation in the editor hop popups.
Michiel Broek <mbroek@mbse.eu>
parents: 286
diff changeset
219 var url="import_ingredients.php?select=styles";
f6fafccd8a6d Added xml import for fermentables, hops, miscs, yeasts and styles. Fixed update IBU calculation in the editor hop popups.
Michiel Broek <mbroek@mbse.eu>
parents: 286
diff changeset
220 window.location.href = url;
f6fafccd8a6d Added xml import for fermentables, hops, miscs, yeasts and styles. Fixed update IBU calculation in the editor hop popups.
Michiel Broek <mbroek@mbse.eu>
parents: 286
diff changeset
221 });
28
ac959f98e107 Added inventory styles
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
222 },
ac959f98e107 Added inventory styles
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
223 filterable: true,
ac959f98e107 Added inventory styles
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
224 filtermode: 'excel',
ac959f98e107 Added inventory styles
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
225 columns: [
ac959f98e107 Added inventory styles
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
226 { text: 'Groep', datafield: 'style_letter', width: 30 },
217
318aab371497 Profile style is using indexes. Profile styles and fermentation switched to POST. Standard edit screens.
Michiel Broek <mbroek@mbse.eu>
parents: 66
diff changeset
227 { text: 'Style Name', menu: false, datafield: 'name' },
318aab371497 Profile style is using indexes. Profile styles and fermentation switched to POST. Standard edit screens.
Michiel Broek <mbroek@mbse.eu>
parents: 66
diff changeset
228 { text: 'OG', menu: false, datafield: 'og_min', width: 60, align: 'right', cellsalign: 'right', cellsformat: 'f3' },
318aab371497 Profile style is using indexes. Profile styles and fermentation switched to POST. Standard edit screens.
Michiel Broek <mbroek@mbse.eu>
parents: 66
diff changeset
229 { text: 'OG', menu: false, datafield: 'og_max', width: 60, align: 'right', cellsalign: 'right', cellsformat: 'f3' },
318aab371497 Profile style is using indexes. Profile styles and fermentation switched to POST. Standard edit screens.
Michiel Broek <mbroek@mbse.eu>
parents: 66
diff changeset
230 { text: 'FG', menu: false, datafield: 'fg_min', width: 60, align: 'right', cellsalign: 'right', cellsformat: 'f3' },
318aab371497 Profile style is using indexes. Profile styles and fermentation switched to POST. Standard edit screens.
Michiel Broek <mbroek@mbse.eu>
parents: 66
diff changeset
231 { text: 'FG', menu: false, datafield: 'fg_max', width: 60, align: 'right', cellsalign: 'right', cellsformat: 'f3' },
318aab371497 Profile style is using indexes. Profile styles and fermentation switched to POST. Standard edit screens.
Michiel Broek <mbroek@mbse.eu>
parents: 66
diff changeset
232 { text: 'IBU', menu: false, datafield: 'ibu_min', width: 60, align: 'right', cellsalign: 'right', cellsformat: 'f0' },
318aab371497 Profile style is using indexes. Profile styles and fermentation switched to POST. Standard edit screens.
Michiel Broek <mbroek@mbse.eu>
parents: 66
diff changeset
233 { text: 'IBU', menu: false, datafield: 'ibu_max', width: 60, align: 'right', cellsalign: 'right', cellsformat: 'f0' },
318aab371497 Profile style is using indexes. Profile styles and fermentation switched to POST. Standard edit screens.
Michiel Broek <mbroek@mbse.eu>
parents: 66
diff changeset
234 { text: 'EBC', menu: false, datafield: 'color_min', width: 60, align: 'right', cellsalign: 'right', cellsformat: 'f0' },
318aab371497 Profile style is using indexes. Profile styles and fermentation switched to POST. Standard edit screens.
Michiel Broek <mbroek@mbse.eu>
parents: 66
diff changeset
235 { text: 'EBC', menu: false, datafield: 'color_max', width: 60, align: 'right', cellsalign: 'right', cellsformat: 'f0' },
318aab371497 Profile style is using indexes. Profile styles and fermentation switched to POST. Standard edit screens.
Michiel Broek <mbroek@mbse.eu>
parents: 66
diff changeset
236 { text: 'Co2', menu: false, datafield: 'carb_min', width: 60, align: 'right', cellsalign: 'right', cellsformat: 'f1' },
318aab371497 Profile style is using indexes. Profile styles and fermentation switched to POST. Standard edit screens.
Michiel Broek <mbroek@mbse.eu>
parents: 66
diff changeset
237 { text: 'Co2', menu: false, datafield: 'carb_max', width: 60, align: 'right', cellsalign: 'right', cellsformat: 'f1' },
318aab371497 Profile style is using indexes. Profile styles and fermentation switched to POST. Standard edit screens.
Michiel Broek <mbroek@mbse.eu>
parents: 66
diff changeset
238 { text: 'ABV', menu: false, datafield: 'abv_min', width: 60, align: 'right', cellsalign: 'right', cellsformat: 'f1' },
318aab371497 Profile style is using indexes. Profile styles and fermentation switched to POST. Standard edit screens.
Michiel Broek <mbroek@mbse.eu>
parents: 66
diff changeset
239 { text: 'ABV', menu: false, datafield: 'abv_max', width: 60, align: 'right', cellsalign: 'right', cellsformat: 'f1' },
286
124af734af68 Version 0.1.0. Removed localization because it was messy, parts were localized and others not. In production and recipes ingredients not in stock are marked in red.
Michiel Broek <mbroek@mbse.eu>
parents: 245
diff changeset
240 { text: '', menu: false, datafield: 'Edit', width: 100, align: 'center', columntype: 'button', cellsrenderer: function () {
34
a720353fada9 Formatting and measurements
Michiel Broek <mbroek@mbse.eu>
parents: 28
diff changeset
241 return "Wijzig";
28
ac959f98e107 Added inventory styles
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
242 }, buttonclick: function (row) {
ac959f98e107 Added inventory styles
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
243 // open the popup window when the user clicks a button.
ac959f98e107 Added inventory styles
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
244 editrow = row;
ac959f98e107 Added inventory styles
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
245 // get the clicked row's data and initialize the input fields.
ac959f98e107 Added inventory styles
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
246 var dataRecord = $("#jqxgrid").jqxGrid('getrowdata', editrow);
ac959f98e107 Added inventory styles
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
247 $("#name").val(dataRecord.name);
ac959f98e107 Added inventory styles
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
248 $("#category").val(dataRecord.category);
ac959f98e107 Added inventory styles
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
249 $("#category_number").val(dataRecord.category_number);
ac959f98e107 Added inventory styles
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
250 $("#style_letter").val(dataRecord.style_letter);
ac959f98e107 Added inventory styles
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
251 $("#style_guide").val(dataRecord.style_guide);
ac959f98e107 Added inventory styles
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
252 $("#type").val(dataRecord.type);
ac959f98e107 Added inventory styles
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
253 $("#og_min").val(dataRecord.og_min);
ac959f98e107 Added inventory styles
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
254 $("#og_max").val(dataRecord.og_max);
ac959f98e107 Added inventory styles
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
255 $("#fg_min").val(dataRecord.fg_min);
ac959f98e107 Added inventory styles
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
256 $("#fg_max").val(dataRecord.fg_max);
ac959f98e107 Added inventory styles
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
257 $("#ibu_min").val(dataRecord.ibu_min);
ac959f98e107 Added inventory styles
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
258 $("#ibu_max").val(dataRecord.ibu_max);
ac959f98e107 Added inventory styles
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
259 $("#color_min").val(dataRecord.color_min);
ac959f98e107 Added inventory styles
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
260 $("#color_max").val(dataRecord.color_max);
ac959f98e107 Added inventory styles
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
261 $("#carb_min").val(dataRecord.carb_min);
ac959f98e107 Added inventory styles
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
262 $("#carb_max").val(dataRecord.carb_max);
ac959f98e107 Added inventory styles
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
263 $("#abv_min").val(dataRecord.abv_min);
ac959f98e107 Added inventory styles
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
264 $("#abv_max").val(dataRecord.abv_max);
ac959f98e107 Added inventory styles
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
265 $("#notes").val(dataRecord.notes);
ac959f98e107 Added inventory styles
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
266 $("#profile").val(dataRecord.profile);
ac959f98e107 Added inventory styles
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
267 $("#ingredients").val(dataRecord.ingredients);
ac959f98e107 Added inventory styles
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
268 $("#examples").val(dataRecord.examples);
ac959f98e107 Added inventory styles
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
269 // show the popup window.
ac959f98e107 Added inventory styles
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
270 $("#popupWindow").jqxWindow('open');
ac959f98e107 Added inventory styles
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
271 }
ac959f98e107 Added inventory styles
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
272 }
ac959f98e107 Added inventory styles
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
273 ]
ac959f98e107 Added inventory styles
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
274 });
ac959f98e107 Added inventory styles
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
275 // initialize the popup window and buttons.
ac959f98e107 Added inventory styles
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
276 $("#popupWindow").jqxWindow({
217
318aab371497 Profile style is using indexes. Profile styles and fermentation switched to POST. Standard edit screens.
Michiel Broek <mbroek@mbse.eu>
parents: 66
diff changeset
277 width: 1050,
318aab371497 Profile style is using indexes. Profile styles and fermentation switched to POST. Standard edit screens.
Michiel Broek <mbroek@mbse.eu>
parents: 66
diff changeset
278 position: { x: 110, y: 30 },
318aab371497 Profile style is using indexes. Profile styles and fermentation switched to POST. Standard edit screens.
Michiel Broek <mbroek@mbse.eu>
parents: 66
diff changeset
279 resizable: false,
318aab371497 Profile style is using indexes. Profile styles and fermentation switched to POST. Standard edit screens.
Michiel Broek <mbroek@mbse.eu>
parents: 66
diff changeset
280 theme: theme,
318aab371497 Profile style is using indexes. Profile styles and fermentation switched to POST. Standard edit screens.
Michiel Broek <mbroek@mbse.eu>
parents: 66
diff changeset
281 isModal: true,
318aab371497 Profile style is using indexes. Profile styles and fermentation switched to POST. Standard edit screens.
Michiel Broek <mbroek@mbse.eu>
parents: 66
diff changeset
282 autoOpen: false,
318aab371497 Profile style is using indexes. Profile styles and fermentation switched to POST. Standard edit screens.
Michiel Broek <mbroek@mbse.eu>
parents: 66
diff changeset
283 cancelButton: $("#Cancel"),
318aab371497 Profile style is using indexes. Profile styles and fermentation switched to POST. Standard edit screens.
Michiel Broek <mbroek@mbse.eu>
parents: 66
diff changeset
284 modalOpacity: 0.40
28
ac959f98e107 Added inventory styles
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
285 });
ac959f98e107 Added inventory styles
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
286 $("#popupWindow").on('open', function () {
ac959f98e107 Added inventory styles
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
287 $("#name").jqxInput('selectAll');
ac959f98e107 Added inventory styles
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
288 });
217
318aab371497 Profile style is using indexes. Profile styles and fermentation switched to POST. Standard edit screens.
Michiel Broek <mbroek@mbse.eu>
parents: 66
diff changeset
289 $("#Delete").jqxButton({ template: "danger", width: '90px', theme: theme });
28
ac959f98e107 Added inventory styles
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
290 $("#Delete").click(function () {
ac959f98e107 Added inventory styles
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
291 if (editrow >= 0) {
ac959f98e107 Added inventory styles
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
292 // Open a popup to confirm this action.
ac959f98e107 Added inventory styles
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
293 $('#eventWindow').jqxWindow('open');
ac959f98e107 Added inventory styles
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
294 $("#delOk").click(function () {
ac959f98e107 Added inventory styles
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
295 var rowID = $('#jqxgrid').jqxGrid('getrowid', editrow);
ac959f98e107 Added inventory styles
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
296 $("#jqxgrid").jqxGrid('deleterow', rowID);
ac959f98e107 Added inventory styles
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
297 });
ac959f98e107 Added inventory styles
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
298 }
ac959f98e107 Added inventory styles
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
299 $("#popupWindow").jqxWindow('hide');
ac959f98e107 Added inventory styles
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
300 });
217
318aab371497 Profile style is using indexes. Profile styles and fermentation switched to POST. Standard edit screens.
Michiel Broek <mbroek@mbse.eu>
parents: 66
diff changeset
301 $("#Cancel").jqxButton({ template: "primary", width: '90px', theme: theme });
318aab371497 Profile style is using indexes. Profile styles and fermentation switched to POST. Standard edit screens.
Michiel Broek <mbroek@mbse.eu>
parents: 66
diff changeset
302 $("#Save").jqxButton({ template: "success", width: '90px', theme: theme });
28
ac959f98e107 Added inventory styles
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
303 // update the edited row when the user clicks the 'Save' button.
ac959f98e107 Added inventory styles
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
304 $("#Save").click(function () {
217
318aab371497 Profile style is using indexes. Profile styles and fermentation switched to POST. Standard edit screens.
Michiel Broek <mbroek@mbse.eu>
parents: 66
diff changeset
305 var rowID = -1;
28
ac959f98e107 Added inventory styles
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
306 if (editrow >= 0) {
217
318aab371497 Profile style is using indexes. Profile styles and fermentation switched to POST. Standard edit screens.
Michiel Broek <mbroek@mbse.eu>
parents: 66
diff changeset
307 rowID = $('#jqxgrid').jqxGrid('getrowid', editrow);
318aab371497 Profile style is using indexes. Profile styles and fermentation switched to POST. Standard edit screens.
Michiel Broek <mbroek@mbse.eu>
parents: 66
diff changeset
308 }
318aab371497 Profile style is using indexes. Profile styles and fermentation switched to POST. Standard edit screens.
Michiel Broek <mbroek@mbse.eu>
parents: 66
diff changeset
309 var row = {
318aab371497 Profile style is using indexes. Profile styles and fermentation switched to POST. Standard edit screens.
Michiel Broek <mbroek@mbse.eu>
parents: 66
diff changeset
310 record: rowID,
318aab371497 Profile style is using indexes. Profile styles and fermentation switched to POST. Standard edit screens.
Michiel Broek <mbroek@mbse.eu>
parents: 66
diff changeset
311 name: $("#name").val(),
318aab371497 Profile style is using indexes. Profile styles and fermentation switched to POST. Standard edit screens.
Michiel Broek <mbroek@mbse.eu>
parents: 66
diff changeset
312 category: $("#category").val(),
318aab371497 Profile style is using indexes. Profile styles and fermentation switched to POST. Standard edit screens.
Michiel Broek <mbroek@mbse.eu>
parents: 66
diff changeset
313 category_number: parseFloat($("#category_number").jqxNumberInput('decimal')),
318aab371497 Profile style is using indexes. Profile styles and fermentation switched to POST. Standard edit screens.
Michiel Broek <mbroek@mbse.eu>
parents: 66
diff changeset
314 style_letter: $("#style_letter").val(),
318aab371497 Profile style is using indexes. Profile styles and fermentation switched to POST. Standard edit screens.
Michiel Broek <mbroek@mbse.eu>
parents: 66
diff changeset
315 style_guide: $("#style_guide").val(),
318aab371497 Profile style is using indexes. Profile styles and fermentation switched to POST. Standard edit screens.
Michiel Broek <mbroek@mbse.eu>
parents: 66
diff changeset
316 type: $("#type").val(),
318aab371497 Profile style is using indexes. Profile styles and fermentation switched to POST. Standard edit screens.
Michiel Broek <mbroek@mbse.eu>
parents: 66
diff changeset
317 og_min: parseFloat($("#og_min").jqxNumberInput('decimal')),
318aab371497 Profile style is using indexes. Profile styles and fermentation switched to POST. Standard edit screens.
Michiel Broek <mbroek@mbse.eu>
parents: 66
diff changeset
318 og_max: parseFloat($("#og_max").jqxNumberInput('decimal')),
318aab371497 Profile style is using indexes. Profile styles and fermentation switched to POST. Standard edit screens.
Michiel Broek <mbroek@mbse.eu>
parents: 66
diff changeset
319 fg_min: parseFloat($("#fg_min").jqxNumberInput('decimal')),
318aab371497 Profile style is using indexes. Profile styles and fermentation switched to POST. Standard edit screens.
Michiel Broek <mbroek@mbse.eu>
parents: 66
diff changeset
320 fg_max: parseFloat($("#fg_max").jqxNumberInput('decimal')),
318aab371497 Profile style is using indexes. Profile styles and fermentation switched to POST. Standard edit screens.
Michiel Broek <mbroek@mbse.eu>
parents: 66
diff changeset
321 ibu_min: parseFloat($("#ibu_min").jqxNumberInput('decimal')),
318aab371497 Profile style is using indexes. Profile styles and fermentation switched to POST. Standard edit screens.
Michiel Broek <mbroek@mbse.eu>
parents: 66
diff changeset
322 ibu_max: parseFloat($("#ibu_max").jqxNumberInput('decimal')),
318aab371497 Profile style is using indexes. Profile styles and fermentation switched to POST. Standard edit screens.
Michiel Broek <mbroek@mbse.eu>
parents: 66
diff changeset
323 color_min: parseFloat($("#color_min").jqxNumberInput('decimal')),
318aab371497 Profile style is using indexes. Profile styles and fermentation switched to POST. Standard edit screens.
Michiel Broek <mbroek@mbse.eu>
parents: 66
diff changeset
324 color_max: parseFloat($("#color_max").jqxNumberInput('decimal')),
318aab371497 Profile style is using indexes. Profile styles and fermentation switched to POST. Standard edit screens.
Michiel Broek <mbroek@mbse.eu>
parents: 66
diff changeset
325 carb_min: parseFloat($("#carb_min").jqxNumberInput('decimal')),
318aab371497 Profile style is using indexes. Profile styles and fermentation switched to POST. Standard edit screens.
Michiel Broek <mbroek@mbse.eu>
parents: 66
diff changeset
326 carb_max: parseFloat($("#carb_max").jqxNumberInput('decimal')),
318aab371497 Profile style is using indexes. Profile styles and fermentation switched to POST. Standard edit screens.
Michiel Broek <mbroek@mbse.eu>
parents: 66
diff changeset
327 abv_min: parseFloat($("#abv_min").jqxNumberInput('decimal')),
318aab371497 Profile style is using indexes. Profile styles and fermentation switched to POST. Standard edit screens.
Michiel Broek <mbroek@mbse.eu>
parents: 66
diff changeset
328 abv_max: parseFloat($("#abv_max").jqxNumberInput('decimal')),
318aab371497 Profile style is using indexes. Profile styles and fermentation switched to POST. Standard edit screens.
Michiel Broek <mbroek@mbse.eu>
parents: 66
diff changeset
329 notes: $("#notes").val(),
318aab371497 Profile style is using indexes. Profile styles and fermentation switched to POST. Standard edit screens.
Michiel Broek <mbroek@mbse.eu>
parents: 66
diff changeset
330 profile: $("#profile").val(),
318aab371497 Profile style is using indexes. Profile styles and fermentation switched to POST. Standard edit screens.
Michiel Broek <mbroek@mbse.eu>
parents: 66
diff changeset
331 ingredients: $("#ingredients").val(),
318aab371497 Profile style is using indexes. Profile styles and fermentation switched to POST. Standard edit screens.
Michiel Broek <mbroek@mbse.eu>
parents: 66
diff changeset
332 examples: $("#examples").val()
318aab371497 Profile style is using indexes. Profile styles and fermentation switched to POST. Standard edit screens.
Michiel Broek <mbroek@mbse.eu>
parents: 66
diff changeset
333 };
318aab371497 Profile style is using indexes. Profile styles and fermentation switched to POST. Standard edit screens.
Michiel Broek <mbroek@mbse.eu>
parents: 66
diff changeset
334 if (editrow >= 0) {
28
ac959f98e107 Added inventory styles
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
335 $('#jqxgrid').jqxGrid('updaterow', rowID, row);
ac959f98e107 Added inventory styles
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
336 } else {
217
318aab371497 Profile style is using indexes. Profile styles and fermentation switched to POST. Standard edit screens.
Michiel Broek <mbroek@mbse.eu>
parents: 66
diff changeset
337 $('#jqxgrid').jqxGrid('addrow', null, row);
28
ac959f98e107 Added inventory styles
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
338 }
217
318aab371497 Profile style is using indexes. Profile styles and fermentation switched to POST. Standard edit screens.
Michiel Broek <mbroek@mbse.eu>
parents: 66
diff changeset
339 $("#popupWindow").jqxWindow('hide');
318aab371497 Profile style is using indexes. Profile styles and fermentation switched to POST. Standard edit screens.
Michiel Broek <mbroek@mbse.eu>
parents: 66
diff changeset
340 location.reload( true ); // reload ourself.
28
ac959f98e107 Added inventory styles
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
341 });
ac959f98e107 Added inventory styles
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
342 createDelElements();
ac959f98e107 Added inventory styles
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
343 });
ac959f98e107 Added inventory styles
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
344

mercurial