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({ width: '65px', theme: theme }); |
36 $('#delOk').jqxButton({ template: "danger", width: '65px', theme: theme }); |
37 $('#delCancel').jqxButton({ 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 } |
153 rendertoolbar: function (toolbar) { |
153 rendertoolbar: function (toolbar) { |
154 var me = this; |
154 var me = this; |
155 var container = $("<div style='margin: 5px;'></div>"); |
155 var container = $("<div style='margin: 5px;'></div>"); |
156 toolbar.append(container); |
156 toolbar.append(container); |
157 container.append('<input style="margin-left: 100px;" id="addrowbutton" type="button" value="Nieuwe stap" />'); |
157 container.append('<input style="margin-left: 100px;" id="addrowbutton" type="button" value="Nieuwe stap" />'); |
158 container.append('<input style="margin-left: 140px;" id="deleterowbutton" type="button" value="Verwijder stap" />'); |
158 container.append('<input style="margin-left: 290px;" id="deleterowbutton" type="button" value="Verwijder stap" />'); |
159 $("#addrowbutton").jqxButton({ theme: theme, width: 150 }); |
159 $("#addrowbutton").jqxButton({ theme: theme, width: 150 }); |
160 $("#deleterowbutton").jqxButton({ theme: theme, width: 150 }); |
160 $("#deleterowbutton").jqxButton({ theme: theme, width: 150 }); |
161 // create new row. |
161 // create new row. |
162 $("#addrowbutton").on('click', function () { |
162 $("#addrowbutton").on('click', function () { |
163 var datarow = generaterow(); |
163 var datarow = generaterow(); |
173 } |
173 } |
174 }); |
174 }); |
175 }, |
175 }, |
176 columns: [ |
176 columns: [ |
177 { text: 'Stap naam', datafield: 'step_name' }, |
177 { text: 'Stap naam', datafield: 'step_name' }, |
178 { text: 'Stap type', datafield: 'step_type', width: 100, columntype: 'dropdownlist', |
178 { text: 'Stap type', datafield: 'step_type', width: 120, columntype: 'dropdownlist', |
179 createeditor: function (row, cellvalue, editor, celltext, cellwidth, cellheight) { |
179 createeditor: function (row, cellvalue, editor, celltext, cellwidth, cellheight) { |
180 var dataSource = [ "Infusion", "Temperature", "Decoction" ]; |
180 var dataSource = [ "Infusion", "Temperature", "Decoction" ]; |
181 editor.jqxDropDownList({ source: dataSource, dropDownHeight: 95 }); |
181 editor.jqxDropDownList({ |
182 } |
182 source: dataSource, |
183 }, |
183 dropDownHeight: 95, |
184 { text: 'Temperatuur', datafield: 'step_temp', width: 80, align: 'right', cellsalign: 'right', cellsformat: 'f1', |
184 dropDownWidth: 120 |
|
185 }); |
|
186 } |
|
187 }, |
|
188 { text: 'Temperatuur', datafield: 'step_temp', width: 100, align: 'right', cellsalign: 'right', cellsformat: 'f1', |
185 validation: function (cell, value) { |
189 validation: function (cell, value) { |
186 if (value < 35 || value > 80) { |
190 if (value < 35 || value > 80) { |
187 return { result: false, message: "De temperatuur moet tussen 35 en 80 zijn." }; |
191 return { result: false, message: "De temperatuur moet tussen 35 en 80 zijn." }; |
188 } |
192 } |
189 return true; |
193 return true; |
190 } |
194 } |
191 }, |
195 }, |
192 { text: 'Eind', datafield: 'end_temp', width: 80, align: 'right', cellsalign: 'right', cellsformat: 'f1', |
196 { text: 'Eind temp', datafield: 'end_temp', width: 100, align: 'right', cellsalign: 'right', cellsformat: 'f1', |
193 validation: function (cell, value) { |
197 validation: function (cell, value) { |
194 if (value < 35 || value > 80) { |
198 if (value < 35 || value > 80) { |
195 return { result: false, message: "De temperatuur moet tussen 35 en 80 zijn." }; |
199 return { result: false, message: "De temperatuur moet tussen 35 en 80 zijn." }; |
196 } |
200 } |
197 return true; |
201 return true; |
198 } |
202 } |
199 }, |
203 }, |
200 { text: 'Tijd', datafield: 'step_time', width: 70, align: 'right', cellsalign: 'right', |
204 { text: 'Rusttijd', datafield: 'step_time', width: 80, align: 'right', cellsalign: 'right', |
201 validation: function (cell, value) { |
205 validation: function (cell, value) { |
202 if (value < 1 || value > 360) { |
206 if (value < 1 || value > 360) { |
203 return { result: false, message: "De tijd moet tussen 1 en 360 zijn." }; |
207 return { result: false, message: "De tijd moet tussen 1 en 360 zijn." }; |
204 } |
208 } |
205 return true; |
209 return true; |
206 } |
210 } |
207 }, |
211 }, |
208 { text: 'Stap', datafield: 'ramp_time', width: 70, align: 'right', cellsalign: 'right', |
212 { text: 'Staptijd', datafield: 'ramp_time', width: 80, align: 'right', cellsalign: 'right', |
209 validation: function (cell, value) { |
213 validation: function (cell, value) { |
210 if (value < 1 || value > 60) { |
214 if (value < 1 || value > 60) { |
211 return { result: false, message: "De tijd moet tussen 1 en 60 zijn." }; |
215 return { result: false, message: "De tijd moet tussen 1 en 60 zijn." }; |
212 } |
216 } |
213 return true; |
217 return true; |
256 { text: 'Wijzig', datafield: 'Edit', width: 120, align: 'center', columntype: 'button', cellsrenderer: function () { |
260 { text: 'Wijzig', datafield: 'Edit', width: 120, align: 'center', columntype: 'button', cellsrenderer: function () { |
257 return "Wijzig"; |
261 return "Wijzig"; |
258 }, buttonclick: function (row) { |
262 }, buttonclick: function (row) { |
259 // open the popup window when the user clicks a button. |
263 // open the popup window when the user clicks a button. |
260 editrow = row; |
264 editrow = row; |
261 $("#popupWindow").jqxWindow({ position: { x: 230, y: 30 } }); |
265 $("#popupWindow").jqxWindow({ position: { x: 160, y: 30 } }); |
262 // get the clicked row's data and initialize the input fields. |
266 // get the clicked row's data and initialize the input fields. |
263 var dataRecord = $("#jqxgrid").jqxGrid('getrowdata', editrow); |
267 var dataRecord = $("#jqxgrid").jqxGrid('getrowdata', editrow); |
264 $("#name").val(dataRecord.name); |
268 $("#name").val(dataRecord.name); |
265 $("#notes").val(dataRecord.notes); |
269 $("#notes").val(dataRecord.notes); |
266 editsteps(dataRecord); |
270 editsteps(dataRecord); |
294 $("#jqxgrid").jqxGrid('deleterow', rowID); |
298 $("#jqxgrid").jqxGrid('deleterow', rowID); |
295 }); |
299 }); |
296 } |
300 } |
297 $("#popupWindow").jqxWindow('hide'); |
301 $("#popupWindow").jqxWindow('hide'); |
298 }); |
302 }); |
299 $("#Cancel").jqxButton({ theme: theme }); |
303 $("#Cancel").jqxButton({ template: "primary", width: '80px', theme: theme }); |
300 $("#Save").jqxButton({ theme: theme }); |
304 $("#Save").jqxButton({ template: "success", width: '90px', theme: theme }); |
301 // update the edited row when the user clicks the 'Save' button. |
305 // update the edited row when the user clicks the 'Save' button. |
302 $("#Save").click(function () { |
306 $("#Save").click(function () { |
303 var steprows = $('#grid').jqxGrid('getrows'); |
307 var steprows = $('#grid').jqxGrid('getrows'); |
304 if (editrow >= 0) { |
308 if (editrow >= 0) { |
305 var rowID = $('#jqxgrid').jqxGrid('getrowid', editrow); |
309 var rowID = $('#jqxgrid').jqxGrid('getrowid', editrow); |