20 * Software Foundation, 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. |
20 * Software Foundation, 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. |
21 *****************************************************************************/ |
21 *****************************************************************************/ |
22 |
22 |
23 |
23 |
24 function createDelElements() { |
24 function createDelElements() { |
25 $('#eventWindow').jqxWindow({ |
25 $('#eventWindow').jqxWindow({ |
26 theme: theme, |
26 theme: theme, |
27 position: { x: 490, y: 210 }, |
27 position: { x: 490, y: 210 }, |
28 width: 300, |
28 width: 300, |
29 height: 175, |
29 height: 175, |
30 resizable: false, |
30 resizable: false, |
31 isModal: true, |
31 isModal: true, |
32 modalOpacity: 0.4, |
32 modalOpacity: 0.4, |
33 okButton: $('#delOk'), |
33 okButton: $('#delOk'), |
34 cancelButton: $('#delCancel'), |
34 cancelButton: $('#delCancel'), |
35 initContent: function () { |
35 initContent: function() { |
36 $('#delOk').jqxButton({ template: "danger", width: '65px', theme: theme }); |
36 $('#delOk').jqxButton({ template: 'danger', width: '65px', theme: theme }); |
37 $('#delCancel').jqxButton({ template: "success", width: '65px', theme: theme }); |
37 $('#delCancel').jqxButton({ template: 'success', width: '65px', theme: theme }); |
38 $('#delCancel').focus(); |
38 $('#delCancel').focus(); |
39 } |
39 } |
40 }); |
40 }); |
41 $('#eventWindow').jqxWindow('hide'); |
41 $('#eventWindow').jqxWindow('hide'); |
42 } |
42 } |
43 |
43 |
44 |
44 |
45 $(document).ready(function () { |
45 $(document).ready(function() { |
46 |
46 |
47 // tooltips |
47 // tooltips |
48 $("#name").jqxTooltip({ content: 'De naam voor dit maisch profiel.' }); |
48 $('#name').jqxTooltip({ content: 'De naam voor dit maisch profiel.' }); |
49 $("#notes").jqxTooltip({ content: 'De uitgebreide opmerkingen over dit maisch profiel.' }); |
49 $('#notes').jqxTooltip({ content: 'De uitgebreide opmerkingen over dit maisch profiel.' }); |
50 |
50 |
51 var steprow = 0, |
51 var steprow = 0, |
52 stepData = {}, |
52 stepData = {}, |
53 dataRecord = {}, |
53 dataRecord = {}, |
54 url = 'includes/db_profile_mash.php', |
54 url = 'includes/db_profile_mash.php', |
55 source = { |
55 source = { |
56 datatype: 'json', |
56 datatype: 'json', |
57 cache: false, |
57 cache: false, |
58 datafields: [ |
58 datafields: [ |
59 { name: 'record', type: 'number' }, |
59 { name: 'record', type: 'number' }, |
60 { name: 'name', type: 'string' }, |
60 { name: 'name', type: 'string' }, |
61 { name: 'notes', type: 'string' }, |
61 { name: 'notes', type: 'string' }, |
62 { name: 'steps', type: 'array' } |
62 { name: 'steps', type: 'array' } |
63 ], |
63 ], |
64 id: 'record', |
64 id: 'record', |
65 url: url, |
65 url: url, |
66 deleterow: function (rowid, commit) { |
66 deleterow: function(rowid, commit) { |
67 // synchronize with the server - send delete command |
67 var data = 'delete=true&' + $.param({ record: rowid }); |
68 var data = "delete=true&" + $.param({ record: rowid }); |
68 $.ajax({ |
69 $.ajax({ |
69 dataType: 'json', |
70 dataType: 'json', |
70 url: url, |
71 url: url, |
71 cache: false, |
72 cache: false, |
72 data: data, |
73 data: data, |
73 type: 'POST', |
74 type: 'POST', |
74 success: function(data, status, xhr) { |
75 success: function (data, status, xhr) { |
75 commit(true); |
76 commit(true); |
76 console.log('mash deleterow ' + rowid + ' success'); |
77 console.log('mash deleterow ' + rowid + ' success'); |
77 location.reload(true); |
78 location.reload( true ); |
78 }, |
79 }, |
79 error: function(jqXHR, textStatus, errorThrown) { |
80 error: function (jqXHR, textStatus, errorThrown) { |
80 commit(false); |
81 commit(false); |
81 console.log('mash deleterow ' + textStatus); |
82 console.log('mash deleterow ' + textStatus); |
82 } |
83 } |
83 }); |
84 }); |
84 }, |
85 }, |
85 addrow: function(rowid, rowdata, position, commit) { |
86 addrow: function (rowid, rowdata, position, commit) { |
86 var data = 'insert=true&' + $.param(rowdata); |
87 var data = "insert=true&" + $.param(rowdata); |
87 $.ajax({ |
88 $.ajax({ |
88 dataType: 'json', |
89 dataType: 'json', |
89 url: url, |
90 url: url, |
90 cache: false, |
91 cache: false, |
91 data: data, |
92 data: data, |
92 type: 'POST', |
93 type: "POST", |
93 success: function(data, status, xhr) { |
94 success: function (data, status, xhr) { |
94 commit(true); |
95 commit(true); |
95 console.log('mash addrow ' + rowid + ' success'); |
96 console.log('mash addrow ' + rowid + ' success'); |
96 location.reload(true); |
97 location.reload( true ); |
97 }, |
98 }, |
98 error: function(jqXHR, textStatus, errorThrown) { |
99 error: function(jqXHR, textStatus, errorThrown) { |
99 commit(false); |
100 commit(false); |
100 console.log('mash addrow ' + textStatus); |
101 console.log('mash addrow ' + textStatus); |
101 } |
102 } |
102 }); |
103 }); |
103 }, |
104 }, |
104 updaterow: function(rowid, rowdata, commit) { |
105 updaterow: function (rowid, rowdata, commit) { |
105 var data = 'update=true&' + $.param(rowdata); |
106 var data = "update=true&" + $.param(rowdata); |
106 $.ajax({ |
107 $.ajax({ |
107 dataType: 'json', |
108 dataType: 'json', |
108 url: url, |
109 url: url, |
109 cache: false, |
110 cache: false, |
110 data: data, |
111 data: data, |
111 type: 'POST', |
112 type: "POST", |
112 success: function(data, status, xhr) { |
113 success: function (data, status, xhr) { |
113 commit(true); |
114 commit(true); |
114 console.log('mash updaterow ' + rowid + ' success'); |
115 console.log('mash updaterow ' + rowid + ' success'); |
115 location.reload(true); |
116 location.reload( true ); |
116 }, |
117 }, |
117 error: function(jqXHR, textStatus, errorThrown) { |
118 error: function(jqXHR, textStatus, errorThrown) { |
118 commit(false); |
119 commit(false); |
119 console.log('mash updaterow ' + textStatus); |
120 console.log('mash updaterow ' + textStatus); |
120 } |
121 } |
121 }); |
122 }); |
122 } |
123 } |
123 }, |
124 }, |
124 dataAdapter = new $.jqx.dataAdapter(source), |
125 dataAdapter = new $.jqx.dataAdapter(source), |
125 editrow = -1, |
126 editrow = -1, |
126 |
127 |
127 // Inline steps editor |
128 // Inline steps editor |
128 editsteps = function(data) { |
129 editsteps = function (data) { |
129 var generaterow = function() { |
130 var generaterow = function () { |
130 var row = {}; |
131 var row = {}; |
131 row['step_name'] = 'Stap 1'; |
132 row['step_name'] = "Stap 1"; |
132 row['step_type'] = 0; |
133 row['step_type'] = 0; |
133 row['step_temp'] = 62.0; |
134 row['step_temp'] = 62.0; |
134 row['step_time'] = 20.0; |
135 row['step_time'] = 20.0; |
135 row['ramp_time'] = 1.0; |
136 row['ramp_time'] = 1.0; |
136 row['end_temp'] = 62.0; |
137 row['end_temp'] = 62.0; |
137 return row; |
138 return row; |
138 }; |
139 }, |
139 var stepSource = { |
140 stepSource = { |
140 localdata: data.steps, |
141 localdata: data.steps, |
141 datatype: 'local', |
142 datatype: "local", |
142 datafields: [ |
143 datafields: [ |
143 { name: 'step_name', type: 'string' }, |
144 { name: 'step_name', type: 'string' }, |
144 { name: 'step_type', type: 'int' }, |
145 { name: 'step_type', type: 'int' }, |
145 { name: 'step_temp', type: 'float' }, |
146 { name: 'step_temp', type: 'float' }, |
146 { name: 'step_time', type: 'float' }, |
147 { name: 'step_time', type: 'float' }, |
147 { name: 'ramp_time', type: 'float' }, |
148 { name: 'ramp_time', type: 'float' }, |
148 { name: 'end_temp', type: 'float' } |
149 { name: 'end_temp', type: 'float' } |
149 ], |
150 ], |
150 addrow: function(rowid, rowdata, position, commit) { |
151 addrow: function (rowid, rowdata, position, commit) { |
151 commit(true); |
152 commit(true); |
152 }, |
153 }, |
153 deleterow: function(rowid, commit) { |
154 deleterow: function (rowid, commit) { |
154 commit(true); |
155 commit(true); |
155 } |
156 } |
156 }, |
157 }, |
157 stepAdapter = new $.jqx.dataAdapter(stepSource); |
158 stepAdapter = new $.jqx.dataAdapter(stepSource); |
158 |
159 |
159 $('#grid').jqxGrid({ |
160 $("#grid").jqxGrid({ |
160 width: 1020, |
161 width: 1020, |
161 height: 330, |
162 height: 330, |
162 source: stepAdapter, |
163 source: stepAdapter, |
163 theme: theme, |
164 theme: theme, |
164 selectionmode: 'singlerow', |
165 selectionmode: 'singlerow', |
165 showtoolbar: true, |
166 showtoolbar: true, |
166 rendertoolbar: function(toolbar) { |
167 rendertoolbar: function (toolbar) { |
167 var container = $('<div style="margin: 5px;"></div>'); |
168 var container = $("<div style='margin: 5px;'></div>"); |
168 toolbar.append(container); |
169 toolbar.append(container); |
169 container.append('<input style="margin-left: 100px;" id="addrowbutton" type="button" value="Nieuwe stap" />'); |
170 container.append('<input style="margin-left: 100px;" id="addrowbutton" type="button" value="Nieuwe stap" />'); |
170 container.append('<input style="margin-left: 450px;" id="deleterowbutton" type="button" value="Verwijder stap" />'); |
171 container.append('<input style="margin-left: 450px;" id="deleterowbutton" type="button" value="Verwijder stap" />'); |
171 $('#addrowbutton').jqxButton({ template: 'primary', theme: theme, width: 150 }); |
172 $("#addrowbutton").jqxButton({ template: "primary", theme: theme, width: 150 }); |
172 $('#deleterowbutton').jqxButton({ template: 'danger', theme: theme, width: 150 }); |
173 $("#deleterowbutton").jqxButton({ template: "danger", theme: theme, width: 150 }); |
173 // create new row. |
174 // create new row. |
174 $('#addrowbutton').on('click', function() { |
175 $("#addrowbutton").on('click', function () { |
175 var datarow = generaterow(); |
176 var datarow = generaterow(); |
176 $('#grid').jqxGrid('addrow', null, datarow); |
177 $("#grid").jqxGrid('addrow', null, datarow); |
177 }); |
178 }); |
178 // delete row. |
179 // delete row. |
179 $('#deleterowbutton').on('click', function() { |
180 $("#deleterowbutton").on('click', function () { |
180 var rowscount, id, selectedrowindex = $('#grid').jqxGrid('getselectedrowindex'); |
181 var rowscount, id, selectedrowindex = $("#grid").jqxGrid('getselectedrowindex'); |
181 rowscount = $('#grid').jqxGrid('getdatainformation').rowscount; |
182 rowscount = $("#grid").jqxGrid('getdatainformation').rowscount; |
182 if (selectedrowindex >= 0 && selectedrowindex < rowscount) { |
183 if (selectedrowindex >= 0 && selectedrowindex < rowscount) { |
183 id = $('#grid').jqxGrid('getrowid', selectedrowindex); |
184 id = $("#grid").jqxGrid('getrowid', selectedrowindex); |
184 $('#grid').jqxGrid('deleterow', id); |
185 $("#grid").jqxGrid('deleterow', id); |
185 } |
186 } |
186 }); |
187 }); |
187 }, |
188 }, |
188 columns: [ |
189 columns: [ |
189 { text: 'Stap naam', datafield: 'step_name' }, |
190 { text: 'Stap naam', datafield: 'step_name' }, |
190 { text: 'Stap type', datafield: 'step_type', width: 150, |
191 { text: 'Stap type', datafield: 'step_type', width: 150, |
191 cellsrenderer: function(index, datafield, value, defaultvalue, column, rowdata) { |
192 cellsrenderer: function (index, datafield, value, defaultvalue, column, rowdata) { |
192 return '<div style="margin: 4px;">' + MashStepTypeData[value].nl + '</div>'; |
193 return "<div style='margin: 4px;'>" + MashStepTypeData[value].nl + "</div>"; |
193 } |
194 } |
194 }, |
195 }, |
195 { text: 'Begin °C', datafield: 'step_temp', width: 100, align: 'right', cellsalign: 'right', cellsformat: 'f1' }, |
196 { text: 'Begin °C', datafield: 'step_temp', width: 100, align: 'right', cellsalign: 'right', cellsformat: 'f1' }, |
196 { text: 'Eind °C', datafield: 'end_temp', width: 100, align: 'right', cellsalign: 'right', cellsformat: 'f1' }, |
197 { text: 'Eind °C', datafield: 'end_temp', width: 100, align: 'right', cellsalign: 'right', cellsformat: 'f1' }, |
197 { text: 'Rust min.', datafield: 'step_time', width: 90, align: 'right', cellsalign: 'right' }, |
198 { text: 'Rust min.', datafield: 'step_time', width: 90, align: 'right', cellsalign: 'right' }, |
198 { text: 'Stap min.', datafield: 'ramp_time', width: 90, align: 'right', cellsalign: 'right' }, |
199 { text: 'Stap min.', datafield: 'ramp_time', width: 90, align: 'right', cellsalign: 'right' }, |
199 { text: '', datafield: 'Edit', columntype: 'button', width: 100, align: 'center', |
200 { text: '', datafield: 'Edit', columntype: 'button', width: 100, align: 'center', |
200 cellsrenderer: function() { |
201 cellsrenderer: function () { |
201 return 'Wijzig'; |
202 return "Wijzig"; |
202 }, buttonclick: function(row) { |
203 }, buttonclick: function (row) { |
203 steprow = row; |
204 steprow = row; |
204 stepData = $('#grid').jqxGrid('getrowdata', steprow); |
205 stepData = $("#grid").jqxGrid('getrowdata', steprow); |
205 $('#m_step_name').val(stepData.step_name); |
206 $("#m_step_name").val(stepData.step_name); |
206 $('#m_step_type').val(stepData.step_type); |
207 $("#m_step_type").val(stepData.step_type); |
207 $('#m_step_temp').val(stepData.step_temp); |
208 $("#m_step_temp").val(stepData.step_temp); |
208 $('#m_end_temp').val(stepData.end_temp); |
209 $("#m_end_temp").val(stepData.end_temp); |
209 $('#m_step_time').val(stepData.step_time); |
210 $("#m_step_time").val(stepData.step_time); |
210 $('#m_ramp_time').val(stepData.ramp_time); |
211 $("#m_ramp_time").val(stepData.ramp_time); |
211 // show the popup window. |
212 // show the popup window. |
212 $('#popupStep').jqxWindow('open'); |
213 $("#popupStep").jqxWindow('open'); |
213 } |
214 } |
214 } |
215 } |
215 ] |
216 ] |
216 }); |
217 }); |
217 }; |
218 }; |
218 |
219 |
219 // Initialize the input fields. |
220 // Initialize the input fields. |
220 $('#m_step_name').jqxInput({ theme: theme, width: 320, height: 23 }); |
221 $("#m_step_name").jqxInput({ theme: theme, width: 320, height: 23 }); |
221 $('#m_step_type').jqxDropDownList({ |
222 $("#m_step_type").jqxDropDownList({ |
222 theme: theme, |
223 theme: theme, |
223 source: MashStepTypeAdapter, |
224 source: MashStepTypeAdapter, |
224 valueMember: 'id', |
225 valueMember: 'id', |
225 displayMember: 'nl', |
226 displayMember: 'nl', |
226 width: 180, |
227 width: 180, |
227 height: 23, |
228 height: 23, |
228 autoDropDownHeight: true |
229 autoDropDownHeight: true |
229 }); |
230 }); |
230 $('#m_step_temp').jqxNumberInput(Spin1dec); |
231 $("#m_step_temp").jqxNumberInput( Spin1dec ); |
231 $('#m_step_temp').jqxNumberInput({ Min: 30, Max: 80 }); |
232 $("#m_step_temp").jqxNumberInput({ Min: 30, Max: 80 }); |
232 $('#m_end_temp').jqxNumberInput(Spin1dec); |
233 $("#m_end_temp").jqxNumberInput( Spin1dec ); |
233 $('#m_end_temp').jqxNumberInput({ Min: 30, Max: 80 }); |
234 $("#m_end_temp").jqxNumberInput({ Min: 30, Max: 80 }); |
234 $('#m_step_time').jqxNumberInput(PosInt); |
235 $("#m_step_time").jqxNumberInput( PosInt ); |
235 $('#m_step_time').jqxNumberInput({ Min: 1, Max: 120 }); |
236 $("#m_step_time").jqxNumberInput({ Min: 1, Max: 120 }); |
236 $('#m_ramp_time').jqxNumberInput(PosInt); |
237 $("#m_ramp_time").jqxNumberInput( PosInt ); |
237 $('#m_ramp_time').jqxNumberInput({ Min: 1, Max: 30 }); |
238 $("#m_ramp_time").jqxNumberInput({ Min: 1, Max: 30 }); |
238 |
239 |
239 // initialize the input fields. |
240 // initialize the input fields. |
240 $('#name').jqxInput({ theme: theme, width: 480, height: 23 }); |
241 $("#name").jqxInput({ theme: theme, width: 480, height: 23 }); |
241 $('#notes').jqxInput({ theme: theme, width: 800, height: 100 }); |
242 $("#notes").jqxInput({ theme: theme, width: 800, height: 100 }); |
242 // initialize jqxGrid |
243 // initialize jqxGrid |
243 $('#jqxgrid').jqxGrid({ |
244 $("#jqxgrid").jqxGrid({ |
244 width: 1280, |
245 width: 1280, |
245 height: 630, |
246 height: 630, |
246 source: dataAdapter, |
247 source: dataAdapter, |
247 theme: theme, |
248 theme: theme, |
248 showstatusbar: true, |
249 showstatusbar: true, |
249 renderstatusbar: function(statusbar) { |
250 renderstatusbar: function (statusbar) { |
250 var addButton, container = $('<div style="overflow: hidden; position: relative; margin: 5px;"></div>'); |
251 var addButton, container = $("<div style='overflow: hidden; position: relative; margin: 5px;'></div>"); |
251 addButton = $('<div style="float: right; margin-right: 15px;"><img style="position: relative; margin-top: 2px;" ' + |
252 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>"); |
252 'src="images/add.png"/><span style="margin-left: 4px; position: relative; top: -3px;">Add</span></div>'); |
253 container.append(addButton); |
253 container.append(addButton); |
254 statusbar.append(container); |
254 statusbar.append(container); |
255 addButton.jqxButton({ theme: theme, width: 90, height: 20 }); |
255 addButton.jqxButton({ theme: theme, width: 90, height: 20 }); |
256 // add new row. |
256 // add new row. |
257 addButton.click(function (event) { |
257 addButton.click(function(event) { |
258 editrow = -1; |
258 editrow = -1; |
259 $("#name").val('Nieuw maisch schema'); |
259 $('#name').val('Nieuw maisch schema'); |
260 $("#notes").val(''); |
260 $('#notes').val(''); |
261 editsteps(''); |
261 editsteps(''); |
262 $("#popupWindow").jqxWindow('open'); |
262 $('#popupWindow').jqxWindow('open'); |
263 }); |
263 }); |
264 }, |
264 }, |
265 filterable: true, |
265 filterable: true, |
266 filtermode: 'excel', |
266 filtermode: 'excel', |
267 columns: [ |
267 columns: [ |
268 { text: 'Maish schema', datafield: 'name', width: 250 }, |
268 { text: 'Maish schema', datafield: 'name', width: 250 }, |
269 { text: 'Opmerkingen', datafield: 'notes' }, |
269 { text: 'Opmerkingen', datafield: 'notes' }, |
270 { text: '', datafield: 'Edit', width: 100, align: 'center', columntype: 'button', |
270 { text: '', datafield: 'Edit', width: 100, align: 'center', columntype: 'button', |
271 cellsrenderer: function () { |
271 cellsrenderer: function() { |
272 return "Wijzig"; |
272 return 'Wijzig'; |
273 }, buttonclick: function (row) { |
273 }, buttonclick: function(row) { |
274 editrow = row; |
274 editrow = row; |
275 // get the clicked row's data and initialize the input fields. |
275 // get the clicked row's data and initialize the input fields. |
276 dataRecord = $("#jqxgrid").jqxGrid('getrowdata', editrow); |
276 dataRecord = $('#jqxgrid').jqxGrid('getrowdata', editrow); |
277 $("#name").val(dataRecord.name); |
277 $('#name').val(dataRecord.name); |
278 $("#notes").val(dataRecord.notes); |
278 $('#notes').val(dataRecord.notes); |
279 editsteps(dataRecord); |
279 editsteps(dataRecord); |
280 // show the popup window. |
280 // show the popup window. |
281 $("#popupWindow").jqxWindow('open'); |
281 $('#popupWindow').jqxWindow('open'); |
282 } |
282 } |
283 } |
283 } |
284 ] |
284 ] |
285 }); |
285 }); |
286 // initialize the popup window and buttons. |
286 // initialize the popup window and buttons. |
287 $("#popupWindow").jqxWindow({ |
287 $('#popupWindow').jqxWindow({ |
288 width: 1050, |
288 width: 1050, |
289 height: 580, |
289 height: 580, |
290 position: { x: 110, y: 30 }, |
290 position: { x: 110, y: 30 }, |
291 resizable: false, |
291 resizable: false, |
292 theme: theme, |
292 theme: theme, |
293 isModal: true, |
293 isModal: true, |
294 autoOpen: false, |
294 autoOpen: false, |
295 cancelButton: $("#Cancel"), |
295 cancelButton: $('#Cancel'), |
296 modalOpacity: 0.40 |
296 modalOpacity: 0.40 |
297 }); |
297 }); |
298 $("#popupWindow").on('open', function () { |
298 $('#popupWindow').on('open', function() { |
299 $("#name").jqxInput('selectAll'); |
299 $('#name').jqxInput('selectAll'); |
300 }); |
300 }); |
301 $("#popupStep").jqxWindow({ |
301 $('#popupStep').jqxWindow({ |
302 width: 800, |
302 width: 800, |
303 height: 300, |
303 height: 300, |
304 position: { x: 230, y: 100 }, |
304 position: { x: 230, y: 100 }, |
305 resizable: false, |
305 resizable: false, |
306 theme: theme, |
306 theme: theme, |
307 isModal: true, |
307 isModal: true, |
308 autoOpen: false, |
308 autoOpen: false, |
309 cancelButton: $("#Ready"), |
309 cancelButton: $('#Ready'), |
310 modalOpacity: 0.40 |
310 modalOpacity: 0.40 |
311 }); |
311 }); |
312 |
312 |
313 // step detail popup update values. |
313 // step detail popup update values. |
314 $("#Ready").jqxButton({ template: "success", width: '90px', theme: theme }); |
314 $('#Ready').jqxButton({ template: 'success', width: '90px', theme: theme }); |
315 $("#Ready").click(function () { |
315 $('#Ready').click(function() { |
316 $("#grid").jqxGrid('setcellvalue', steprow, 'step_name', $("#m_step_name").val()); |
316 $('#grid').jqxGrid('setcellvalue', steprow, 'step_name', $('#m_step_name').val()); |
317 $("#grid").jqxGrid('setcellvalue', steprow, 'step_type', $("#m_step_type").val()); |
317 $('#grid').jqxGrid('setcellvalue', steprow, 'step_type', $('#m_step_type').val()); |
318 $("#grid").jqxGrid('setcellvalue', steprow, 'step_temp', $("#m_step_temp").val()); |
318 $('#grid').jqxGrid('setcellvalue', steprow, 'step_temp', $('#m_step_temp').val()); |
319 $("#grid").jqxGrid('setcellvalue', steprow, 'end_temp', $("#m_end_temp").val()); |
319 $('#grid').jqxGrid('setcellvalue', steprow, 'end_temp', $('#m_end_temp').val()); |
320 $("#grid").jqxGrid('setcellvalue', steprow, 'step_time', $("#m_step_time").val()); |
320 $('#grid').jqxGrid('setcellvalue', steprow, 'step_time', $('#m_step_time').val()); |
321 $("#grid").jqxGrid('setcellvalue', steprow, 'ramp_time', $("#m_ramp_time").val()); |
321 $('#grid').jqxGrid('setcellvalue', steprow, 'ramp_time', $('#m_ramp_time').val()); |
322 $('#grid').jqxGrid('sortby', 'step_temp', 'asc'); |
322 $('#grid').jqxGrid('sortby', 'step_temp', 'asc'); |
323 }); |
323 }); |
324 |
324 |
325 // mash profile popup. |
325 // mash profile popup. |
326 $("#Delete").jqxButton({ template: "danger", width: '90px', theme: theme }); |
326 $('#Delete').jqxButton({ template: 'danger', width: '90px', theme: theme }); |
327 $("#Delete").click(function () { |
327 $('#Delete').click(function() { |
328 if (editrow >= 0) { |
328 if (editrow >= 0) { |
329 // Open a popup to confirm this action. |
329 // Open a popup to confirm this action. |
330 $('#eventWindow').jqxWindow('open'); |
330 $('#eventWindow').jqxWindow('open'); |
331 $("#delOk").click(function () { |
331 $('#delOk').click(function() { |
332 var rowID = $('#jqxgrid').jqxGrid('getrowid', editrow); |
332 var rowID = $('#jqxgrid').jqxGrid('getrowid', editrow); |
333 $("#jqxgrid").jqxGrid('deleterow', rowID); |
333 $('#jqxgrid').jqxGrid('deleterow', rowID); |
334 }); |
334 }); |
335 } |
335 } |
336 $("#popupWindow").jqxWindow('hide'); |
336 $('#popupWindow').jqxWindow('hide'); |
337 }); |
337 }); |
338 $("#Cancel").jqxButton({ template: "primary", width: '90px', theme: theme }); |
338 $('#Cancel').jqxButton({ template: 'primary', width: '90px', theme: theme }); |
339 $("#Save").jqxButton({ template: "success", width: '90px', theme: theme }); |
339 $('#Save').jqxButton({ template: 'success', width: '90px', theme: theme }); |
340 $("#Save").click(function () { |
340 $('#Save').click(function() { |
341 var steprows = $('#grid').jqxGrid('getrows'), |
341 var steprows = $('#grid').jqxGrid('getrows'), |
342 rowID = -1, |
342 rowID = -1, |
343 row; |
343 row; |
344 if (editrow >= 0) { |
344 if (editrow >= 0) { |
345 rowID = $('#jqxgrid').jqxGrid('getrowid', editrow); |
345 rowID = $('#jqxgrid').jqxGrid('getrowid', editrow); |
346 } |
346 } |
347 row = { |
347 row = { |
348 record: rowID, |
348 record: rowID, |
349 name: $("#name").val(), |
349 name: $('#name').val(), |
350 notes: $("#notes").val(), |
350 notes: $('#notes').val(), |
351 steps: steprows |
351 steps: steprows |
352 }; |
352 }; |
353 if (editrow >= 0) { |
353 if (editrow >= 0) { |
354 $('#jqxgrid').jqxGrid('updaterow', rowID, row); |
354 $('#jqxgrid').jqxGrid('updaterow', rowID, row); |
355 } else { |
355 } else { |
356 $('#jqxgrid').jqxGrid('addrow', null, row); |
356 $('#jqxgrid').jqxGrid('addrow', null, row); |
357 } |
357 } |
358 $("#popupWindow").jqxWindow('hide'); |
358 $('#popupWindow').jqxWindow('hide'); |
359 }); |
359 }); |
360 createDelElements(); |
360 createDelElements(); |
361 }); |
361 }); |
362 |
362 |