91 { name: 'boil_size', type: 'float' }, |
93 { name: 'boil_size', type: 'float' }, |
92 { name: 'batch_size', type: 'float' }, |
94 { name: 'batch_size', type: 'float' }, |
93 { name: 'tun_volume', type: 'float' }, |
95 { name: 'tun_volume', type: 'float' }, |
94 { name: 'tun_weight', type: 'float' }, |
96 { name: 'tun_weight', type: 'float' }, |
95 { name: 'tun_specific_heat', type: 'float' }, |
97 { name: 'tun_specific_heat', type: 'float' }, |
96 { name: 'tun_material', type: 'string' }, |
98 { name: 'tun_material', type: 'int' }, |
97 { name: 'tun_height', type: 'float' }, |
99 { name: 'tun_height', type: 'float' }, |
98 { name: 'top_up_water', type: 'float' }, |
100 { name: 'top_up_water', type: 'float' }, |
99 { name: 'trub_chiller_loss', type: 'float' }, |
101 { name: 'trub_chiller_loss', type: 'float' }, |
100 { name: 'evap_rate', type: 'float' }, |
102 { name: 'evap_rate', type: 'float' }, |
101 { name: 'boil_time', type: 'float' }, |
103 { name: 'boil_time', type: 'float' }, |
102 { name: 'calc_boil_volume', type: 'bool' }, |
104 { name: 'calc_boil_volume', type: 'int' }, |
103 { name: 'top_up_kettle', type: 'float' }, |
105 { name: 'top_up_kettle', type: 'float' }, |
104 { name: 'hop_utilization', type: 'float' }, |
106 { name: 'hop_utilization', type: 'float' }, |
105 { name: 'notes', type: 'string' }, |
107 { name: 'notes', type: 'string' }, |
106 { name: 'lauter_volume', type: 'float' }, |
108 { name: 'lauter_volume', type: 'float' }, |
107 { name: 'lauter_height', type: 'float' }, |
109 { name: 'lauter_height', type: 'float' }, |
163 }); |
168 }); |
164 } |
169 } |
165 }; |
170 }; |
166 |
171 |
167 // initialize the input fields. |
172 // initialize the input fields. |
168 var srcMaterial= [ "RVS", "Aluminium", "Kunststof", "Koper" ]; |
|
169 |
|
170 $("#name").jqxInput({ theme: theme, width: 250, height: 23 }); |
173 $("#name").jqxInput({ theme: theme, width: 250, height: 23 }); |
171 $("#boil_size").jqxNumberInput({ inputMode: 'simple', spinMode: 'simple', theme: theme, width: 110, height: 23, min: 0, max: 200000, decimalDigits: 1, spinButtons: true, spinButtonsStep: 0.5 }); |
174 $("#notes").jqxInput({ theme: theme, width: 640, height: 100 }); |
172 $("#batch_size").jqxNumberInput({ inputMode: 'simple', spinMode: 'simple', theme: theme, width: 110, height: 23, min: 0, max: 200000, decimalDigits: 2, spinButtons: true, spinButtonsStep: 0.5 }); |
175 $("#boil_size").jqxNumberInput( Spin1dec5 ); |
173 $("#tun_volume").jqxNumberInput({ inputMode: 'simple', spinMode: 'simple', theme: theme, width: 110, height: 23, min: 0, max: 200000, decimalDigits: 1, spinButtons: true, spinButtonsStep: 0.5 }); |
176 $("#batch_size").jqxNumberInput( Spin2dec1 ); |
174 $("#tun_weight").jqxNumberInput({ inputMode: 'simple', spinMode: 'simple', theme: theme, width: 110, height: 23, min: 0, decimalDigits: 2, spinButtons: true }); |
177 $("#batch_size").jqxNumberInput({ spinButtonsStep: 0.5 }); |
|
178 $("#tun_volume").jqxNumberInput( Spin1dec5 ); |
|
179 $("#tun_weight").jqxNumberInput( Spin2dec1 ); |
175 $("#tun_specific_heat").jqxNumberInput({ inputMode: 'simple', readOnly: true, theme: theme, width: 70, height: 23, decimalDigits: 3 }); |
180 $("#tun_specific_heat").jqxNumberInput({ inputMode: 'simple', readOnly: true, theme: theme, width: 70, height: 23, decimalDigits: 3 }); |
176 $("#tun_material").jqxDropDownList({ theme: theme, source: srcMaterial, selectedIndex: 0, width: 110, height: 23, dropDownHeight: 130 }); |
181 $("#tun_material").jqxDropDownList({ |
177 $("#tun_height").jqxNumberInput({ inputMode: 'simple', spinMode: 'simple', theme: theme, width: 110, height: 23, min: 0, decimalDigits: 1, spinButtons: true }); |
182 theme: theme, |
178 $("#top_up_water").jqxNumberInput({ inputMode: 'simple', spinMode: 'simple', theme: theme, width: 110, height: 23, min: 0, max: 20000, decimalDigits: 1, spinButtons: true, spinButtonsStep: 0.1 }); |
183 source: MaterialAdapter, |
179 $("#trub_chiller_loss").jqxNumberInput({ inputMode: 'simple', spinMode: 'simple', theme: theme, width: 110, height: 23, min: 0, decimalDigits: 1, spinButtons: true, spinButtonsStep: 0.1 }); |
184 valueMember: 'id', |
180 $("#evap_rate").jqxNumberInput({ inputMode: 'simple', spinMode: 'simple', theme: theme, width: 110, height: 23, min: 0, max: 40000, decimalDigits: 2, spinButtons: true, spinButtonsStep: 0.05 }); |
185 displayMember: 'nl', |
181 $("#boil_time").jqxNumberInput({ inputMode: 'simple', spinMode: 'simple', theme: theme, width: 110, height: 23, min: 0, max: 1440, decimalDigits: 0, spinButtons: true }); |
186 // selectedIndex: 0, |
|
187 width: 180, |
|
188 height: 23, |
|
189 autoDropDownHeight: true |
|
190 }); |
|
191 $("#tun_height").jqxNumberInput( Spin1dec1 ); |
|
192 $("#top_up_water").jqxNumberInput( Spin1dec1 ); |
|
193 $("#trub_chiller_loss").jqxNumberInput( Spin1dec1 ); |
|
194 $("#evap_rate").jqxNumberInput( Spin2dec1 ); |
|
195 $("#boil_time").jqxNumberInput( PosInt ); |
|
196 $("#boil_time").jqxNumberInput({ max: 1440 }); |
182 $("#calc_boil_volume").jqxCheckBox({ theme: theme, width: 120, height: 23 }); |
197 $("#calc_boil_volume").jqxCheckBox({ theme: theme, width: 120, height: 23 }); |
183 $("#calc_boil_volume").on('checked', function (event) { |
198 $("#calc_boil_volume").on('checked', function (event) { |
184 $("#batch_size").jqxNumberInput({ readOnly: true, width: 90, spinButtons: false }); |
199 $("#batch_size").jqxNumberInput({ readOnly: true, width: 90, spinButtons: false }); |
185 }); |
200 }); |
186 $("#calc_boil_volume").on('unchecked', function (event) { |
201 $("#calc_boil_volume").on('unchecked', function (event) { |
187 $("#batch_size").jqxNumberInput({ readOnly: false, width: 110, spinButtons: true }); |
202 $("#batch_size").jqxNumberInput({ readOnly: false, width: 110, spinButtons: true }); |
188 }); |
203 }); |
189 $("#top_up_kettle").jqxNumberInput({ inputMode: 'simple', spinMode: 'simple', theme: theme, width: 110, height: 23, min: 0, decimalDigits: 1, spinButtons: true, spinButtonsStep: 0.1 }); |
204 $("#top_up_kettle").jqxNumberInput( Spin1dec1 ); |
190 $("#hop_utilization").jqxNumberInput({ inputMode: 'simple', spinMode: 'simple', theme: theme, width: 90, height: 23, min: 0, decimalDigits: 0, spinButtons: true }); |
205 $("#hop_utilization").jqxNumberInput( Perc0 ); |
191 $("#notes").jqxInput({ theme: theme, width: 640, height: 100 }); |
206 $("#hop_utilization").jqxNumberInput({ Max: 200 }); |
192 $("#lauter_volume").jqxNumberInput({ inputMode: 'simple', spinMode: 'simple', theme: theme, width: 110, height: 23, min: 0, max: 200000, decimalDigits: 1, spinButtons: true, spinButtonsStep: 0.5 }); |
207 $("#lauter_volume").jqxNumberInput( Spin1dec5 ); |
193 $("#lauter_height").jqxNumberInput({ inputMode: 'simple', spinMode: 'simple', theme: theme, width: 110, height: 23, min: 0, decimalDigits: 1, spinButtons: true }); |
208 $("#lauter_height").jqxNumberInput( Spin1dec1 ); |
194 $("#lauter_deadspace").jqxNumberInput({ inputMode: 'simple', spinMode: 'simple', theme: theme, width: 110, height: 23, min: 0, decimalDigits: 1, spinButtons: true, spinButtonsStep: 0.1 }); |
209 $("#lauter_deadspace").jqxNumberInput( Spin1dec1 ); |
195 $("#kettle_volume").jqxNumberInput({ inputMode: 'simple', spinMode: 'simple', theme: theme, width: 110, height: 23, min: 0, max: 200000, decimalDigits: 1, spinButtons: true, spinButtonsStep: 0.5 }); |
210 $("#kettle_volume").jqxNumberInput( Spin1dec5 ); |
196 $("#kettle_height").jqxNumberInput({ inputMode: 'simple', spinMode: 'simple', theme: theme, width: 110, height: 23, min: 0, decimalDigits: 1, spinButtons: true }); |
211 $("#kettle_height").jqxNumberInput( Spin1dec1 ); |
197 $("#mash_volume").jqxNumberInput({ inputMode: 'simple', spinMode: 'simple', theme: theme, width: 110, height: 23, min: 0, max: 200000, decimalDigits: 1, spinButtons: true, spinButtonsStep: 0.5 }); |
212 $("#mash_volume").jqxNumberInput( Spin1dec5 ); |
198 $("#mash_max").jqxNumberInput({ inputMode: 'simple', spinMode: 'simple', theme: theme, width: 110, height: 23, min: 0, max: 200000, decimalDigits: 1, spinButtons: true, spinButtonsStep: 0.5 }); |
213 $("#mash_max").jqxNumberInput( Spin1dec5 ); |
199 $("#efficiency").jqxNumberInput({ inputMode: 'simple', spinMode: 'simple', theme: theme, width: 110, height: 23, min: 0, decimalDigits: 1, spinButtons: true }); |
214 $("#efficiency").jqxNumberInput( Perc1dec5 ); |
|
215 |
200 var dataAdapter = new $.jqx.dataAdapter(source); |
216 var dataAdapter = new $.jqx.dataAdapter(source); |
201 var editrow = -1; |
217 var editrow = -1; |
202 // initialize jqxGrid |
218 // initialize jqxGrid |
203 $("#jqxgrid").jqxGrid({ |
219 $("#jqxgrid").jqxGrid({ |
204 width: 1280, |
220 width: 1280, |
210 renderstatusbar: function (statusbar) { |
226 renderstatusbar: function (statusbar) { |
211 var container = $("<div style='overflow: hidden; position: relative; margin: 5px;'></div>"); |
227 var container = $("<div style='overflow: hidden; position: relative; margin: 5px;'></div>"); |
212 var addButton = $("<div style='float: right; margin-right: 15px;'><img style='position: relative; margin-top: 2px;' src='images/add.png'/><span style='margin-left: 4px; position: relative; top: -3px;'>Nieuw</span></div>"); |
228 var addButton = $("<div style='float: right; margin-right: 15px;'><img style='position: relative; margin-top: 2px;' src='images/add.png'/><span style='margin-left: 4px; position: relative; top: -3px;'>Nieuw</span></div>"); |
213 container.append(addButton); |
229 container.append(addButton); |
214 statusbar.append(container); |
230 statusbar.append(container); |
215 addButton.jqxButton({ theme: theme, width: 120, height: 20 }); |
231 addButton.jqxButton({ theme: theme, width: 90, height: 20 }); |
216 // add new row. |
232 // add new row. |
217 addButton.click(function (event) { |
233 addButton.click(function (event) { |
218 editrow = -1; |
234 editrow = -1; |
219 $("#popupWindow").jqxWindow({ position: { x: 180, y: 30 } }); |
235 $("#popupWindow").jqxWindow({ position: { x: 110, y: 30 } }); |
220 $("#name").val(''); |
236 $("#name").val('Nieuwe brouwset'); |
221 $("#boil_size").val('18'); |
237 $("#boil_size").val(18); |
222 $("#batch_size").val('15.3'); |
238 $("#batch_size").val(15.3); |
223 $("#tun_volume").val('20'); |
239 $("#tun_volume").val(20); |
224 $("#tun_weight").val('2'); |
240 $("#tun_weight").val(2); |
225 $("#tun_specific_heat").val('0.11'); |
241 $("#tun_specific_heat").val(0.11); |
226 $("#tun_material").val('RVS'); |
242 $("#tun_material").val(0); |
227 $("#tun_height").val('20'); |
243 $("#tun_height").val(20); |
228 $("#top_up_water").val('0'); |
244 $("#top_up_water").val(0); |
229 $("#trub_chiller_loss").val('0.5'); |
245 $("#trub_chiller_loss").val(0.5); |
230 $("#evap_rate").val('1.8'); |
246 $("#evap_rate").val(1.8); |
231 $("#boil_time").val('90'); |
247 $("#boil_time").val(90); |
232 $("#calc_boil_volume").val(true); |
248 $("#calc_boil_volume").val(1); |
233 $("#top_up_kettle").val('0'); |
249 $("#top_up_kettle").val(0); |
234 $("#hop_utilization").val('100'); |
250 $("#hop_utilization").val(100); |
235 $("#notes").val(''); |
251 $("#notes").val(''); |
236 $("#lauter_volume").val('20'); |
252 $("#lauter_volume").val(20); |
237 $("#lauter_height").val('20'); |
253 $("#lauter_height").val(20); |
238 $("#lauter_deadspace").val('0.5'); |
254 $("#lauter_deadspace").val(0.5); |
239 $("#kettle_volume").val('20'); |
255 $("#kettle_volume").val(20); |
240 $("#kettle_height").val('20'); |
256 $("#kettle_height").val(20); |
241 $("#mash_volume").val('18'); |
257 $("#mash_volume").val(18); |
242 $("#mash_max").val('6'); |
258 $("#mash_max").val(6); |
243 $("#efficiency").val('75'); |
259 $("#efficiency").val(75); |
244 $("#popupWindow").jqxWindow('open'); |
260 $("#popupWindow").jqxWindow('open'); |
245 }); |
261 }); |
246 }, |
262 }, |
247 filterable: true, |
263 filterable: false, |
248 filtermode: 'excel', |
|
249 ready: function() { |
264 ready: function() { |
250 $('#boil_size').on('change', function (event) { calcBatchVolume(); }); |
265 $('#boil_size').on('change', function (event) { calcBatchVolume(); }); |
251 $('#evap_rate').on('change', function (event) { calcBatchVolume(); }); |
266 $('#evap_rate').on('change', function (event) { calcBatchVolume(); }); |
252 $('#boil_time').on('change', function (event) { calcBatchVolume(); }); |
267 $('#boil_time').on('change', function (event) { calcBatchVolume(); }); |
253 $('#top_up_kettle').on('change', function (event) { calcBatchVolume(); }); |
268 $('#top_up_kettle').on('change', function (event) { calcBatchVolume(); }); |
254 $("#calc_boil_volume").on('change', function (event) { calcBatchVolume(); }); |
269 $("#calc_boil_volume").on('change', function (event) { calcBatchVolume(); }); |
255 $('#tun_material').on('change', function (event) { |
270 $('#tun_material').on('change', function (event) { |
256 switch ($('#tun_material').val()) { |
271 dataRecord.tun_specific_heat = MaterialData[event.args.index].sh; |
257 case 'RVS': $("#tun_specific_heat").val('0.11'); |
272 $("#tun_specific_heat").val(dataRecord.tun_specific_heat); |
258 break; |
|
259 case 'Aluminium': $("#tun_specific_heat").val('0.22'); |
|
260 break; |
|
261 case 'Kunststof': $("#tun_specific_heat").val('0.46'); |
|
262 break; |
|
263 case 'Koper': $("#tun_specific_heat").val('0.092'); |
|
264 break; |
|
265 } |
|
266 }); |
273 }); |
267 }, |
274 }, |
268 columns: [ |
275 columns: [ |
269 { text: 'Installatie naam', datafield: 'name', width: 200 }, |
276 { text: 'Installatie naam', datafield: 'name', width: 200 }, |
270 { text: 'Kook volume', datafield: 'boil_size', width: 100, align: 'right', cellsalign: 'right', cellsformat: 'f1' }, |
277 { text: 'Kook volume', datafield: 'boil_size', width: 110, align: 'right', cellsalign: 'right', cellsformat: 'f1' }, |
271 { text: 'Batch volume', datafield: 'batch_size', width: 100, align: 'right', cellsalign: 'right', cellsformat: 'f1' }, |
278 { text: 'Batch volume', datafield: 'batch_size', width: 110, align: 'right', cellsalign: 'right', cellsformat: 'f1' }, |
272 { text: 'Opmerkingen', datafield: 'notes' }, |
279 { text: 'Opmerkingen', datafield: 'notes' }, |
273 { text: 'Wijzig', datafield: 'Edit', width: 120, align: 'center', columntype: 'button', cellsrenderer: function () { |
280 { text: 'Wijzig', datafield: 'Edit', width: 100, align: 'center', columntype: 'button', cellsrenderer: function () { |
274 return "Wijzig"; |
281 return "Wijzig"; |
275 }, buttonclick: function (row) { |
282 }, buttonclick: function (row) { |
276 // open the popup window when the user clicks a button. |
283 // open the popup window when the user clicks a button. |
277 editrow = row; |
284 editrow = row; |
278 $("#popupWindow").jqxWindow({ position: { x: 180, y: 30 } }); |
285 $("#popupWindow").jqxWindow({ position: { x: 110, y: 30 } }); |
279 // get the clicked row's data and initialize the input fields. |
286 // get the clicked row's data and initialize the input fields. |
280 var dataRecord = $("#jqxgrid").jqxGrid('getrowdata', editrow); |
287 dataRecord = $("#jqxgrid").jqxGrid('getrowdata', editrow); |
281 $("#name").val(dataRecord.name); |
288 $("#name").val(dataRecord.name); |
282 $("#boil_size").val(dataRecord.boil_size); |
289 $("#boil_size").val(dataRecord.boil_size); |
283 $("#batch_size").val(dataRecord.batch_size); |
290 $("#batch_size").val(dataRecord.batch_size); |
284 $("#tun_volume").val(dataRecord.tun_volume); |
291 $("#tun_volume").val(dataRecord.tun_volume); |
285 $("#tun_weight").val(dataRecord.tun_weight); |
292 $("#tun_weight").val(dataRecord.tun_weight); |