1418 { name: 'f_add_after_boil', type: 'int' }, |
1418 { name: 'f_add_after_boil', type: 'int' }, |
1419 { name: 'f_adjust_to_total_100', type: 'int' }, |
1419 { name: 'f_adjust_to_total_100', type: 'int' }, |
1420 { name: 'f_percentage', type: 'float' }, |
1420 { name: 'f_percentage', type: 'float' }, |
1421 { name: 'f_di_ph', type: 'float' }, |
1421 { name: 'f_di_ph', type: 'float' }, |
1422 { name: 'f_acid_to_ph_57', type: 'float' }, |
1422 { name: 'f_acid_to_ph_57', type: 'float' }, |
1423 { name: 'f_stock', type: 'float' }, |
1423 { name: 'f_inventory', type: 'float' }, |
|
1424 { name: 'f_avail', type: 'int' } |
1424 ], |
1425 ], |
1425 addrow: function (rowid, rowdata, position, commit) { |
1426 addrow: function (rowid, rowdata, position, commit) { |
1426 commit(true); |
1427 commit(true); |
1427 }, |
1428 }, |
1428 deleterow: function (rowid, commit) { |
1429 deleterow: function (rowid, commit) { |
1448 container.append('<input style="float: left; margin-left: 400px;" id="fdeleterowbutton" type="button" value="Verwijder mout" />'); |
1449 container.append('<input style="float: left; margin-left: 400px;" id="fdeleterowbutton" type="button" value="Verwijder mout" />'); |
1449 // add fermentable from dropdownlist. |
1450 // add fermentable from dropdownlist. |
1450 $("#faddrowbutton").jqxDropDownList({ |
1451 $("#faddrowbutton").jqxDropDownList({ |
1451 placeHolder: "Kies mout:", |
1452 placeHolder: "Kies mout:", |
1452 theme: theme, |
1453 theme: theme, |
|
1454 template: "primary", |
1453 source: fermentablelist, |
1455 source: fermentablelist, |
1454 displayMember: "name", |
1456 displayMember: "name", |
1455 width: 150, |
1457 width: 150, |
1456 height: 27, |
1458 height: 27, |
1457 dropDownWidth: 500, |
1459 dropDownWidth: 500, |
1499 row["f_adjust_to_total_100"] = 0; |
1501 row["f_adjust_to_total_100"] = 0; |
1500 row["f_percentage"] = 0; |
1502 row["f_percentage"] = 0; |
1501 } |
1503 } |
1502 row["f_di_ph"] = datarecord.di_ph; |
1504 row["f_di_ph"] = datarecord.di_ph; |
1503 row["f_acid_to_ph_57"] = datarecord.acid_to_ph_57; |
1505 row["f_acid_to_ph_57"] = datarecord.acid_to_ph_57; |
|
1506 row["f_inventory"] = datarecord.inventory; |
1504 var commit = $("#fermentableGrid").jqxGrid('addrow', null, row); |
1507 var commit = $("#fermentableGrid").jqxGrid('addrow', null, row); |
1505 } |
1508 } |
1506 }); |
1509 }); |
1507 |
1510 |
1508 $("#finstockbutton").jqxCheckBox({ theme: theme, height: 27 }); |
1511 $("#finstockbutton").jqxCheckBox({ theme: theme, height: 27 }); |
1510 fermentableinstock = event.args.checked; |
1513 fermentableinstock = event.args.checked; |
1511 fermentablelist.dataBind(); |
1514 fermentablelist.dataBind(); |
1512 }); |
1515 }); |
1513 |
1516 |
1514 // delete selected fermentable. |
1517 // delete selected fermentable. |
1515 $("#fdeleterowbutton").jqxButton({ theme: theme, height: 27, width: 150 }); |
1518 $("#fdeleterowbutton").jqxButton({ template: "danger", theme: theme, height: 27, width: 150 }); |
1516 $("#fdeleterowbutton").on('click', function () { |
1519 $("#fdeleterowbutton").on('click', function () { |
1517 var selectedrowindex = $("#fermentableGrid").jqxGrid('getselectedrowindex'); |
1520 var selectedrowindex = $("#fermentableGrid").jqxGrid('getselectedrowindex'); |
1518 var rowscount = $("#fermentableGrid").jqxGrid('getdatainformation').rowscount; |
1521 var rowscount = $("#fermentableGrid").jqxGrid('getdatainformation').rowscount; |
1519 if (selectedrowindex >= 0 && selectedrowindex < rowscount) { |
1522 if (selectedrowindex >= 0 && selectedrowindex < rowscount) { |
1520 var id = $("#fermentableGrid").jqxGrid('getrowid', selectedrowindex); |
1523 var id = $("#fermentableGrid").jqxGrid('getrowid', selectedrowindex); |
1575 return "<div style='margin: 4px;'>" + AddedData[value].nl + "</div>"; |
1578 return "<div style='margin: 4px;'>" + AddedData[value].nl + "</div>"; |
1576 } |
1579 } |
1577 }, |
1580 }, |
1578 { text: 'Opbrengst', editable: false, datafield: 'f_yield', width: 90, align: 'right', cellsalign: 'right', cellsformat: 'p1' }, |
1581 { text: 'Opbrengst', editable: false, datafield: 'f_yield', width: 90, align: 'right', cellsalign: 'right', cellsformat: 'p1' }, |
1579 { text: 'Gewicht Kg', datafield: 'f_amount', width: 120, align: 'right', cellsalign: 'right', cellsformat: 'f3' }, |
1582 { text: 'Gewicht Kg', datafield: 'f_amount', width: 120, align: 'right', cellsalign: 'right', cellsformat: 'f3' }, |
1580 { text: 'Voorr. Kg', datafield: 'f_stock', width: 120, align: 'right', cellsalign: 'right', cellsformat: 'f3' }, |
1583 { text: 'Voorr. Kg', datafield: 'f_inventory', width: 120, align: 'right', cellsalign: 'right', cellsformat: 'f3' }, |
1581 { text: 'Percent', datafield: 'f_percentage', width: 90, align: 'right', cellsalign: 'right', cellsformat: 'p1' }, |
1584 { text: 'Percent', datafield: 'f_percentage', width: 90, align: 'right', cellsalign: 'right', cellsformat: 'p1' }, |
1582 { text: '100%', align: 'center', datafield: 'f_adjust_to_total_100', columntype: 'checkbox', width: 70 }, |
1585 { text: '100%', align: 'center', datafield: 'f_adjust_to_total_100', columntype: 'checkbox', width: 70 }, |
1583 { text: 'Wijzig', datafield: 'Edit', columntype: 'button', width: 100, align: 'center', cellsrenderer: function () { |
1586 { text: 'Wijzig', datafield: 'Edit', columntype: 'button', width: 100, align: 'center', cellsrenderer: function () { |
1584 return "Wijzig"; |
1587 return "Wijzig"; |
1585 }, buttonclick: function (row) { |
1588 }, buttonclick: function (row) { |
2499 cancelButton: $("#FermentableReady"), |
2502 cancelButton: $("#FermentableReady"), |
2500 modalOpacity: 0.40 |
2503 modalOpacity: 0.40 |
2501 }); |
2504 }); |
2502 $("#FermentableReady").jqxButton({ template: "success", width: '90px', theme: theme }); |
2505 $("#FermentableReady").jqxButton({ template: "success", width: '90px', theme: theme }); |
2503 $("#FermentableReady").click(function () { |
2506 $("#FermentableReady").click(function () { |
2504 $("#fermentableGrid").jqxGrid('setcellvalue', fermentableRow, 'f_name', $("#wf_name").val()); |
2507 $("#fermentableGrid").jqxGrid('sortby', 'f_amount', 'desc'); |
2505 |
|
2506 // $("#fermentableGrid").jqxGrid('sortby', 'f_amount', 'desc'); |
|
2507 // Recalc percentages |
2508 // Recalc percentages |
2508 // calcFermentables(); |
2509 calcFermentables(); |
2509 // calcSVG(); |
2510 calcSVG(); |
2510 // calcABV(); |
2511 calcABV(); |
2511 // calcIBUs(); |
2512 calcIBUs(); |
2512 // Waters: yes there is impact. |
2513 // Waters: yes there is impact. |
2513 }); |
2514 }); |
2514 $("#wf_name").jqxInput({ theme: theme, width: 320, height: 23 }); |
2515 $("#wf_name").jqxInput({ theme: theme, width: 320, height: 23 }); |
|
2516 $("#wf_instock").jqxCheckBox({ theme: theme, height: 23 }); |
|
2517 $("#wf_instock").on('change', function (event) { |
|
2518 fermentableinstock = event.args.checked; |
|
2519 fermentablelist.dataBind(); |
|
2520 }); |
|
2521 $("#wf_select").jqxDropDownList({ |
|
2522 placeHolder: "Kies mout:", |
|
2523 theme: theme, |
|
2524 source: fermentablelist, |
|
2525 displayMember: "name", |
|
2526 width: 150, |
|
2527 height: 23, |
|
2528 dropDownWidth: 500, |
|
2529 dropDownHeight: 500, |
|
2530 renderer: function (index, label, value) { |
|
2531 var datarecord = fermentablelist.records[index]; |
|
2532 return datarecord.supplier+ " / " + datarecord.name + " (" + datarecord.color + " EBC)"; |
|
2533 } |
|
2534 }); |
|
2535 $("#wf_select").on('select', function (event) { |
|
2536 if (event.args) { |
|
2537 var index = event.args.index; |
|
2538 var datarecord = fermentablelist.records[index]; |
|
2539 var rowdata = $("#fermentableGrid").jqxGrid('getrowdata', fermentableRow); |
|
2540 $("#wf_name").val(datarecord.name); |
|
2541 rowdata.f_name = datarecord.name; |
|
2542 rowdata.f_origin = datarecord.origin; |
|
2543 rowdata.f_supplier = datarecord.supplier; |
|
2544 rowdata.f_type = datarecord.type; |
|
2545 rowdata.f_cost = datarecord.cost; |
|
2546 rowdata.f_yield = datarecord.yield; |
|
2547 rowdata.f_color = datarecord.color; |
|
2548 rowdata.f_coarse_fine_diff = datarecord.coarse_fine_diff; |
|
2549 rowdata.f_moisture = datarecord.moisture; |
|
2550 rowdata.f_diastatic_power = datarecord.diastatic_power; |
|
2551 rowdata.f_protein = datarecord.protein; |
|
2552 rowdata.f_max_in_batch = datarecord.max_in_batch; |
|
2553 rowdata.f_graintype = datarecord.graintype; |
|
2554 rowdata.f_dissolved_protein = datarecord.dissolved_protein; |
|
2555 rowdata.f_recommend_mash = datarecord.recommend_mash; |
|
2556 rowdata.f_add_after_boil = datarecord.add_after_boil; |
|
2557 rowdata.f_di_ph = datarecord.di_ph; |
|
2558 rowdata.f_acid_to_ph_57 = datarecord.acid_to_ph_57; |
|
2559 rowdata.f_inventory = datarecord.inventory; |
|
2560 } |
|
2561 }); |
2515 $("#wf_amount").jqxNumberInput( Spin3dec5 ); |
2562 $("#wf_amount").jqxNumberInput( Spin3dec5 ); |
2516 $('#wf_amount').on('change', function (event) { |
2563 $('#wf_amount').on('change', function (event) { |
2517 console.log("amount changed: "+event.args.value); |
2564 console.log("amount changed: "+event.args.value); |
2518 $("#fermentableGrid").jqxGrid('setcellvalue', fermentableRow, 'f_amount', event.args.value); |
2565 $("#fermentableGrid").jqxGrid('setcellvalue', fermentableRow, 'f_amount', event.args.value); |
2519 if (! to_100) { |
2566 if (! to_100) { |