www/js/profile_mash.js

Thu, 12 Sep 2019 23:03:12 +0200

author
Michiel Broek <mbroek@mbse.eu>
date
Thu, 12 Sep 2019 23:03:12 +0200
changeset 482
ce814c787b79
parent 286
124af734af68
child 483
ac69a63dc23e
permissions
-rw-r--r--

Fixed not creating new records

23
4b157d7a1cee Added first part of mash profiles. Steps are in the database but not in the web ui.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1 /*****************************************************************************
286
124af734af68 Version 0.1.0. Removed localization because it was messy, parts were localized and others not. In production and recipes ingredients not in stock are marked in red.
Michiel Broek <mbroek@mbse.eu>
parents: 245
diff changeset
2 * Copyright (C) 2014-2019
23
4b157d7a1cee Added first part of mash profiles. Steps are in the database but not in the web ui.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
3 *
4b157d7a1cee Added first part of mash profiles. Steps are in the database but not in the web ui.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
4 * Michiel Broek <mbroek at mbse dot eu>
4b157d7a1cee Added first part of mash profiles. Steps are in the database but not in the web ui.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
5 *
4b157d7a1cee Added first part of mash profiles. Steps are in the database but not in the web ui.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
6 * This file is part of BrewCloud
4b157d7a1cee Added first part of mash profiles. Steps are in the database but not in the web ui.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
7 *
4b157d7a1cee Added first part of mash profiles. Steps are in the database but not in the web ui.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
8 * This is free software; you can redistribute it and/or modify it
4b157d7a1cee Added first part of mash profiles. Steps are in the database but not in the web ui.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
9 * under the terms of the GNU General Public License as published by the
4b157d7a1cee Added first part of mash profiles. Steps are in the database but not in the web ui.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
10 * Free Software Foundation; either version 2, or (at your option) any
4b157d7a1cee Added first part of mash profiles. Steps are in the database but not in the web ui.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
11 * later version.
4b157d7a1cee Added first part of mash profiles. Steps are in the database but not in the web ui.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
12 *
4b157d7a1cee Added first part of mash profiles. Steps are in the database but not in the web ui.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
13 * BrewCloud is distributed in the hope that it will be useful, but
4b157d7a1cee Added first part of mash profiles. Steps are in the database but not in the web ui.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
14 * WITHOUT ANY WARRANTY; without even the implied warranty of
4b157d7a1cee Added first part of mash profiles. Steps are in the database but not in the web ui.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
4b157d7a1cee Added first part of mash profiles. Steps are in the database but not in the web ui.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
16 * General Public License for more details.
4b157d7a1cee Added first part of mash profiles. Steps are in the database but not in the web ui.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
17 *
4b157d7a1cee Added first part of mash profiles. Steps are in the database but not in the web ui.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
18 * You should have received a copy of the GNU General Public License
4b157d7a1cee Added first part of mash profiles. Steps are in the database but not in the web ui.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
19 * along with ThermFerm; see the file COPYING. If not, write to the Free
4b157d7a1cee Added first part of mash profiles. Steps are in the database but not in the web ui.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
20 * Software Foundation, 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
4b157d7a1cee Added first part of mash profiles. Steps are in the database but not in the web ui.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
21 *****************************************************************************/
4b157d7a1cee Added first part of mash profiles. Steps are in the database but not in the web ui.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
22
4b157d7a1cee Added first part of mash profiles. Steps are in the database but not in the web ui.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
23
4b157d7a1cee Added first part of mash profiles. Steps are in the database but not in the web ui.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
24 function createDelElements() {
4b157d7a1cee Added first part of mash profiles. Steps are in the database but not in the web ui.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
25 $('#eventWindow').jqxWindow({
4b157d7a1cee Added first part of mash profiles. Steps are in the database but not in the web ui.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
26 theme: theme,
4b157d7a1cee Added first part of mash profiles. Steps are in the database but not in the web ui.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
27 position: { x: 490, y: 210 },
4b157d7a1cee Added first part of mash profiles. Steps are in the database but not in the web ui.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
28 width: 300,
38
b7d44c98d609 Initial setup for mash steps editing.
Michiel Broek <mbroek@mbse.eu>
parents: 25
diff changeset
29 height: 175,
23
4b157d7a1cee Added first part of mash profiles. Steps are in the database but not in the web ui.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
30 resizable: false,
4b157d7a1cee Added first part of mash profiles. Steps are in the database but not in the web ui.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
31 isModal: true,
4b157d7a1cee Added first part of mash profiles. Steps are in the database but not in the web ui.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
32 modalOpacity: 0.4,
4b157d7a1cee Added first part of mash profiles. Steps are in the database but not in the web ui.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
33 okButton: $('#delOk'),
4b157d7a1cee Added first part of mash profiles. Steps are in the database but not in the web ui.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
34 cancelButton: $('#delCancel'),
4b157d7a1cee Added first part of mash profiles. Steps are in the database but not in the web ui.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
35 initContent: function () {
120
b28a3d6143bc Screen layout changes.
Michiel Broek <mbroek@mbse.eu>
parents: 45
diff changeset
36 $('#delOk').jqxButton({ template: "danger", width: '65px', theme: theme });
b28a3d6143bc Screen layout changes.
Michiel Broek <mbroek@mbse.eu>
parents: 45
diff changeset
37 $('#delCancel').jqxButton({ template: "success", width: '65px', theme: theme });
23
4b157d7a1cee Added first part of mash profiles. Steps are in the database but not in the web ui.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
38 $('#delCancel').focus();
4b157d7a1cee Added first part of mash profiles. Steps are in the database but not in the web ui.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
39 }
4b157d7a1cee Added first part of mash profiles. Steps are in the database but not in the web ui.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
40 });
4b157d7a1cee Added first part of mash profiles. Steps are in the database but not in the web ui.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
41 $('#eventWindow').jqxWindow('hide');
4b157d7a1cee Added first part of mash profiles. Steps are in the database but not in the web ui.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
42 }
4b157d7a1cee Added first part of mash profiles. Steps are in the database but not in the web ui.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
43
4b157d7a1cee Added first part of mash profiles. Steps are in the database but not in the web ui.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
44
4b157d7a1cee Added first part of mash profiles. Steps are in the database but not in the web ui.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
45 $(document).ready(function () {
215
83cee005d2d9 Fixed the utf-8 problems when storing json arrays on the server by using manual encoding. The json-encode function sucks for this project. Added step detail edit screen instead of on grid cell editing. This must go into the product and recipe editors too.
Michiel Broek <mbroek@mbse.eu>
parents: 213
diff changeset
46
83cee005d2d9 Fixed the utf-8 problems when storing json arrays on the server by using manual encoding. The json-encode function sucks for this project. Added step detail edit screen instead of on grid cell editing. This must go into the product and recipe editors too.
Michiel Broek <mbroek@mbse.eu>
parents: 213
diff changeset
47 var steprow = 0;
83cee005d2d9 Fixed the utf-8 problems when storing json arrays on the server by using manual encoding. The json-encode function sucks for this project. Added step detail edit screen instead of on grid cell editing. This must go into the product and recipe editors too.
Michiel Broek <mbroek@mbse.eu>
parents: 213
diff changeset
48 var stepData = {};
83cee005d2d9 Fixed the utf-8 problems when storing json arrays on the server by using manual encoding. The json-encode function sucks for this project. Added step detail edit screen instead of on grid cell editing. This must go into the product and recipe editors too.
Michiel Broek <mbroek@mbse.eu>
parents: 213
diff changeset
49 var dataRecord = {};
482
ce814c787b79 Fixed not creating new records
Michiel Broek <mbroek@mbse.eu>
parents: 286
diff changeset
50 var url = 'includes/db_profile_mash.php';
215
83cee005d2d9 Fixed the utf-8 problems when storing json arrays on the server by using manual encoding. The json-encode function sucks for this project. Added step detail edit screen instead of on grid cell editing. This must go into the product and recipe editors too.
Michiel Broek <mbroek@mbse.eu>
parents: 213
diff changeset
51
40
b825c675987d Finished mash steps editing. Style sheets cleanup.
Michiel Broek <mbroek@mbse.eu>
parents: 39
diff changeset
52 // tooltips
b825c675987d Finished mash steps editing. Style sheets cleanup.
Michiel Broek <mbroek@mbse.eu>
parents: 39
diff changeset
53 $("#name").jqxTooltip({ content: 'De naam voor dit maisch profiel.' });
213
b0d484a5525e First step to make profile mash work with indexes and make the edit screen universal.
Michiel Broek <mbroek@mbse.eu>
parents: 120
diff changeset
54 $("#notes").jqxTooltip({ content: 'De uitgebreide opmerkingen over dit maisch profiel.' });
23
4b157d7a1cee Added first part of mash profiles. Steps are in the database but not in the web ui.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
55 // prepare the data
4b157d7a1cee Added first part of mash profiles. Steps are in the database but not in the web ui.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
56 var source = {
482
ce814c787b79 Fixed not creating new records
Michiel Broek <mbroek@mbse.eu>
parents: 286
diff changeset
57 datatype: 'json',
23
4b157d7a1cee Added first part of mash profiles. Steps are in the database but not in the web ui.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
58 cache: false,
4b157d7a1cee Added first part of mash profiles. Steps are in the database but not in the web ui.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
59 datafields: [
4b157d7a1cee Added first part of mash profiles. Steps are in the database but not in the web ui.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
60 { name: 'record', type: 'number' },
4b157d7a1cee Added first part of mash profiles. Steps are in the database but not in the web ui.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
61 { name: 'name', type: 'string' },
4b157d7a1cee Added first part of mash profiles. Steps are in the database but not in the web ui.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
62 { name: 'notes', type: 'string' },
38
b7d44c98d609 Initial setup for mash steps editing.
Michiel Broek <mbroek@mbse.eu>
parents: 25
diff changeset
63 { name: 'steps', type: 'array' }
23
4b157d7a1cee Added first part of mash profiles. Steps are in the database but not in the web ui.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
64 ],
4b157d7a1cee Added first part of mash profiles. Steps are in the database but not in the web ui.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
65 id: 'record',
4b157d7a1cee Added first part of mash profiles. Steps are in the database but not in the web ui.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
66 url: url,
4b157d7a1cee Added first part of mash profiles. Steps are in the database but not in the web ui.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
67 deleterow: function (rowid, commit) {
4b157d7a1cee Added first part of mash profiles. Steps are in the database but not in the web ui.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
68 // synchronize with the server - send delete command
4b157d7a1cee Added first part of mash profiles. Steps are in the database but not in the web ui.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
69 var data = "delete=true&" + $.param({ record: rowid });
4b157d7a1cee Added first part of mash profiles. Steps are in the database but not in the web ui.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
70 $.ajax({
4b157d7a1cee Added first part of mash profiles. Steps are in the database but not in the web ui.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
71 dataType: 'json',
4b157d7a1cee Added first part of mash profiles. Steps are in the database but not in the web ui.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
72 url: url,
4b157d7a1cee Added first part of mash profiles. Steps are in the database but not in the web ui.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
73 cache: false,
4b157d7a1cee Added first part of mash profiles. Steps are in the database but not in the web ui.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
74 data: data,
482
ce814c787b79 Fixed not creating new records
Michiel Broek <mbroek@mbse.eu>
parents: 286
diff changeset
75 type: 'POST',
23
4b157d7a1cee Added first part of mash profiles. Steps are in the database but not in the web ui.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
76 success: function (data, status, xhr) {
4b157d7a1cee Added first part of mash profiles. Steps are in the database but not in the web ui.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
77 commit(true);
482
ce814c787b79 Fixed not creating new records
Michiel Broek <mbroek@mbse.eu>
parents: 286
diff changeset
78 console.log('mash deleterow ' + rowid + ' success');
23
4b157d7a1cee Added first part of mash profiles. Steps are in the database but not in the web ui.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
79 },
4b157d7a1cee Added first part of mash profiles. Steps are in the database but not in the web ui.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
80 error: function (jqXHR, textStatus, errorThrown) {
4b157d7a1cee Added first part of mash profiles. Steps are in the database but not in the web ui.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
81 commit(false);
482
ce814c787b79 Fixed not creating new records
Michiel Broek <mbroek@mbse.eu>
parents: 286
diff changeset
82 console.log('mash deleterow ' + textStatus);
23
4b157d7a1cee Added first part of mash profiles. Steps are in the database but not in the web ui.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
83 }
4b157d7a1cee Added first part of mash profiles. Steps are in the database but not in the web ui.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
84 });
4b157d7a1cee Added first part of mash profiles. Steps are in the database but not in the web ui.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
85 },
4b157d7a1cee Added first part of mash profiles. Steps are in the database but not in the web ui.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
86 addrow: function (rowid, rowdata, position, commit) {
4b157d7a1cee Added first part of mash profiles. Steps are in the database but not in the web ui.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
87 var data = "insert=true&" + $.param(rowdata);
4b157d7a1cee Added first part of mash profiles. Steps are in the database but not in the web ui.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
88 $.ajax({
4b157d7a1cee Added first part of mash profiles. Steps are in the database but not in the web ui.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
89 dataType: 'json',
4b157d7a1cee Added first part of mash profiles. Steps are in the database but not in the web ui.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
90 url: url,
4b157d7a1cee Added first part of mash profiles. Steps are in the database but not in the web ui.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
91 cache: false,
4b157d7a1cee Added first part of mash profiles. Steps are in the database but not in the web ui.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
92 data: data,
213
b0d484a5525e First step to make profile mash work with indexes and make the edit screen universal.
Michiel Broek <mbroek@mbse.eu>
parents: 120
diff changeset
93 type: "POST",
23
4b157d7a1cee Added first part of mash profiles. Steps are in the database but not in the web ui.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
94 success: function (data, status, xhr) {
4b157d7a1cee Added first part of mash profiles. Steps are in the database but not in the web ui.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
95 commit(true);
482
ce814c787b79 Fixed not creating new records
Michiel Broek <mbroek@mbse.eu>
parents: 286
diff changeset
96 console.log('mash addrow ' + rowid + ' success');
23
4b157d7a1cee Added first part of mash profiles. Steps are in the database but not in the web ui.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
97 },
4b157d7a1cee Added first part of mash profiles. Steps are in the database but not in the web ui.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
98 error: function(jqXHR, textStatus, errorThrown) {
4b157d7a1cee Added first part of mash profiles. Steps are in the database but not in the web ui.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
99 commit(false);
482
ce814c787b79 Fixed not creating new records
Michiel Broek <mbroek@mbse.eu>
parents: 286
diff changeset
100 console.log('mash addrow ' + textStatus);
23
4b157d7a1cee Added first part of mash profiles. Steps are in the database but not in the web ui.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
101 }
4b157d7a1cee Added first part of mash profiles. Steps are in the database but not in the web ui.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
102 });
4b157d7a1cee Added first part of mash profiles. Steps are in the database but not in the web ui.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
103 },
4b157d7a1cee Added first part of mash profiles. Steps are in the database but not in the web ui.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
104 updaterow: function (rowid, rowdata, commit) {
4b157d7a1cee Added first part of mash profiles. Steps are in the database but not in the web ui.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
105 var data = "update=true&" + $.param(rowdata);
4b157d7a1cee Added first part of mash profiles. Steps are in the database but not in the web ui.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
106 $.ajax({
4b157d7a1cee Added first part of mash profiles. Steps are in the database but not in the web ui.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
107 dataType: 'json',
4b157d7a1cee Added first part of mash profiles. Steps are in the database but not in the web ui.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
108 url: url,
4b157d7a1cee Added first part of mash profiles. Steps are in the database but not in the web ui.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
109 cache: false,
4b157d7a1cee Added first part of mash profiles. Steps are in the database but not in the web ui.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
110 data: data,
213
b0d484a5525e First step to make profile mash work with indexes and make the edit screen universal.
Michiel Broek <mbroek@mbse.eu>
parents: 120
diff changeset
111 type: "POST",
23
4b157d7a1cee Added first part of mash profiles. Steps are in the database but not in the web ui.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
112 success: function (data, status, xhr) {
4b157d7a1cee Added first part of mash profiles. Steps are in the database but not in the web ui.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
113 commit(true);
482
ce814c787b79 Fixed not creating new records
Michiel Broek <mbroek@mbse.eu>
parents: 286
diff changeset
114 console.log('mash updaterow ' + rowid + ' success');
23
4b157d7a1cee Added first part of mash profiles. Steps are in the database but not in the web ui.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
115 },
4b157d7a1cee Added first part of mash profiles. Steps are in the database but not in the web ui.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
116 error: function(jqXHR, textStatus, errorThrown) {
4b157d7a1cee Added first part of mash profiles. Steps are in the database but not in the web ui.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
117 commit(false);
482
ce814c787b79 Fixed not creating new records
Michiel Broek <mbroek@mbse.eu>
parents: 286
diff changeset
118 console.log('mash updaterow ' + textStatus);
23
4b157d7a1cee Added first part of mash profiles. Steps are in the database but not in the web ui.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
119 }
4b157d7a1cee Added first part of mash profiles. Steps are in the database but not in the web ui.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
120 });
4b157d7a1cee Added first part of mash profiles. Steps are in the database but not in the web ui.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
121 }
4b157d7a1cee Added first part of mash profiles. Steps are in the database but not in the web ui.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
122 };
215
83cee005d2d9 Fixed the utf-8 problems when storing json arrays on the server by using manual encoding. The json-encode function sucks for this project. Added step detail edit screen instead of on grid cell editing. This must go into the product and recipe editors too.
Michiel Broek <mbroek@mbse.eu>
parents: 213
diff changeset
123 // Initialize the input fields.
83cee005d2d9 Fixed the utf-8 problems when storing json arrays on the server by using manual encoding. The json-encode function sucks for this project. Added step detail edit screen instead of on grid cell editing. This must go into the product and recipe editors too.
Michiel Broek <mbroek@mbse.eu>
parents: 213
diff changeset
124 $("#m_step_name").jqxInput({ theme: theme, width: 320, height: 23 });
83cee005d2d9 Fixed the utf-8 problems when storing json arrays on the server by using manual encoding. The json-encode function sucks for this project. Added step detail edit screen instead of on grid cell editing. This must go into the product and recipe editors too.
Michiel Broek <mbroek@mbse.eu>
parents: 213
diff changeset
125 $("#m_step_type").jqxDropDownList({
83cee005d2d9 Fixed the utf-8 problems when storing json arrays on the server by using manual encoding. The json-encode function sucks for this project. Added step detail edit screen instead of on grid cell editing. This must go into the product and recipe editors too.
Michiel Broek <mbroek@mbse.eu>
parents: 213
diff changeset
126 theme: theme,
83cee005d2d9 Fixed the utf-8 problems when storing json arrays on the server by using manual encoding. The json-encode function sucks for this project. Added step detail edit screen instead of on grid cell editing. This must go into the product and recipe editors too.
Michiel Broek <mbroek@mbse.eu>
parents: 213
diff changeset
127 source: MashStepTypeAdapter,
83cee005d2d9 Fixed the utf-8 problems when storing json arrays on the server by using manual encoding. The json-encode function sucks for this project. Added step detail edit screen instead of on grid cell editing. This must go into the product and recipe editors too.
Michiel Broek <mbroek@mbse.eu>
parents: 213
diff changeset
128 valueMember: 'id',
83cee005d2d9 Fixed the utf-8 problems when storing json arrays on the server by using manual encoding. The json-encode function sucks for this project. Added step detail edit screen instead of on grid cell editing. This must go into the product and recipe editors too.
Michiel Broek <mbroek@mbse.eu>
parents: 213
diff changeset
129 displayMember: 'nl',
83cee005d2d9 Fixed the utf-8 problems when storing json arrays on the server by using manual encoding. The json-encode function sucks for this project. Added step detail edit screen instead of on grid cell editing. This must go into the product and recipe editors too.
Michiel Broek <mbroek@mbse.eu>
parents: 213
diff changeset
130 width: 180,
83cee005d2d9 Fixed the utf-8 problems when storing json arrays on the server by using manual encoding. The json-encode function sucks for this project. Added step detail edit screen instead of on grid cell editing. This must go into the product and recipe editors too.
Michiel Broek <mbroek@mbse.eu>
parents: 213
diff changeset
131 height: 23,
83cee005d2d9 Fixed the utf-8 problems when storing json arrays on the server by using manual encoding. The json-encode function sucks for this project. Added step detail edit screen instead of on grid cell editing. This must go into the product and recipe editors too.
Michiel Broek <mbroek@mbse.eu>
parents: 213
diff changeset
132 autoDropDownHeight: true
83cee005d2d9 Fixed the utf-8 problems when storing json arrays on the server by using manual encoding. The json-encode function sucks for this project. Added step detail edit screen instead of on grid cell editing. This must go into the product and recipe editors too.
Michiel Broek <mbroek@mbse.eu>
parents: 213
diff changeset
133 });
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: 215
diff changeset
134 $("#m_step_temp").jqxNumberInput( Spin1dec );
215
83cee005d2d9 Fixed the utf-8 problems when storing json arrays on the server by using manual encoding. The json-encode function sucks for this project. Added step detail edit screen instead of on grid cell editing. This must go into the product and recipe editors too.
Michiel Broek <mbroek@mbse.eu>
parents: 213
diff changeset
135 $("#m_step_temp").jqxNumberInput({ Min: 30, Max: 80 });
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: 215
diff changeset
136 $("#m_end_temp").jqxNumberInput( Spin1dec );
215
83cee005d2d9 Fixed the utf-8 problems when storing json arrays on the server by using manual encoding. The json-encode function sucks for this project. Added step detail edit screen instead of on grid cell editing. This must go into the product and recipe editors too.
Michiel Broek <mbroek@mbse.eu>
parents: 213
diff changeset
137 $("#m_end_temp").jqxNumberInput({ Min: 30, Max: 80 });
83cee005d2d9 Fixed the utf-8 problems when storing json arrays on the server by using manual encoding. The json-encode function sucks for this project. Added step detail edit screen instead of on grid cell editing. This must go into the product and recipe editors too.
Michiel Broek <mbroek@mbse.eu>
parents: 213
diff changeset
138 $("#m_step_time").jqxNumberInput( PosInt );
83cee005d2d9 Fixed the utf-8 problems when storing json arrays on the server by using manual encoding. The json-encode function sucks for this project. Added step detail edit screen instead of on grid cell editing. This must go into the product and recipe editors too.
Michiel Broek <mbroek@mbse.eu>
parents: 213
diff changeset
139 $("#m_step_time").jqxNumberInput({ Min: 1, Max: 120 });
83cee005d2d9 Fixed the utf-8 problems when storing json arrays on the server by using manual encoding. The json-encode function sucks for this project. Added step detail edit screen instead of on grid cell editing. This must go into the product and recipe editors too.
Michiel Broek <mbroek@mbse.eu>
parents: 213
diff changeset
140 $("#m_ramp_time").jqxNumberInput( PosInt );
83cee005d2d9 Fixed the utf-8 problems when storing json arrays on the server by using manual encoding. The json-encode function sucks for this project. Added step detail edit screen instead of on grid cell editing. This must go into the product and recipe editors too.
Michiel Broek <mbroek@mbse.eu>
parents: 213
diff changeset
141 $("#m_ramp_time").jqxNumberInput({ Min: 1, Max: 30 });
83cee005d2d9 Fixed the utf-8 problems when storing json arrays on the server by using manual encoding. The json-encode function sucks for this project. Added step detail edit screen instead of on grid cell editing. This must go into the product and recipe editors too.
Michiel Broek <mbroek@mbse.eu>
parents: 213
diff changeset
142
482
ce814c787b79 Fixed not creating new records
Michiel Broek <mbroek@mbse.eu>
parents: 286
diff changeset
143 var dataAdapter = new $.jqx.dataAdapter(source),
ce814c787b79 Fixed not creating new records
Michiel Broek <mbroek@mbse.eu>
parents: 286
diff changeset
144 editrow = -1;
ce814c787b79 Fixed not creating new records
Michiel Broek <mbroek@mbse.eu>
parents: 286
diff changeset
145
40
b825c675987d Finished mash steps editing. Style sheets cleanup.
Michiel Broek <mbroek@mbse.eu>
parents: 39
diff changeset
146 // Inline steps editor
38
b7d44c98d609 Initial setup for mash steps editing.
Michiel Broek <mbroek@mbse.eu>
parents: 25
diff changeset
147 var editsteps = function (data) {
b7d44c98d609 Initial setup for mash steps editing.
Michiel Broek <mbroek@mbse.eu>
parents: 25
diff changeset
148 var generaterow = function () {
b7d44c98d609 Initial setup for mash steps editing.
Michiel Broek <mbroek@mbse.eu>
parents: 25
diff changeset
149 var row = {};
213
b0d484a5525e First step to make profile mash work with indexes and make the edit screen universal.
Michiel Broek <mbroek@mbse.eu>
parents: 120
diff changeset
150 row['step_name'] = "Stap 1";
b0d484a5525e First step to make profile mash work with indexes and make the edit screen universal.
Michiel Broek <mbroek@mbse.eu>
parents: 120
diff changeset
151 row['step_type'] = 0;
b0d484a5525e First step to make profile mash work with indexes and make the edit screen universal.
Michiel Broek <mbroek@mbse.eu>
parents: 120
diff changeset
152 row['step_temp'] = 62.0;
38
b7d44c98d609 Initial setup for mash steps editing.
Michiel Broek <mbroek@mbse.eu>
parents: 25
diff changeset
153 row['step_time'] = 20.0;
b7d44c98d609 Initial setup for mash steps editing.
Michiel Broek <mbroek@mbse.eu>
parents: 25
diff changeset
154 row['ramp_time'] = 1.0;
b7d44c98d609 Initial setup for mash steps editing.
Michiel Broek <mbroek@mbse.eu>
parents: 25
diff changeset
155 row['end_temp'] = 62.0;
b7d44c98d609 Initial setup for mash steps editing.
Michiel Broek <mbroek@mbse.eu>
parents: 25
diff changeset
156 return row;
b7d44c98d609 Initial setup for mash steps editing.
Michiel Broek <mbroek@mbse.eu>
parents: 25
diff changeset
157 }
b7d44c98d609 Initial setup for mash steps editing.
Michiel Broek <mbroek@mbse.eu>
parents: 25
diff changeset
158 var stepSource = {
b7d44c98d609 Initial setup for mash steps editing.
Michiel Broek <mbroek@mbse.eu>
parents: 25
diff changeset
159 localdata: data.steps,
b7d44c98d609 Initial setup for mash steps editing.
Michiel Broek <mbroek@mbse.eu>
parents: 25
diff changeset
160 datatype: "local",
b7d44c98d609 Initial setup for mash steps editing.
Michiel Broek <mbroek@mbse.eu>
parents: 25
diff changeset
161 datafields: [
b7d44c98d609 Initial setup for mash steps editing.
Michiel Broek <mbroek@mbse.eu>
parents: 25
diff changeset
162 { name: 'step_name', type: 'string' },
213
b0d484a5525e First step to make profile mash work with indexes and make the edit screen universal.
Michiel Broek <mbroek@mbse.eu>
parents: 120
diff changeset
163 { name: 'step_type', type: 'int' },
38
b7d44c98d609 Initial setup for mash steps editing.
Michiel Broek <mbroek@mbse.eu>
parents: 25
diff changeset
164 { name: 'step_temp', type: 'float' },
b7d44c98d609 Initial setup for mash steps editing.
Michiel Broek <mbroek@mbse.eu>
parents: 25
diff changeset
165 { name: 'step_time', type: 'float' },
b7d44c98d609 Initial setup for mash steps editing.
Michiel Broek <mbroek@mbse.eu>
parents: 25
diff changeset
166 { name: 'ramp_time', type: 'float' },
b7d44c98d609 Initial setup for mash steps editing.
Michiel Broek <mbroek@mbse.eu>
parents: 25
diff changeset
167 { name: 'end_temp', type: 'float' }
b7d44c98d609 Initial setup for mash steps editing.
Michiel Broek <mbroek@mbse.eu>
parents: 25
diff changeset
168 ],
b7d44c98d609 Initial setup for mash steps editing.
Michiel Broek <mbroek@mbse.eu>
parents: 25
diff changeset
169 addrow: function (rowid, rowdata, position, commit) {
b7d44c98d609 Initial setup for mash steps editing.
Michiel Broek <mbroek@mbse.eu>
parents: 25
diff changeset
170 commit(true);
b7d44c98d609 Initial setup for mash steps editing.
Michiel Broek <mbroek@mbse.eu>
parents: 25
diff changeset
171 },
b7d44c98d609 Initial setup for mash steps editing.
Michiel Broek <mbroek@mbse.eu>
parents: 25
diff changeset
172 deleterow: function (rowid, commit) {
b7d44c98d609 Initial setup for mash steps editing.
Michiel Broek <mbroek@mbse.eu>
parents: 25
diff changeset
173 commit(true);
b7d44c98d609 Initial setup for mash steps editing.
Michiel Broek <mbroek@mbse.eu>
parents: 25
diff changeset
174 }
b7d44c98d609 Initial setup for mash steps editing.
Michiel Broek <mbroek@mbse.eu>
parents: 25
diff changeset
175 };
b7d44c98d609 Initial setup for mash steps editing.
Michiel Broek <mbroek@mbse.eu>
parents: 25
diff changeset
176 var stepAdapter = new $.jqx.dataAdapter(stepSource);
b7d44c98d609 Initial setup for mash steps editing.
Michiel Broek <mbroek@mbse.eu>
parents: 25
diff changeset
177 $("#grid").jqxGrid({
215
83cee005d2d9 Fixed the utf-8 problems when storing json arrays on the server by using manual encoding. The json-encode function sucks for this project. Added step detail edit screen instead of on grid cell editing. This must go into the product and recipe editors too.
Michiel Broek <mbroek@mbse.eu>
parents: 213
diff changeset
178 width: 1020,
38
b7d44c98d609 Initial setup for mash steps editing.
Michiel Broek <mbroek@mbse.eu>
parents: 25
diff changeset
179 height: 330,
b7d44c98d609 Initial setup for mash steps editing.
Michiel Broek <mbroek@mbse.eu>
parents: 25
diff changeset
180 source: stepAdapter,
b7d44c98d609 Initial setup for mash steps editing.
Michiel Broek <mbroek@mbse.eu>
parents: 25
diff changeset
181 theme: theme,
40
b825c675987d Finished mash steps editing. Style sheets cleanup.
Michiel Broek <mbroek@mbse.eu>
parents: 39
diff changeset
182 selectionmode: 'singlerow',
38
b7d44c98d609 Initial setup for mash steps editing.
Michiel Broek <mbroek@mbse.eu>
parents: 25
diff changeset
183 showtoolbar: true,
b7d44c98d609 Initial setup for mash steps editing.
Michiel Broek <mbroek@mbse.eu>
parents: 25
diff changeset
184 rendertoolbar: function (toolbar) {
b7d44c98d609 Initial setup for mash steps editing.
Michiel Broek <mbroek@mbse.eu>
parents: 25
diff changeset
185 var container = $("<div style='margin: 5px;'></div>");
b7d44c98d609 Initial setup for mash steps editing.
Michiel Broek <mbroek@mbse.eu>
parents: 25
diff changeset
186 toolbar.append(container);
40
b825c675987d Finished mash steps editing. Style sheets cleanup.
Michiel Broek <mbroek@mbse.eu>
parents: 39
diff changeset
187 container.append('<input style="margin-left: 100px;" id="addrowbutton" type="button" value="Nieuwe stap" />');
215
83cee005d2d9 Fixed the utf-8 problems when storing json arrays on the server by using manual encoding. The json-encode function sucks for this project. Added step detail edit screen instead of on grid cell editing. This must go into the product and recipe editors too.
Michiel Broek <mbroek@mbse.eu>
parents: 213
diff changeset
188 container.append('<input style="margin-left: 450px;" id="deleterowbutton" type="button" value="Verwijder stap" />');
213
b0d484a5525e First step to make profile mash work with indexes and make the edit screen universal.
Michiel Broek <mbroek@mbse.eu>
parents: 120
diff changeset
189 $("#addrowbutton").jqxButton({ template: "primary", theme: theme, width: 150 });
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
190 $("#deleterowbutton").jqxButton({ template: "danger", theme: theme, width: 150 });
38
b7d44c98d609 Initial setup for mash steps editing.
Michiel Broek <mbroek@mbse.eu>
parents: 25
diff changeset
191 // create new row.
b7d44c98d609 Initial setup for mash steps editing.
Michiel Broek <mbroek@mbse.eu>
parents: 25
diff changeset
192 $("#addrowbutton").on('click', function () {
b7d44c98d609 Initial setup for mash steps editing.
Michiel Broek <mbroek@mbse.eu>
parents: 25
diff changeset
193 var datarow = generaterow();
482
ce814c787b79 Fixed not creating new records
Michiel Broek <mbroek@mbse.eu>
parents: 286
diff changeset
194 $("#grid").jqxGrid('addrow', null, datarow);
38
b7d44c98d609 Initial setup for mash steps editing.
Michiel Broek <mbroek@mbse.eu>
parents: 25
diff changeset
195 });
b7d44c98d609 Initial setup for mash steps editing.
Michiel Broek <mbroek@mbse.eu>
parents: 25
diff changeset
196 // delete row.
b7d44c98d609 Initial setup for mash steps editing.
Michiel Broek <mbroek@mbse.eu>
parents: 25
diff changeset
197 $("#deleterowbutton").on('click', function () {
b7d44c98d609 Initial setup for mash steps editing.
Michiel Broek <mbroek@mbse.eu>
parents: 25
diff changeset
198 var selectedrowindex = $("#grid").jqxGrid('getselectedrowindex');
b7d44c98d609 Initial setup for mash steps editing.
Michiel Broek <mbroek@mbse.eu>
parents: 25
diff changeset
199 var rowscount = $("#grid").jqxGrid('getdatainformation').rowscount;
b7d44c98d609 Initial setup for mash steps editing.
Michiel Broek <mbroek@mbse.eu>
parents: 25
diff changeset
200 if (selectedrowindex >= 0 && selectedrowindex < rowscount) {
b7d44c98d609 Initial setup for mash steps editing.
Michiel Broek <mbroek@mbse.eu>
parents: 25
diff changeset
201 var id = $("#grid").jqxGrid('getrowid', selectedrowindex);
482
ce814c787b79 Fixed not creating new records
Michiel Broek <mbroek@mbse.eu>
parents: 286
diff changeset
202 $("#grid").jqxGrid('deleterow', id);
38
b7d44c98d609 Initial setup for mash steps editing.
Michiel Broek <mbroek@mbse.eu>
parents: 25
diff changeset
203 }
b7d44c98d609 Initial setup for mash steps editing.
Michiel Broek <mbroek@mbse.eu>
parents: 25
diff changeset
204 });
b7d44c98d609 Initial setup for mash steps editing.
Michiel Broek <mbroek@mbse.eu>
parents: 25
diff changeset
205 },
b7d44c98d609 Initial setup for mash steps editing.
Michiel Broek <mbroek@mbse.eu>
parents: 25
diff changeset
206 columns: [
b7d44c98d609 Initial setup for mash steps editing.
Michiel Broek <mbroek@mbse.eu>
parents: 25
diff changeset
207 { text: 'Stap naam', datafield: 'step_name' },
215
83cee005d2d9 Fixed the utf-8 problems when storing json arrays on the server by using manual encoding. The json-encode function sucks for this project. Added step detail edit screen instead of on grid cell editing. This must go into the product and recipe editors too.
Michiel Broek <mbroek@mbse.eu>
parents: 213
diff changeset
208 { text: 'Stap type', datafield: 'step_type', width: 150,
83cee005d2d9 Fixed the utf-8 problems when storing json arrays on the server by using manual encoding. The json-encode function sucks for this project. Added step detail edit screen instead of on grid cell editing. This must go into the product and recipe editors too.
Michiel Broek <mbroek@mbse.eu>
parents: 213
diff changeset
209 cellsrenderer: function (index, datafield, value, defaultvalue, column, rowdata) {
83cee005d2d9 Fixed the utf-8 problems when storing json arrays on the server by using manual encoding. The json-encode function sucks for this project. Added step detail edit screen instead of on grid cell editing. This must go into the product and recipe editors too.
Michiel Broek <mbroek@mbse.eu>
parents: 213
diff changeset
210 return "<div style='margin: 4px;'>" + MashStepTypeData[value].nl + "</div>";
40
b825c675987d Finished mash steps editing. Style sheets cleanup.
Michiel Broek <mbroek@mbse.eu>
parents: 39
diff changeset
211 }
b825c675987d Finished mash steps editing. Style sheets cleanup.
Michiel Broek <mbroek@mbse.eu>
parents: 39
diff changeset
212 },
215
83cee005d2d9 Fixed the utf-8 problems when storing json arrays on the server by using manual encoding. The json-encode function sucks for this project. Added step detail edit screen instead of on grid cell editing. This must go into the product and recipe editors too.
Michiel Broek <mbroek@mbse.eu>
parents: 213
diff changeset
213 { text: 'Begin &deg;C', datafield: 'step_temp', width: 100, align: 'right', cellsalign: 'right', cellsformat: 'f1' },
83cee005d2d9 Fixed the utf-8 problems when storing json arrays on the server by using manual encoding. The json-encode function sucks for this project. Added step detail edit screen instead of on grid cell editing. This must go into the product and recipe editors too.
Michiel Broek <mbroek@mbse.eu>
parents: 213
diff changeset
214 { text: 'Eind &deg;C', datafield: 'end_temp', width: 100, 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
215 { text: 'Rust min.', datafield: 'step_time', width: 90, align: 'right', cellsalign: 'right' },
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
216 { text: 'Stap min.', datafield: 'ramp_time', width: 90, align: 'right', cellsalign: 'right' },
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
217 { text: '', datafield: 'Edit', columntype: 'button', width: 100, align: 'center', cellsrenderer: function () {
215
83cee005d2d9 Fixed the utf-8 problems when storing json arrays on the server by using manual encoding. The json-encode function sucks for this project. Added step detail edit screen instead of on grid cell editing. This must go into the product and recipe editors too.
Michiel Broek <mbroek@mbse.eu>
parents: 213
diff changeset
218 return "Wijzig";
83cee005d2d9 Fixed the utf-8 problems when storing json arrays on the server by using manual encoding. The json-encode function sucks for this project. Added step detail edit screen instead of on grid cell editing. This must go into the product and recipe editors too.
Michiel Broek <mbroek@mbse.eu>
parents: 213
diff changeset
219 }, buttonclick: function (row) {
83cee005d2d9 Fixed the utf-8 problems when storing json arrays on the server by using manual encoding. The json-encode function sucks for this project. Added step detail edit screen instead of on grid cell editing. This must go into the product and recipe editors too.
Michiel Broek <mbroek@mbse.eu>
parents: 213
diff changeset
220 steprow = row;
83cee005d2d9 Fixed the utf-8 problems when storing json arrays on the server by using manual encoding. The json-encode function sucks for this project. Added step detail edit screen instead of on grid cell editing. This must go into the product and recipe editors too.
Michiel Broek <mbroek@mbse.eu>
parents: 213
diff changeset
221 stepData = $("#grid").jqxGrid('getrowdata', steprow);
83cee005d2d9 Fixed the utf-8 problems when storing json arrays on the server by using manual encoding. The json-encode function sucks for this project. Added step detail edit screen instead of on grid cell editing. This must go into the product and recipe editors too.
Michiel Broek <mbroek@mbse.eu>
parents: 213
diff changeset
222 $("#m_step_name").val(stepData.step_name);
83cee005d2d9 Fixed the utf-8 problems when storing json arrays on the server by using manual encoding. The json-encode function sucks for this project. Added step detail edit screen instead of on grid cell editing. This must go into the product and recipe editors too.
Michiel Broek <mbroek@mbse.eu>
parents: 213
diff changeset
223 $("#m_step_type").val(stepData.step_type);
83cee005d2d9 Fixed the utf-8 problems when storing json arrays on the server by using manual encoding. The json-encode function sucks for this project. Added step detail edit screen instead of on grid cell editing. This must go into the product and recipe editors too.
Michiel Broek <mbroek@mbse.eu>
parents: 213
diff changeset
224 $("#m_step_temp").val(stepData.step_temp);
83cee005d2d9 Fixed the utf-8 problems when storing json arrays on the server by using manual encoding. The json-encode function sucks for this project. Added step detail edit screen instead of on grid cell editing. This must go into the product and recipe editors too.
Michiel Broek <mbroek@mbse.eu>
parents: 213
diff changeset
225 $("#m_end_temp").val(stepData.end_temp);
83cee005d2d9 Fixed the utf-8 problems when storing json arrays on the server by using manual encoding. The json-encode function sucks for this project. Added step detail edit screen instead of on grid cell editing. This must go into the product and recipe editors too.
Michiel Broek <mbroek@mbse.eu>
parents: 213
diff changeset
226 $("#m_step_time").val(stepData.step_time);
83cee005d2d9 Fixed the utf-8 problems when storing json arrays on the server by using manual encoding. The json-encode function sucks for this project. Added step detail edit screen instead of on grid cell editing. This must go into the product and recipe editors too.
Michiel Broek <mbroek@mbse.eu>
parents: 213
diff changeset
227 $("#m_ramp_time").val(stepData.ramp_time);
83cee005d2d9 Fixed the utf-8 problems when storing json arrays on the server by using manual encoding. The json-encode function sucks for this project. Added step detail edit screen instead of on grid cell editing. This must go into the product and recipe editors too.
Michiel Broek <mbroek@mbse.eu>
parents: 213
diff changeset
228 // show the popup window.
83cee005d2d9 Fixed the utf-8 problems when storing json arrays on the server by using manual encoding. The json-encode function sucks for this project. Added step detail edit screen instead of on grid cell editing. This must go into the product and recipe editors too.
Michiel Broek <mbroek@mbse.eu>
parents: 213
diff changeset
229 $("#popupStep").jqxWindow('open');
40
b825c675987d Finished mash steps editing. Style sheets cleanup.
Michiel Broek <mbroek@mbse.eu>
parents: 39
diff changeset
230 }
215
83cee005d2d9 Fixed the utf-8 problems when storing json arrays on the server by using manual encoding. The json-encode function sucks for this project. Added step detail edit screen instead of on grid cell editing. This must go into the product and recipe editors too.
Michiel Broek <mbroek@mbse.eu>
parents: 213
diff changeset
231 }
38
b7d44c98d609 Initial setup for mash steps editing.
Michiel Broek <mbroek@mbse.eu>
parents: 25
diff changeset
232 ]
b7d44c98d609 Initial setup for mash steps editing.
Michiel Broek <mbroek@mbse.eu>
parents: 25
diff changeset
233 });
b7d44c98d609 Initial setup for mash steps editing.
Michiel Broek <mbroek@mbse.eu>
parents: 25
diff changeset
234 };
b7d44c98d609 Initial setup for mash steps editing.
Michiel Broek <mbroek@mbse.eu>
parents: 25
diff changeset
235
23
4b157d7a1cee Added first part of mash profiles. Steps are in the database but not in the web ui.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
236 // initialize the input fields.
213
b0d484a5525e First step to make profile mash work with indexes and make the edit screen universal.
Michiel Broek <mbroek@mbse.eu>
parents: 120
diff changeset
237 $("#name").jqxInput({ theme: theme, width: 480, height: 23 });
120
b28a3d6143bc Screen layout changes.
Michiel Broek <mbroek@mbse.eu>
parents: 45
diff changeset
238 $("#notes").jqxInput({ theme: theme, width: 800, height: 100 });
23
4b157d7a1cee Added first part of mash profiles. Steps are in the database but not in the web ui.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
239 // initialize jqxGrid
4b157d7a1cee Added first part of mash profiles. Steps are in the database but not in the web ui.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
240 $("#jqxgrid").jqxGrid({
4b157d7a1cee Added first part of mash profiles. Steps are in the database but not in the web ui.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
241 width: 1280,
4b157d7a1cee Added first part of mash profiles. Steps are in the database but not in the web ui.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
242 height: 630,
4b157d7a1cee Added first part of mash profiles. Steps are in the database but not in the web ui.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
243 source: dataAdapter,
4b157d7a1cee Added first part of mash profiles. Steps are in the database but not in the web ui.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
244 theme: theme,
4b157d7a1cee Added first part of mash profiles. Steps are in the database but not in the web ui.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
245 showstatusbar: true,
4b157d7a1cee Added first part of mash profiles. Steps are in the database but not in the web ui.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
246 renderstatusbar: function (statusbar) {
4b157d7a1cee Added first part of mash profiles. Steps are in the database but not in the web ui.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
247 var container = $("<div style='overflow: hidden; position: relative; margin: 5px;'></div>");
4b157d7a1cee Added first part of mash profiles. Steps are in the database but not in the web ui.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
248 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;'>Add</span></div>");
4b157d7a1cee Added first part of mash profiles. Steps are in the database but not in the web ui.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
249 container.append(addButton);
4b157d7a1cee Added first part of mash profiles. Steps are in the database but not in the web ui.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
250 statusbar.append(container);
213
b0d484a5525e First step to make profile mash work with indexes and make the edit screen universal.
Michiel Broek <mbroek@mbse.eu>
parents: 120
diff changeset
251 addButton.jqxButton({ theme: theme, width: 90, height: 20 });
23
4b157d7a1cee Added first part of mash profiles. Steps are in the database but not in the web ui.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
252 // add new row.
4b157d7a1cee Added first part of mash profiles. Steps are in the database but not in the web ui.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
253 addButton.click(function (event) {
4b157d7a1cee Added first part of mash profiles. Steps are in the database but not in the web ui.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
254 editrow = -1;
213
b0d484a5525e First step to make profile mash work with indexes and make the edit screen universal.
Michiel Broek <mbroek@mbse.eu>
parents: 120
diff changeset
255 $("#name").val('Nieuw maisch schema');
23
4b157d7a1cee Added first part of mash profiles. Steps are in the database but not in the web ui.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
256 $("#notes").val('');
38
b7d44c98d609 Initial setup for mash steps editing.
Michiel Broek <mbroek@mbse.eu>
parents: 25
diff changeset
257 editsteps('');
23
4b157d7a1cee Added first part of mash profiles. Steps are in the database but not in the web ui.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
258 $("#popupWindow").jqxWindow('open');
4b157d7a1cee Added first part of mash profiles. Steps are in the database but not in the web ui.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
259 });
4b157d7a1cee Added first part of mash profiles. Steps are in the database but not in the web ui.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
260 },
4b157d7a1cee Added first part of mash profiles. Steps are in the database but not in the web ui.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
261 filterable: true,
4b157d7a1cee Added first part of mash profiles. Steps are in the database but not in the web ui.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
262 filtermode: 'excel',
4b157d7a1cee Added first part of mash profiles. Steps are in the database but not in the web ui.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
263 columns: [
4b157d7a1cee Added first part of mash profiles. Steps are in the database but not in the web ui.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
264 { text: 'Maish schema', datafield: 'name', width: 250 },
38
b7d44c98d609 Initial setup for mash steps editing.
Michiel Broek <mbroek@mbse.eu>
parents: 25
diff changeset
265 { text: 'Opmerkingen', datafield: 'notes' },
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
266 { text: '', datafield: 'Edit', width: 100, align: 'center', columntype: 'button', cellsrenderer: function () {
38
b7d44c98d609 Initial setup for mash steps editing.
Michiel Broek <mbroek@mbse.eu>
parents: 25
diff changeset
267 return "Wijzig";
23
4b157d7a1cee Added first part of mash profiles. Steps are in the database but not in the web ui.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
268 }, buttonclick: function (row) {
4b157d7a1cee Added first part of mash profiles. Steps are in the database but not in the web ui.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
269 editrow = row;
4b157d7a1cee Added first part of mash profiles. Steps are in the database but not in the web ui.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
270 // get the clicked row's data and initialize the input fields.
482
ce814c787b79 Fixed not creating new records
Michiel Broek <mbroek@mbse.eu>
parents: 286
diff changeset
271 dataRecord = $("#jqxgrid").jqxGrid('getrowdata', editrow);
23
4b157d7a1cee Added first part of mash profiles. Steps are in the database but not in the web ui.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
272 $("#name").val(dataRecord.name);
4b157d7a1cee Added first part of mash profiles. Steps are in the database but not in the web ui.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
273 $("#notes").val(dataRecord.notes);
38
b7d44c98d609 Initial setup for mash steps editing.
Michiel Broek <mbroek@mbse.eu>
parents: 25
diff changeset
274 editsteps(dataRecord);
23
4b157d7a1cee Added first part of mash profiles. Steps are in the database but not in the web ui.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
275 // show the popup window.
4b157d7a1cee Added first part of mash profiles. Steps are in the database but not in the web ui.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
276 $("#popupWindow").jqxWindow('open');
4b157d7a1cee Added first part of mash profiles. Steps are in the database but not in the web ui.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
277 }
4b157d7a1cee Added first part of mash profiles. Steps are in the database but not in the web ui.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
278 }
4b157d7a1cee Added first part of mash profiles. Steps are in the database but not in the web ui.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
279 ]
4b157d7a1cee Added first part of mash profiles. Steps are in the database but not in the web ui.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
280 });
4b157d7a1cee Added first part of mash profiles. Steps are in the database but not in the web ui.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
281 // initialize the popup window and buttons.
4b157d7a1cee Added first part of mash profiles. Steps are in the database but not in the web ui.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
282 $("#popupWindow").jqxWindow({
213
b0d484a5525e First step to make profile mash work with indexes and make the edit screen universal.
Michiel Broek <mbroek@mbse.eu>
parents: 120
diff changeset
283 width: 1050,
b0d484a5525e First step to make profile mash work with indexes and make the edit screen universal.
Michiel Broek <mbroek@mbse.eu>
parents: 120
diff changeset
284 height: 580,
215
83cee005d2d9 Fixed the utf-8 problems when storing json arrays on the server by using manual encoding. The json-encode function sucks for this project. Added step detail edit screen instead of on grid cell editing. This must go into the product and recipe editors too.
Michiel Broek <mbroek@mbse.eu>
parents: 213
diff changeset
285 position: { x: 110, y: 30 },
38
b7d44c98d609 Initial setup for mash steps editing.
Michiel Broek <mbroek@mbse.eu>
parents: 25
diff changeset
286 resizable: false,
b7d44c98d609 Initial setup for mash steps editing.
Michiel Broek <mbroek@mbse.eu>
parents: 25
diff changeset
287 theme: theme,
b7d44c98d609 Initial setup for mash steps editing.
Michiel Broek <mbroek@mbse.eu>
parents: 25
diff changeset
288 isModal: true,
b7d44c98d609 Initial setup for mash steps editing.
Michiel Broek <mbroek@mbse.eu>
parents: 25
diff changeset
289 autoOpen: false,
b7d44c98d609 Initial setup for mash steps editing.
Michiel Broek <mbroek@mbse.eu>
parents: 25
diff changeset
290 cancelButton: $("#Cancel"),
b7d44c98d609 Initial setup for mash steps editing.
Michiel Broek <mbroek@mbse.eu>
parents: 25
diff changeset
291 modalOpacity: 0.40
23
4b157d7a1cee Added first part of mash profiles. Steps are in the database but not in the web ui.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
292 });
4b157d7a1cee Added first part of mash profiles. Steps are in the database but not in the web ui.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
293 $("#popupWindow").on('open', function () {
4b157d7a1cee Added first part of mash profiles. Steps are in the database but not in the web ui.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
294 $("#name").jqxInput('selectAll');
4b157d7a1cee Added first part of mash profiles. Steps are in the database but not in the web ui.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
295 });
215
83cee005d2d9 Fixed the utf-8 problems when storing json arrays on the server by using manual encoding. The json-encode function sucks for this project. Added step detail edit screen instead of on grid cell editing. This must go into the product and recipe editors too.
Michiel Broek <mbroek@mbse.eu>
parents: 213
diff changeset
296 $("#popupStep").jqxWindow({
83cee005d2d9 Fixed the utf-8 problems when storing json arrays on the server by using manual encoding. The json-encode function sucks for this project. Added step detail edit screen instead of on grid cell editing. This must go into the product and recipe editors too.
Michiel Broek <mbroek@mbse.eu>
parents: 213
diff changeset
297 width: 800,
83cee005d2d9 Fixed the utf-8 problems when storing json arrays on the server by using manual encoding. The json-encode function sucks for this project. Added step detail edit screen instead of on grid cell editing. This must go into the product and recipe editors too.
Michiel Broek <mbroek@mbse.eu>
parents: 213
diff changeset
298 height: 300,
83cee005d2d9 Fixed the utf-8 problems when storing json arrays on the server by using manual encoding. The json-encode function sucks for this project. Added step detail edit screen instead of on grid cell editing. This must go into the product and recipe editors too.
Michiel Broek <mbroek@mbse.eu>
parents: 213
diff changeset
299 position: { x: 230, y: 100 },
83cee005d2d9 Fixed the utf-8 problems when storing json arrays on the server by using manual encoding. The json-encode function sucks for this project. Added step detail edit screen instead of on grid cell editing. This must go into the product and recipe editors too.
Michiel Broek <mbroek@mbse.eu>
parents: 213
diff changeset
300 resizable: false,
83cee005d2d9 Fixed the utf-8 problems when storing json arrays on the server by using manual encoding. The json-encode function sucks for this project. Added step detail edit screen instead of on grid cell editing. This must go into the product and recipe editors too.
Michiel Broek <mbroek@mbse.eu>
parents: 213
diff changeset
301 theme: theme,
83cee005d2d9 Fixed the utf-8 problems when storing json arrays on the server by using manual encoding. The json-encode function sucks for this project. Added step detail edit screen instead of on grid cell editing. This must go into the product and recipe editors too.
Michiel Broek <mbroek@mbse.eu>
parents: 213
diff changeset
302 isModal: true,
83cee005d2d9 Fixed the utf-8 problems when storing json arrays on the server by using manual encoding. The json-encode function sucks for this project. Added step detail edit screen instead of on grid cell editing. This must go into the product and recipe editors too.
Michiel Broek <mbroek@mbse.eu>
parents: 213
diff changeset
303 autoOpen: false,
83cee005d2d9 Fixed the utf-8 problems when storing json arrays on the server by using manual encoding. The json-encode function sucks for this project. Added step detail edit screen instead of on grid cell editing. This must go into the product and recipe editors too.
Michiel Broek <mbroek@mbse.eu>
parents: 213
diff changeset
304 cancelButton: $("#Ready"),
83cee005d2d9 Fixed the utf-8 problems when storing json arrays on the server by using manual encoding. The json-encode function sucks for this project. Added step detail edit screen instead of on grid cell editing. This must go into the product and recipe editors too.
Michiel Broek <mbroek@mbse.eu>
parents: 213
diff changeset
305 modalOpacity: 0.40
83cee005d2d9 Fixed the utf-8 problems when storing json arrays on the server by using manual encoding. The json-encode function sucks for this project. Added step detail edit screen instead of on grid cell editing. This must go into the product and recipe editors too.
Michiel Broek <mbroek@mbse.eu>
parents: 213
diff changeset
306 });
83cee005d2d9 Fixed the utf-8 problems when storing json arrays on the server by using manual encoding. The json-encode function sucks for this project. Added step detail edit screen instead of on grid cell editing. This must go into the product and recipe editors too.
Michiel Broek <mbroek@mbse.eu>
parents: 213
diff changeset
307
83cee005d2d9 Fixed the utf-8 problems when storing json arrays on the server by using manual encoding. The json-encode function sucks for this project. Added step detail edit screen instead of on grid cell editing. This must go into the product and recipe editors too.
Michiel Broek <mbroek@mbse.eu>
parents: 213
diff changeset
308 // step detail popup update values.
83cee005d2d9 Fixed the utf-8 problems when storing json arrays on the server by using manual encoding. The json-encode function sucks for this project. Added step detail edit screen instead of on grid cell editing. This must go into the product and recipe editors too.
Michiel Broek <mbroek@mbse.eu>
parents: 213
diff changeset
309 $("#Ready").jqxButton({ template: "success", width: '90px', theme: theme });
83cee005d2d9 Fixed the utf-8 problems when storing json arrays on the server by using manual encoding. The json-encode function sucks for this project. Added step detail edit screen instead of on grid cell editing. This must go into the product and recipe editors too.
Michiel Broek <mbroek@mbse.eu>
parents: 213
diff changeset
310 $("#Ready").click(function () {
83cee005d2d9 Fixed the utf-8 problems when storing json arrays on the server by using manual encoding. The json-encode function sucks for this project. Added step detail edit screen instead of on grid cell editing. This must go into the product and recipe editors too.
Michiel Broek <mbroek@mbse.eu>
parents: 213
diff changeset
311 $("#grid").jqxGrid('setcellvalue', steprow, 'step_name', $("#m_step_name").val());
83cee005d2d9 Fixed the utf-8 problems when storing json arrays on the server by using manual encoding. The json-encode function sucks for this project. Added step detail edit screen instead of on grid cell editing. This must go into the product and recipe editors too.
Michiel Broek <mbroek@mbse.eu>
parents: 213
diff changeset
312 $("#grid").jqxGrid('setcellvalue', steprow, 'step_type', $("#m_step_type").val());
83cee005d2d9 Fixed the utf-8 problems when storing json arrays on the server by using manual encoding. The json-encode function sucks for this project. Added step detail edit screen instead of on grid cell editing. This must go into the product and recipe editors too.
Michiel Broek <mbroek@mbse.eu>
parents: 213
diff changeset
313 $("#grid").jqxGrid('setcellvalue', steprow, 'step_temp', $("#m_step_temp").val());
83cee005d2d9 Fixed the utf-8 problems when storing json arrays on the server by using manual encoding. The json-encode function sucks for this project. Added step detail edit screen instead of on grid cell editing. This must go into the product and recipe editors too.
Michiel Broek <mbroek@mbse.eu>
parents: 213
diff changeset
314 $("#grid").jqxGrid('setcellvalue', steprow, 'end_temp', $("#m_end_temp").val());
83cee005d2d9 Fixed the utf-8 problems when storing json arrays on the server by using manual encoding. The json-encode function sucks for this project. Added step detail edit screen instead of on grid cell editing. This must go into the product and recipe editors too.
Michiel Broek <mbroek@mbse.eu>
parents: 213
diff changeset
315 $("#grid").jqxGrid('setcellvalue', steprow, 'step_time', $("#m_step_time").val());
83cee005d2d9 Fixed the utf-8 problems when storing json arrays on the server by using manual encoding. The json-encode function sucks for this project. Added step detail edit screen instead of on grid cell editing. This must go into the product and recipe editors too.
Michiel Broek <mbroek@mbse.eu>
parents: 213
diff changeset
316 $("#grid").jqxGrid('setcellvalue', steprow, 'ramp_time', $("#m_ramp_time").val());
83cee005d2d9 Fixed the utf-8 problems when storing json arrays on the server by using manual encoding. The json-encode function sucks for this project. Added step detail edit screen instead of on grid cell editing. This must go into the product and recipe editors too.
Michiel Broek <mbroek@mbse.eu>
parents: 213
diff changeset
317 $('#grid').jqxGrid('sortby', 'step_temp', 'asc');
83cee005d2d9 Fixed the utf-8 problems when storing json arrays on the server by using manual encoding. The json-encode function sucks for this project. Added step detail edit screen instead of on grid cell editing. This must go into the product and recipe editors too.
Michiel Broek <mbroek@mbse.eu>
parents: 213
diff changeset
318 });
83cee005d2d9 Fixed the utf-8 problems when storing json arrays on the server by using manual encoding. The json-encode function sucks for this project. Added step detail edit screen instead of on grid cell editing. This must go into the product and recipe editors too.
Michiel Broek <mbroek@mbse.eu>
parents: 213
diff changeset
319
83cee005d2d9 Fixed the utf-8 problems when storing json arrays on the server by using manual encoding. The json-encode function sucks for this project. Added step detail edit screen instead of on grid cell editing. This must go into the product and recipe editors too.
Michiel Broek <mbroek@mbse.eu>
parents: 213
diff changeset
320 // mash profile popup.
213
b0d484a5525e First step to make profile mash work with indexes and make the edit screen universal.
Michiel Broek <mbroek@mbse.eu>
parents: 120
diff changeset
321 $("#Delete").jqxButton({ template: "danger", width: '90px', theme: theme });
23
4b157d7a1cee Added first part of mash profiles. Steps are in the database but not in the web ui.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
322 $("#Delete").click(function () {
4b157d7a1cee Added first part of mash profiles. Steps are in the database but not in the web ui.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
323 if (editrow >= 0) {
4b157d7a1cee Added first part of mash profiles. Steps are in the database but not in the web ui.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
324 // Open a popup to confirm this action.
4b157d7a1cee Added first part of mash profiles. Steps are in the database but not in the web ui.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
325 $('#eventWindow').jqxWindow('open');
4b157d7a1cee Added first part of mash profiles. Steps are in the database but not in the web ui.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
326 $("#delOk").click(function () {
4b157d7a1cee Added first part of mash profiles. Steps are in the database but not in the web ui.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
327 var rowID = $('#jqxgrid').jqxGrid('getrowid', editrow);
4b157d7a1cee Added first part of mash profiles. Steps are in the database but not in the web ui.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
328 $("#jqxgrid").jqxGrid('deleterow', rowID);
4b157d7a1cee Added first part of mash profiles. Steps are in the database but not in the web ui.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
329 });
4b157d7a1cee Added first part of mash profiles. Steps are in the database but not in the web ui.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
330 }
4b157d7a1cee Added first part of mash profiles. Steps are in the database but not in the web ui.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
331 $("#popupWindow").jqxWindow('hide');
4b157d7a1cee Added first part of mash profiles. Steps are in the database but not in the web ui.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
332 });
213
b0d484a5525e First step to make profile mash work with indexes and make the edit screen universal.
Michiel Broek <mbroek@mbse.eu>
parents: 120
diff changeset
333 $("#Cancel").jqxButton({ template: "primary", width: '90px', theme: theme });
120
b28a3d6143bc Screen layout changes.
Michiel Broek <mbroek@mbse.eu>
parents: 45
diff changeset
334 $("#Save").jqxButton({ template: "success", width: '90px', theme: theme });
23
4b157d7a1cee Added first part of mash profiles. Steps are in the database but not in the web ui.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
335 $("#Save").click(function () {
40
b825c675987d Finished mash steps editing. Style sheets cleanup.
Michiel Broek <mbroek@mbse.eu>
parents: 39
diff changeset
336 var steprows = $('#grid').jqxGrid('getrows');
213
b0d484a5525e First step to make profile mash work with indexes and make the edit screen universal.
Michiel Broek <mbroek@mbse.eu>
parents: 120
diff changeset
337 var rowID = -1;
23
4b157d7a1cee Added first part of mash profiles. Steps are in the database but not in the web ui.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
338 if (editrow >= 0) {
213
b0d484a5525e First step to make profile mash work with indexes and make the edit screen universal.
Michiel Broek <mbroek@mbse.eu>
parents: 120
diff changeset
339 rowID = $('#jqxgrid').jqxGrid('getrowid', editrow);
b0d484a5525e First step to make profile mash work with indexes and make the edit screen universal.
Michiel Broek <mbroek@mbse.eu>
parents: 120
diff changeset
340 }
b0d484a5525e First step to make profile mash work with indexes and make the edit screen universal.
Michiel Broek <mbroek@mbse.eu>
parents: 120
diff changeset
341 var row = {
b0d484a5525e First step to make profile mash work with indexes and make the edit screen universal.
Michiel Broek <mbroek@mbse.eu>
parents: 120
diff changeset
342 record: rowID,
b0d484a5525e First step to make profile mash work with indexes and make the edit screen universal.
Michiel Broek <mbroek@mbse.eu>
parents: 120
diff changeset
343 name: $("#name").val(),
b0d484a5525e First step to make profile mash work with indexes and make the edit screen universal.
Michiel Broek <mbroek@mbse.eu>
parents: 120
diff changeset
344 notes: $("#notes").val(),
b0d484a5525e First step to make profile mash work with indexes and make the edit screen universal.
Michiel Broek <mbroek@mbse.eu>
parents: 120
diff changeset
345 steps: steprows
b0d484a5525e First step to make profile mash work with indexes and make the edit screen universal.
Michiel Broek <mbroek@mbse.eu>
parents: 120
diff changeset
346 };
b0d484a5525e First step to make profile mash work with indexes and make the edit screen universal.
Michiel Broek <mbroek@mbse.eu>
parents: 120
diff changeset
347 if (editrow >= 0) {
23
4b157d7a1cee Added first part of mash profiles. Steps are in the database but not in the web ui.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
348 $('#jqxgrid').jqxGrid('updaterow', rowID, row);
4b157d7a1cee Added first part of mash profiles. Steps are in the database but not in the web ui.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
349 } else {
213
b0d484a5525e First step to make profile mash work with indexes and make the edit screen universal.
Michiel Broek <mbroek@mbse.eu>
parents: 120
diff changeset
350 $('#jqxgrid').jqxGrid('addrow', null, row);
23
4b157d7a1cee Added first part of mash profiles. Steps are in the database but not in the web ui.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
351 }
213
b0d484a5525e First step to make profile mash work with indexes and make the edit screen universal.
Michiel Broek <mbroek@mbse.eu>
parents: 120
diff changeset
352 $("#popupWindow").jqxWindow('hide');
23
4b157d7a1cee Added first part of mash profiles. Steps are in the database but not in the web ui.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
353 });
4b157d7a1cee Added first part of mash profiles. Steps are in the database but not in the web ui.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
354 createDelElements();
4b157d7a1cee Added first part of mash profiles. Steps are in the database but not in the web ui.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
355 });
4b157d7a1cee Added first part of mash profiles. Steps are in the database but not in the web ui.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
356

mercurial