1242 { name: 'y_sg_lo', type: 'float' }, |
1242 { name: 'y_sg_lo', type: 'float' }, |
1243 { name: 'y_gr_hl_hi', type: 'int' }, |
1243 { name: 'y_gr_hl_hi', type: 'int' }, |
1244 { name: 'y_sg_hi', type: 'float' }, |
1244 { name: 'y_sg_hi', type: 'float' }, |
1245 { name: 'y_avail', type: 'int' } |
1245 { name: 'y_avail', type: 'int' } |
1246 ], |
1246 ], |
1247 addrow: function(rowid, rowdata, position, commit) { commit(true); }, |
1247 // addrow: function(rowid, rowdata, position, commit) { commit(true); }, |
1248 deleterow: function(rowid, commit) { commit(true); }, |
1248 // deleterow: function(rowid, commit) { commit(true); }, |
1249 updaterow: function(rowid, rowdata, commit) { commit(true); } |
1249 // updaterow: function(rowid, rowdata, commit) { commit(true); } |
1250 }, |
1250 }, |
1251 yeastAdapter = new $.jqx.dataAdapter(yeastSource); |
1251 yeastAdapter = new $.jqx.dataAdapter(yeastSource); |
1252 |
1252 |
1253 $('#yeastGrid').jqxGrid({ |
1253 $('#yeastGrid').jqxGrid({ |
1254 width: 1240, |
1254 width: 1240, |
1255 height: 350, |
1255 height: 350, |
1256 source: yeastAdapter, |
1256 source: yeastAdapter, |
1257 theme: theme, |
1257 theme: theme, |
1258 selectionmode: 'singlerow', |
1258 editable: false, |
1259 showtoolbar: true, |
|
1260 rendertoolbar: function(toolbar) { |
|
1261 var container = $('<div style="overflow: hidden; position: relative; margin: 5px;"></div>'); |
|
1262 toolbar.append(container); |
|
1263 container.append('<div style="float: left; margin-left: 165px;" id="yaddrowbutton"></div>'); |
|
1264 container.append('<div style="float: left; margin-left: 10px; margin-top: 5px;">In voorraad:</div>'); |
|
1265 container.append('<div style="float: left; margin-left: 10px;" id="yinstockbutton"></div>'); |
|
1266 container.append('<input style="float: left; margin-left: 400px;" id="ydeleterowbutton" type="button" value="Verwijder gist" />'); |
|
1267 // add yeast from dropdownlist. |
|
1268 $('#yaddrowbutton').jqxDropDownList({ |
|
1269 placeHolder: 'Kies gist:', |
|
1270 theme: theme, |
|
1271 source: yeastlist, |
|
1272 template: 'primary', |
|
1273 displayMember: 'name', |
|
1274 width: 150, |
|
1275 height: 27, |
|
1276 dropDownWidth: 500, |
|
1277 dropDownHeight: 500, |
|
1278 renderer: function(index, label, value) { |
|
1279 var datarecord = yeastlist.records[index]; |
|
1280 return datarecord.laboratory + ' ' + datarecord.product_id + ' ' + datarecord.name; |
|
1281 } |
|
1282 }); |
|
1283 $('#yaddrowbutton').on('select', function(event) { |
|
1284 if (event.args) { |
|
1285 var datarecord, row = {}, index = event.args.index; |
|
1286 datarecord = yeastlist.records[index]; |
|
1287 row['y_name'] = datarecord.name; |
|
1288 row['y_laboratory'] = datarecord.laboratory; |
|
1289 row['y_product_id'] = datarecord.product_id; |
|
1290 row['y_type'] = datarecord.type; |
|
1291 row['y_form'] = datarecord.form; |
|
1292 row['y_amount'] = 0; |
|
1293 row['y_cost'] = datarecord.cost; |
|
1294 row['y_use'] = 0; |
|
1295 row['y_min_temperature'] = datarecord.min_temperature; |
|
1296 row['y_max_temperature'] = datarecord.max_temperature; |
|
1297 row['y_attenuation'] = datarecord.attenuation; |
|
1298 row['y_flocculation'] = datarecord.flocculation; |
|
1299 row['y_cells'] = datarecord.cells; |
|
1300 row['y_tolerance'] = datarecord.tolerance; |
|
1301 row['y_inventory'] = datarecord.inventory; |
|
1302 row['y_sta1'] = datarecord.sta1; |
|
1303 row['y_bacteria'] = datarecord.bacteria; |
|
1304 row['y_harvest_top'] = datarecord.harvest_top; |
|
1305 row['y_harvest_time'] = datarecord.harvest_time; |
|
1306 row['y_pitch_temperature'] = datarecord.pitch_temperature; |
|
1307 row['y_pofpos'] = datarecord.pofpos; |
|
1308 row['y_zymocide'] = datarecord.zymocide; |
|
1309 row['y_gr_hl_lo'] = datarecord.gr_hl_lo; |
|
1310 row['y_sg_lo'] = datarecord.sg_lo; |
|
1311 row['y_gr_hl_hi'] = datarecord.gr_hl_hi; |
|
1312 row['y_sg_hi'] = datarecord.sg_hi; |
|
1313 $('#yeastGrid').jqxGrid('addrow', null, row); |
|
1314 } |
|
1315 $('#yaddrowbutton').jqxDropDownList('clearSelection'); |
|
1316 }); |
|
1317 $('#yinstockbutton').jqxCheckBox({ theme: theme, height: 27, disabled: (dataRecord.stage > 3) }); |
|
1318 $('#yinstockbutton').on('change', function(event) { |
|
1319 yeastinstock = event.args.checked; |
|
1320 yeastlist.dataBind(); |
|
1321 }); |
|
1322 // delete selected yeast. |
|
1323 $('#ydeleterowbutton').jqxButton({ template: 'danger', theme: theme, height: 27, width: 150, disabled: (dataRecord.stage > 3) }); |
|
1324 $('#ydeleterowbutton').on('click', function() { |
|
1325 var id, rowscount, selectedrowindex = $('#yeastGrid').jqxGrid('getselectedrowindex'); |
|
1326 rowscount = $('#yeastGrid').jqxGrid('getdatainformation').rowscount; |
|
1327 if (selectedrowindex >= 0 && selectedrowindex < rowscount) { |
|
1328 id = $('#yeastGrid').jqxGrid('getrowid', selectedrowindex); |
|
1329 $('#yeastGrid').jqxGrid('deleterow', id); |
|
1330 } |
|
1331 }); |
|
1332 }, |
|
1333 ready: function() { |
1259 ready: function() { |
1334 calcFermentables(); |
1260 calcFermentables(); |
1335 $('#jqxTabs').jqxTabs('next'); |
1261 $('#jqxTabs').jqxTabs('next'); |
1336 }, |
1262 }, |
1337 columns: [ |
1263 columns: [ |
1368 if (rowdata.y_form == 0) // Liquid |
1294 if (rowdata.y_form == 0) // Liquid |
1369 amount = dataAdapter.formatNumber(value, 'f0') + ' pk'; |
1295 amount = dataAdapter.formatNumber(value, 'f0') + ' pk'; |
1370 else if (rowdata.y_form == 1) // Dry |
1296 else if (rowdata.y_form == 1) // Dry |
1371 amount = dataAdapter.formatNumber(value * 1000, 'f1') + ' gr'; |
1297 amount = dataAdapter.formatNumber(value * 1000, 'f1') + ' gr'; |
1372 return '<span style="margin: 4px; margin-top: 6px; float: right;">' + amount + '</span>'; |
1298 return '<span style="margin: 4px; margin-top: 6px; float: right;">' + amount + '</span>'; |
1373 } |
|
1374 }, |
|
1375 { text: 'Voorraad', datafield: 'y_inventory', width: 90, align: 'right', |
|
1376 cellsrenderer: function(index, datafield, value, defaultvalue, column, rowdata) { |
|
1377 var color, amount; |
|
1378 color = '#ffffff'; |
|
1379 if (value < rowdata.y_amount) |
|
1380 color = '#ff4040'; |
|
1381 amount = dataAdapter.formatNumber(value * 1000, 'f0') + ' ml'; |
|
1382 if (rowdata.y_form == 0) // Liquid |
|
1383 amount = dataAdapter.formatNumber(value, 'f0') + ' pk'; |
|
1384 else if (rowdata.y_form == 1) // Dry |
|
1385 amount = dataAdapter.formatNumber(value * 1000, 'f1') + ' gr'; |
|
1386 return '<span style="margin: 4px; margin-top: 6px; float: right; color: ' + color + ';">' + amount + '</span>'; |
|
1387 } |
|
1388 }, |
|
1389 { text: '', datafield: 'Edit', columntype: 'button', width: 90, align: 'center', |
|
1390 cellsrenderer: function() { |
|
1391 return 'Wijzig'; |
|
1392 }, buttonclick: function(row) { |
|
1393 yeastRow = row; |
|
1394 yeastData = $('#yeastGrid').jqxGrid('getrowdata', yeastRow); |
|
1395 if (yeastData.y_form == 0) { |
|
1396 $('#wy_pmpt_amount').html('Pak(ken):'); |
|
1397 $('#wy_amount').val(yeastData.y_amount); |
|
1398 $('#wy_amount').jqxNumberInput({ decimalDigits: 0 }); |
|
1399 } else if (yeastData.y_form == 1) { |
|
1400 $('#wy_pmpt_amount').html('Gewicht gram:'); |
|
1401 $('#wy_amount').val(yeastData.y_amount * 1000); |
|
1402 $('#wy_amount').jqxNumberInput({ decimalDigits: 1 }); |
|
1403 } else { |
|
1404 $('#wy_pmpt_amount').html('Volume ml:'); |
|
1405 $('#wy_amount').val(yeastData.y_amount * 1000); |
|
1406 $('#wy_amount').jqxNumberInput({ decimalDigits: 0 }); |
|
1407 } |
|
1408 $('#wy_name').val(yeastData.y_name); |
|
1409 $('#wy_laboratory').val(yeastData.y_laboratory); |
|
1410 $('#wy_product_id').val(yeastData.y_product_id); |
|
1411 $('#wy_use').val(yeastData.y_use); |
|
1412 // show the popup window. |
|
1413 $('#popupYeast').jqxWindow('open'); |
|
1414 } |
1299 } |
1415 } |
1300 } |
1416 ] |
1301 ] |
1417 }); |
1302 }); |
1418 }; |
1303 }; |
2517 // Tab 5, Gist |
2402 // Tab 5, Gist |
2518 $('#est_fg2').jqxTooltip({ content: 'Het eind SG. Dit wordt automatisch berekend.' }); |
2403 $('#est_fg2').jqxTooltip({ content: 'Het eind SG. Dit wordt automatisch berekend.' }); |
2519 $('#est_fg2').jqxNumberInput(Show3dec); |
2404 $('#est_fg2').jqxNumberInput(Show3dec); |
2520 $('#est_abv2').jqxTooltip({ content: 'Alcohol volume %. Dit wordt automatisch berekend.' }); |
2405 $('#est_abv2').jqxTooltip({ content: 'Alcohol volume %. Dit wordt automatisch berekend.' }); |
2521 $('#est_abv2').jqxNumberInput(Smal1dec); |
2406 $('#est_abv2').jqxNumberInput(Smal1dec); |
2522 $('#popupYeast').jqxWindow({ |
|
2523 width: 800, |
|
2524 height: 300, |
|
2525 position: { x: 230, y: 100 }, |
|
2526 resizable: false, |
|
2527 theme: theme, |
|
2528 isModal: true, |
|
2529 autoOpen: false, |
|
2530 cancelButton: $('#YeastReady'), |
|
2531 modalOpacity: 0.40 |
|
2532 }); |
|
2533 $('#YeastReady').jqxButton({ template: 'success', width: '90px', theme: theme }); |
|
2534 $('#YeastReady').click(function() { |
|
2535 var row, rowID = $('#yeastGrid').jqxGrid('getrowid', yeastRow); |
|
2536 console.log('YeastReady row:' + yeastRow + ' ID:' + rowID); |
|
2537 row = { |
|
2538 y_name: yeastData.y_name, |
|
2539 y_laboratory: yeastData.y_laboratory, |
|
2540 y_product_id: yeastData.y_product_id, |
|
2541 y_amount: yeastData.y_amount, |
|
2542 y_cost: yeastData.y_cost, |
|
2543 y_type: yeastData.y_type, |
|
2544 y_form: yeastData.y_form, |
|
2545 y_flocculation: yeastData.y_flocculation, |
|
2546 y_min_temperature: yeastData.y_min_temperature, |
|
2547 y_max_temperature: yeastData.y_max_temperature, |
|
2548 y_attenuation: yeastData.y_attenuation, |
|
2549 y_use: yeastData.y_use, |
|
2550 y_cells: yeastData.y_cells, |
|
2551 y_tolerance: yeastData.y_tolerance, |
|
2552 y_inventory: yeastData.y_inventory, |
|
2553 y_sta1: yeastData.y_sta1, |
|
2554 y_bacteria: yeastData.y_bacteria, |
|
2555 y_harvest_top: yeastData.y_harvest_top, |
|
2556 y_harvest_time: yeastData.y_harvest_time, |
|
2557 y_pitch_temperature: yeastData.y_pitch_temperature, |
|
2558 y_pofpos: yeastData.y_pofpos, |
|
2559 y_zymocide: yeastData.y_zymocide, |
|
2560 y_gr_hl_lo: yeastData.y_gr_hl_lo, |
|
2561 y_sg_lo: yeastData.y_sg_lo, |
|
2562 y_gr_hl_hi: yeastData.y_gr_hl_hi, |
|
2563 y_sg_hi: yeastData.y_sg_hi, |
|
2564 y_avail: yeastData.y_avail |
|
2565 }; |
|
2566 $('#yeastGrid').jqxGrid('updaterow', rowID, row); |
|
2567 calcFermentables(); |
|
2568 }); |
|
2569 $('#wy_name').jqxInput({ theme: theme, width: 320, height: 23 }); |
|
2570 $('#wy_laboratory').jqxInput({ theme: theme, width: 320, height: 23 }); |
|
2571 $('#wy_product_id').jqxInput({ theme: theme, width: 320, height: 23 }); |
|
2572 $('#wy_instock').jqxCheckBox({ theme: theme, height: 23 }); |
|
2573 $('#wy_instock').on('change', function(event) { |
|
2574 yeastinstock = event.args.checked; |
|
2575 yeastlist.dataBind(); |
|
2576 }); |
|
2577 $('#wy_select').jqxDropDownList({ |
|
2578 placeHolder: 'Kies gist:', |
|
2579 theme: theme, |
|
2580 source: yeastlist, |
|
2581 displayMember: 'name', |
|
2582 width: 150, |
|
2583 height: 23, |
|
2584 dropDownWidth: 500, |
|
2585 dropDownHeight: 500, |
|
2586 renderer: function(index, label, value) { |
|
2587 var datarecord = yeastlist.records[index]; |
|
2588 return datarecord.laboratory + ' ' + datarecord.product_id + ' ' + datarecord.name; |
|
2589 } |
|
2590 }); |
|
2591 $('#wy_select').on('select', function(event) { |
|
2592 if (event.args) { |
|
2593 var datarecord, index = event.args.index; |
|
2594 datarecord = yeastlist.records[index]; |
|
2595 $('#wy_name').val(datarecord.name); |
|
2596 $('#wy_laboratory').val(datarecord.laboratory); |
|
2597 $('#wy_product_id').val(datarecord.product_id); |
|
2598 yeastData.y_name = datarecord.name; |
|
2599 yeastData.y_cost = datarecord.cost; |
|
2600 yeastData.y_type = datarecord.type; |
|
2601 yeastData.y_form = datarecord.form; |
|
2602 yeastData.y_laboratory = datarecord.laboratory; |
|
2603 yeastData.y_product_id = datarecord.product_id; |
|
2604 yeastData.y_min_temperature = datarecord.min_temperature; |
|
2605 yeastData.y_max_temperature = datarecord.max_temperature; |
|
2606 yeastData.y_flocculation = datarecord.flocculation; |
|
2607 yeastData.y_attenuation = datarecord.attenuation; |
|
2608 yeastData.y_cells = datarecord.cells; |
|
2609 yeastData.y_inventory = datarecord.inventory; |
|
2610 yeastData.y_sta1 = datarecord.sta1; |
|
2611 yeastData.y_bacteria = datarecord.bacteria; |
|
2612 yeastData.y_harvest_top = datarecord.harvest_top; |
|
2613 yeastData.y_harvest_time = datarecord.harvest_time; |
|
2614 yeastData.y_pitch_temperature = datarecord.pitch_temperature; |
|
2615 yeastData.y_pofpos = datarecord.pofpos; |
|
2616 yeastData.y_zymocide = datarecord.zymocide; |
|
2617 yeastData.y_gr_hl_lo = datarecord.gr_hl_lo; |
|
2618 yeastData.y_sg_lo = datarecord.sg_lo; |
|
2619 yeastData.y_gr_hl_hi = datarecord.gr_hl_hi; |
|
2620 yeastData.y_sg_hi = datarecord.sg_hi; |
|
2621 if (yeastData.y_form == 0) { |
|
2622 $('#wy_pmpt_amount').html('Pak(ken):'); |
|
2623 } else if (yeastData.y_form == 1 || yeastData.y_form == 6) { |
|
2624 $('#wy_pmpt_amount').html('Gewicht gram:'); |
|
2625 } else { |
|
2626 $('#wy_pmpt_amount').html('Volume ml:'); |
|
2627 } |
|
2628 calcFermentables(); |
|
2629 } |
|
2630 }); |
|
2631 $('#wy_amount').jqxNumberInput(Spin1dec); |
|
2632 $('#wy_amount').on('change', function(event) { |
|
2633 console.log('amount changed: ' + event.args.value); |
|
2634 var amount; |
|
2635 if (yeastData.y_form == 0) // Liquid |
|
2636 amount = parseFloat(event.args.value); |
|
2637 else |
|
2638 amount = parseFloat(event.args.value) / 1000; |
|
2639 yeastData.y_amount = amount; |
|
2640 calcFermentables(); |
|
2641 }); |
|
2642 $('#wy_use').jqxDropDownList({ |
|
2643 theme: theme, |
|
2644 source: YeastUseAdapter, |
|
2645 valueMember: 'id', |
|
2646 displayMember: 'nl', |
|
2647 width: 180, |
|
2648 height: 23, |
|
2649 autoDropDownHeight: true, |
|
2650 dropDownVerticalAlignment: 'top' |
|
2651 }); |
|
2652 $('#wy_use').on('select', function(event) { |
|
2653 if (event.args) { |
|
2654 var index = event.args.index; |
|
2655 yeastData.y_use = index; |
|
2656 calcFermentabes(); |
|
2657 } |
|
2658 }); |
|
2659 |
2407 |
2660 // Tab 6, Maischen |
2408 // Tab 6, Maischen |
2661 $('#mash_name').jqxInput({ theme: theme, width: 320, height: 23 }); |
2409 $('#mash_name').jqxInput({ theme: theme, width: 320, height: 23 }); |
2662 $('#mash_select').jqxDropDownList({ |
2410 $('#mash_select').jqxDropDownList({ |
2663 placeHolder: 'Kies schema:', |
2411 placeHolder: 'Kies schema:', |