3188 { name: 'f_acid_to_ph_57', type: 'float' }, |
3188 { name: 'f_acid_to_ph_57', type: 'float' }, |
3189 { name: 'f_inventory', type: 'float' }, |
3189 { name: 'f_inventory', type: 'float' }, |
3190 { name: 'f_avail', type: 'int' } |
3190 { name: 'f_avail', type: 'int' } |
3191 ], |
3191 ], |
3192 addrow: function (rowid, rowdata, position, commit) { |
3192 addrow: function (rowid, rowdata, position, commit) { |
|
3193 console.log("fermentable addrow "+rowid); |
3193 commit(true); |
3194 commit(true); |
3194 }, |
3195 }, |
3195 deleterow: function (rowid, commit) { |
3196 deleterow: function (rowid, commit) { |
|
3197 console.log("fermentable deleterow "+rowid); |
3196 commit(true); |
3198 commit(true); |
3197 } |
3199 }, |
|
3200 updaterow: function (rowid, rowdata, commit) { |
|
3201 console.log("fermentable updaterow "+rowid); |
|
3202 commit(true); |
|
3203 } |
3198 }; |
3204 }; |
3199 var fermentableAdapter = new $.jqx.dataAdapter(fermentableSource); |
3205 var fermentableAdapter = new $.jqx.dataAdapter(fermentableSource); |
3200 $("#fermentableGrid").jqxGrid({ |
3206 $("#fermentableGrid").jqxGrid({ |
3201 width: 1240, |
3207 width: 1240, |
3202 height: 470, |
3208 height: 470, |
3203 source: fermentableAdapter, |
3209 source: fermentableAdapter, |
3204 theme: theme, |
3210 theme: theme, |
3205 sortmode: "many", |
|
3206 selectionmode: 'singlerow', |
3211 selectionmode: 'singlerow', |
3207 showtoolbar: true, |
3212 showtoolbar: true, |
3208 rendertoolbar: function (toolbar) { |
3213 rendertoolbar: function (toolbar) { |
3209 var me = this; |
3214 var me = this; |
3210 var container = $("<div style='overflow: hidden; position: relative; margin: 5px;'></div>"); |
3215 var container = $("<div style='overflow: hidden; position: relative; margin: 5px;'></div>"); |
3377 }, |
3377 }, |
3378 { text: '100%', align: 'center', datafield: 'f_adjust_to_total_100', columntype: 'checkbox', width: 70 }, |
3378 { text: '100%', align: 'center', datafield: 'f_adjust_to_total_100', columntype: 'checkbox', width: 70 }, |
3379 { text: '', datafield: 'Edit', columntype: 'button', width: 100, align: 'center', cellsrenderer: function () { |
3379 { text: '', datafield: 'Edit', columntype: 'button', width: 100, align: 'center', cellsrenderer: function () { |
3380 return "Wijzig"; |
3380 return "Wijzig"; |
3381 }, buttonclick: function (row) { |
3381 }, buttonclick: function (row) { |
3382 if (dataRecord.stage <= 3) { |
3382 if (dataRecord.stage > 3) { |
|
3383 alert("Ingredieënt is al verwerkt."); |
|
3384 } else { |
3383 fermentableRow = row; |
3385 fermentableRow = row; |
3384 fermentableData = $("#fermentableGrid").jqxGrid('getrowdata', fermentableRow); |
3386 fermentableData = $("#fermentableGrid").jqxGrid('getrowdata', fermentableRow); |
3385 $("#wf_name").val(fermentableData.f_name); |
3387 $("#wf_name").val(fermentableData.f_name); |
3386 $("#wf_amount").val(fermentableData.f_amount); |
3388 $("#wf_amount").val(fermentableData.f_amount); |
3387 $("#wf_percentage").val(fermentableData.f_percentage); |
3389 $("#wf_percentage").val(fermentableData.f_percentage); |
3423 { name: 'h_total_oil', type: 'float' }, |
3425 { name: 'h_total_oil', type: 'float' }, |
3424 { name: 'h_inventory', type: 'float' }, |
3426 { name: 'h_inventory', type: 'float' }, |
3425 { name: 'h_avail', type: 'int' } |
3427 { name: 'h_avail', type: 'int' } |
3426 ], |
3428 ], |
3427 addrow: function (rowid, rowdata, position, commit) { |
3429 addrow: function (rowid, rowdata, position, commit) { |
3428 commit(true); |
3430 console.log("hop addrow "+rowid); |
3429 }, |
3431 commit(true); |
|
3432 }, |
3430 deleterow: function (rowid, commit) { |
3433 deleterow: function (rowid, commit) { |
3431 commit(true); |
3434 console.log("hop deleterow "+rowid); |
3432 } |
3435 commit(true); |
|
3436 }, |
|
3437 updaterow: function (rowid, rowdata, commit) { |
|
3438 console.log("hop updaterow "+rowid); |
|
3439 commit(true); |
|
3440 } |
3433 }; |
3441 }; |
3434 var hopAdapter = new $.jqx.dataAdapter(hopSource); |
3442 var hopAdapter = new $.jqx.dataAdapter(hopSource); |
3435 $("#hopGrid").jqxGrid({ |
3443 $("#hopGrid").jqxGrid({ |
3436 width: 1240, |
3444 width: 1240, |
3437 height: 560, |
3445 height: 560, |
3438 source: hopAdapter, |
3446 source: hopAdapter, |
3439 theme: theme, |
3447 theme: theme, |
3440 sortmode: "many", |
|
3441 selectionmode: 'singlerow', |
3448 selectionmode: 'singlerow', |
3442 showtoolbar: true, |
3449 showtoolbar: true, |
3443 rendertoolbar: function (toolbar) { |
3450 rendertoolbar: function (toolbar) { |
3444 var me = this; |
3451 var me = this; |
3445 var container = $("<div style='overflow: hidden; position: relative; margin: 5px;'></div>"); |
3452 var container = $("<div style='overflow: hidden; position: relative; margin: 5px;'></div>"); |
3630 { name: 'm_amount_is_weight', type: 'int' }, |
3634 { name: 'm_amount_is_weight', type: 'int' }, |
3631 { name: 'm_inventory', type: 'float' }, |
3635 { name: 'm_inventory', type: 'float' }, |
3632 { name: 'm_avail', type: 'int' } |
3636 { name: 'm_avail', type: 'int' } |
3633 ], |
3637 ], |
3634 addrow: function (rowid, rowdata, position, commit) { |
3638 addrow: function (rowid, rowdata, position, commit) { |
|
3639 console.log("misc addrow "+rowid); |
3635 commit(true); |
3640 commit(true); |
3636 }, |
3641 }, |
3637 deleterow: function (rowid, commit) { |
3642 deleterow: function (rowid, commit) { |
|
3643 console.log("misc deleterow "+rowid); |
3638 commit(true); |
3644 commit(true); |
3639 } |
3645 }, |
|
3646 updaterow: function (rowid, rowdata, commit) { |
|
3647 console.log("misc updaterow "+rowid); |
|
3648 commit(true); |
|
3649 } |
3640 }; |
3650 }; |
3641 var miscAdapter = new $.jqx.dataAdapter(miscSource, { |
3651 var miscAdapter = new $.jqx.dataAdapter(miscSource, { |
3642 beforeLoadComplete: function (records) { |
3652 beforeLoadComplete: function (records) { |
3643 var data = new Array(); |
3653 var data = new Array(); |
3644 for (var i = 0; i < records.length; i++) { |
3654 for (var i = 0; i < records.length; i++) { |
3816 } |
3820 } |
3817 }, |
3821 }, |
3818 { text: '', datafield: 'Edit', columntype: 'button', width: 100, align: 'center', cellsrenderer: function () { |
3822 { text: '', datafield: 'Edit', columntype: 'button', width: 100, align: 'center', cellsrenderer: function () { |
3819 return "Wijzig"; |
3823 return "Wijzig"; |
3820 }, buttonclick: function (row) { |
3824 }, buttonclick: function (row) { |
3821 if (dataRecord.stage <= 3) { |
3825 miscRow = row; |
3822 miscRow = row; |
3826 miscData = $("#miscGrid").jqxGrid('getrowdata', miscRow); |
3823 miscData = $("#miscGrid").jqxGrid('getrowdata', miscRow); |
3827 if (dataRecord.stage > 3) { |
|
3828 alert("Ingredieënt is al verwerkt."); |
|
3829 } else if (miscData.m_type == 4) { |
|
3830 alert("Brouwzouten wijzigen in de water tab."); |
|
3831 } else { |
|
3832 console.log("edit button row "+row); |
3824 if (miscData.m_amount_is_weight) |
3833 if (miscData.m_amount_is_weight) |
3825 $("#wm_pmpt_amount").html("Gewicht gram:"); |
3834 $("#wm_pmpt_amount").html("Gewicht gram:"); |
3826 else |
3835 else |
3827 $("#wm_pmpt_amount").html("Volume ml:"); |
3836 $("#wm_pmpt_amount").html("Volume ml:"); |
3828 $("#wm_name").val(miscData.m_name); |
3837 $("#wm_name").val(miscData.m_name); |
3866 { name: 'y_tolerance', type: 'float' }, |
3874 { name: 'y_tolerance', type: 'float' }, |
3867 { name: 'y_inventory', type: 'float' }, |
3875 { name: 'y_inventory', type: 'float' }, |
3868 { name: 'y_avail', type: 'int' } |
3876 { name: 'y_avail', type: 'int' } |
3869 ], |
3877 ], |
3870 addrow: function (rowid, rowdata, position, commit) { |
3878 addrow: function (rowid, rowdata, position, commit) { |
|
3879 console.log("yeast addrow "+rowid); |
3871 commit(true); |
3880 commit(true); |
3872 }, |
3881 }, |
3873 deleterow: function (rowid, commit) { |
3882 deleterow: function (rowid, commit) { |
|
3883 console.log("yeast deleterow "+rowid); |
3874 commit(true); |
3884 commit(true); |
3875 } |
3885 }, |
|
3886 updaterow: function (rowid, rowdata, commit) { |
|
3887 console.log("yeast updaterow "+rowid); |
|
3888 commit(true); |
|
3889 } |
3876 }; |
3890 }; |
3877 var yeastAdapter = new $.jqx.dataAdapter(yeastSource); |
3891 var yeastAdapter = new $.jqx.dataAdapter(yeastSource); |
3878 $("#yeastGrid").jqxGrid({ |
3892 $("#yeastGrid").jqxGrid({ |
3879 width: 1240, |
3893 width: 1240, |
3880 height: 350, |
3894 height: 350, |
3881 source: yeastAdapter, |
3895 source: yeastAdapter, |
3882 theme: theme, |
3896 theme: theme, |
3883 sortmode: "many", |
|
3884 selectionmode: 'singlerow', |
3897 selectionmode: 'singlerow', |
3885 showtoolbar: true, |
3898 showtoolbar: true, |
3886 rendertoolbar: function (toolbar) { |
3899 rendertoolbar: function (toolbar) { |
3887 var me = this; |
3900 var me = this; |
3888 var container = $("<div style='overflow: hidden; position: relative; margin: 5px;'></div>"); |
3901 var container = $("<div style='overflow: hidden; position: relative; margin: 5px;'></div>"); |
4150 { text: 'Infuse L.', datafield: 'step_infuse_amount', width: 90, align: 'right', cellsalign: 'right', cellsformat: 'f1' }, |
4161 { text: 'Infuse L.', datafield: 'step_infuse_amount', width: 90, align: 'right', cellsalign: 'right', cellsformat: 'f1' }, |
4151 { text: 'L/Kg.', datafield: 'step_thickness', width: 90, align: 'right', cellsalign: 'right', cellsformat: 'f2' }, |
4162 { text: 'L/Kg.', datafield: 'step_thickness', width: 90, align: 'right', cellsalign: 'right', cellsformat: 'f2' }, |
4152 { text: '', datafield: 'Edit', columntype: 'button', width: 100, align: 'center', cellsrenderer: function () { |
4163 { text: '', datafield: 'Edit', columntype: 'button', width: 100, align: 'center', cellsrenderer: function () { |
4153 return "Wijzig"; |
4164 return "Wijzig"; |
4154 }, buttonclick: function (row) { |
4165 }, buttonclick: function (row) { |
4155 if (dataRecord.stage <= 3) { |
4166 if (dataRecord.stage > 3) { |
|
4167 alert("Het maichen is al gedaan."); |
|
4168 } else { |
4156 mashRow = row; |
4169 mashRow = row; |
4157 mashData = $("#mashGrid").jqxGrid('getrowdata', mashRow); |
4170 mashData = $("#mashGrid").jqxGrid('getrowdata', mashRow); |
4158 $("#wstep_name").val(mashData.step_name); |
4171 $("#wstep_name").val(mashData.step_name); |
4159 $("#wstep_type").val(mashData.step_type); |
4172 $("#wstep_type").val(mashData.step_type); |
4160 $("#wstep_infuse_amount").val(mashData.step_infuse_amount); |
4173 $("#wstep_infuse_amount").val(mashData.step_infuse_amount); |
4416 cancelButton: $("#FermentableReady"), |
4429 cancelButton: $("#FermentableReady"), |
4417 modalOpacity: 0.40 |
4430 modalOpacity: 0.40 |
4418 }); |
4431 }); |
4419 $("#FermentableReady").jqxButton({ template: "success", width: '90px', theme: theme }); |
4432 $("#FermentableReady").jqxButton({ template: "success", width: '90px', theme: theme }); |
4420 $("#FermentableReady").click(function () { |
4433 $("#FermentableReady").click(function () { |
|
4434 var rowID = $("#fermentableGrid").jqxGrid('getrowid', fermentableRow); |
|
4435 console.log("FermentableReady row:"+fermentableRow+" ID:"+rowID); |
|
4436 var row = { |
|
4437 f_name: fermentableData.f_name, |
|
4438 f_origin: fermentableData.f_origin, |
|
4439 f_supplier: fermentableData.f_supplier, |
|
4440 f_amount: fermentableData.f_amount, |
|
4441 f_cost: fermentableData.f_cost, |
|
4442 f_type: fermentableData.f_type, |
|
4443 f_yield: fermentableData.f_yield, |
|
4444 f_color: fermentableData.f_color, |
|
4445 f_coarse_fine_diff: fermentableData.f_coarse_fine_diff, |
|
4446 f_moisture: fermentableData.f_moisture, |
|
4447 f_diastatic_power: fermentableData.f_diastatic_power, |
|
4448 f_protein: fermentableData.f_protein, |
|
4449 f_max_in_batch: fermentableData.f_max_in_batch, |
|
4450 f_graintype: fermentableData.f_graintype, |
|
4451 f_added: fermentableData.f_added, |
|
4452 f_dissolved_protein: fermentableData.f_dissolved_protein, |
|
4453 f_recommend_mash: fermentableData.f_recommend_mash, |
|
4454 f_add_after_boil: fermentableData.f_add_after_boil, |
|
4455 f_adjust_to_total_100: fermentableData.f_adjust_to_total_100, |
|
4456 f_percentage: fermentableData.f_percentage, |
|
4457 f_di_ph: fermentableData.f_di_ph, |
|
4458 f_acid_to_ph_57: fermentableData.f_acid_to_ph_57, |
|
4459 f_inventory: fermentableData.f_inventory, |
|
4460 f_avail: fermentableData.f_avail |
|
4461 }; |
|
4462 $("#fermentableGrid").jqxGrid('updaterow', rowID, row); |
4421 // Recalc percentages |
4463 // Recalc percentages |
4422 calcFermentables(); |
4464 calcFermentables(); |
4423 calcIBUs(); |
4465 calcIBUs(); |
4424 calcMash(); |
4466 calcMash(); |
4425 // Waters: yes there is impact. |
4467 // Waters: yes there is impact. |
4446 }); |
4488 }); |
4447 $("#wf_select").on('select', function (event) { |
4489 $("#wf_select").on('select', function (event) { |
4448 if (event.args) { |
4490 if (event.args) { |
4449 var index = event.args.index; |
4491 var index = event.args.index; |
4450 var datarecord = fermentablelist.records[index]; |
4492 var datarecord = fermentablelist.records[index]; |
4451 var rowdata = $("#fermentableGrid").jqxGrid('getrowdata', fermentableRow); |
|
4452 $("#wf_name").val(datarecord.name); |
4493 $("#wf_name").val(datarecord.name); |
4453 rowdata.f_name = datarecord.name; |
4494 fermentableData.f_name = datarecord.name; |
4454 rowdata.f_origin = datarecord.origin; |
4495 fermentableData.f_origin = datarecord.origin; |
4455 rowdata.f_supplier = datarecord.supplier; |
4496 fermentableData.f_supplier = datarecord.supplier; |
4456 rowdata.f_type = datarecord.type; |
4497 fermentableData.f_type = datarecord.type; |
4457 rowdata.f_cost = datarecord.cost; |
4498 fermentableData.f_cost = datarecord.cost; |
4458 rowdata.f_yield = datarecord.yield; |
4499 fermentableData.f_yield = datarecord.yield; |
4459 rowdata.f_color = datarecord.color; |
4500 fermentableData.f_color = datarecord.color; |
4460 rowdata.f_coarse_fine_diff = datarecord.coarse_fine_diff; |
4501 fermentableData.f_coarse_fine_diff = datarecord.coarse_fine_diff; |
4461 rowdata.f_moisture = datarecord.moisture; |
4502 fermentableData.f_moisture = datarecord.moisture; |
4462 rowdata.f_diastatic_power = datarecord.diastatic_power; |
4503 fermentableData.f_diastatic_power = datarecord.diastatic_power; |
4463 rowdata.f_protein = datarecord.protein; |
4504 fermentableData.f_protein = datarecord.protein; |
4464 rowdata.f_max_in_batch = datarecord.max_in_batch; |
4505 fermentableData.f_max_in_batch = datarecord.max_in_batch; |
4465 rowdata.f_graintype = datarecord.graintype; |
4506 fermentableData.f_graintype = datarecord.graintype; |
4466 rowdata.f_dissolved_protein = datarecord.dissolved_protein; |
4507 fermentableData.f_dissolved_protein = datarecord.dissolved_protein; |
4467 rowdata.f_recommend_mash = datarecord.recommend_mash; |
4508 fermentableData.f_recommend_mash = datarecord.recommend_mash; |
4468 rowdata.f_add_after_boil = datarecord.add_after_boil; |
4509 fermentableData.f_add_after_boil = datarecord.add_after_boil; |
4469 rowdata.f_di_ph = datarecord.di_ph; |
4510 fermentableData.f_di_ph = datarecord.di_ph; |
4470 rowdata.f_acid_to_ph_57 = datarecord.acid_to_ph_57; |
4511 fermentableData.f_acid_to_ph_57 = datarecord.acid_to_ph_57; |
4471 rowdata.f_inventory = datarecord.inventory; |
4512 fermentableData.f_inventory = datarecord.inventory; |
4472 } |
4513 } |
4473 }); |
4514 }); |
4474 $("#wf_amount").jqxNumberInput( Spin3dec ); |
4515 $("#wf_amount").jqxNumberInput( Spin3dec ); |
4475 $('#wf_amount').on('change', function (event) { |
4516 $('#wf_amount').on('change', function (event) { |
4476 console.log("amount changed: "+event.args.value); |
4517 console.log("amount changed: "+event.args.value); |
4477 $("#fermentableGrid").jqxGrid('setcellvalue', fermentableRow, 'f_amount', event.args.value); |
4518 $("#fermentableGrid").jqxGrid('setcellvalue', fermentableRow, 'f_amount', event.args.value); |
|
4519 fermentableData.f_amount = event.args.value; |
4478 if (! to_100) { |
4520 if (! to_100) { |
4479 // Recalculate percentages |
4521 // Recalculate percentages |
4480 console.log("adjust percentages"); |
4522 console.log("adjust percentages"); |
4481 var rowscount = $("#fermentableGrid").jqxGrid('getdatainformation').rowscount; |
4523 var rowscount = $("#fermentableGrid").jqxGrid('getdatainformation').rowscount; |
4482 if (rowscount > 1) { |
4524 if (rowscount > 1) { |
4668 cancelButton: $("#HopReady"), |
4711 cancelButton: $("#HopReady"), |
4669 modalOpacity: 0.40 |
4712 modalOpacity: 0.40 |
4670 }); |
4713 }); |
4671 $("#HopReady").jqxButton({ template: "success", width: '90px', theme: theme }); |
4714 $("#HopReady").jqxButton({ template: "success", width: '90px', theme: theme }); |
4672 $("#HopReady").click(function () { |
4715 $("#HopReady").click(function () { |
|
4716 var rowID = $("#hopGrid").jqxGrid('getrowid', hopRow); |
|
4717 console.log("HopReady row:"+hopRow+" ID:"+rowID); |
|
4718 var row = { |
|
4719 h_name: $("#wh_name").val(), |
|
4720 h_origin: hopData.h_origin, |
|
4721 h_amount: parseFloat($("#wh_amount").jqxNumberInput('decimal')) / 1000, |
|
4722 h_cost: hopData.h_cost, |
|
4723 h_type: hopData.h_type, |
|
4724 h_form: hopData.h_form, |
|
4725 h_useat: $("#wh_useat").val(), |
|
4726 h_time: hopData.h_time, |
|
4727 h_alpha: hopData.h_alpha, |
|
4728 h_beta: hopData.h_beta, |
|
4729 h_hsi: hopData.h_hsi, |
|
4730 h_humulene: hopData.h_humulene, |
|
4731 h_caryophyllene: hopData.h_caryophyllene, |
|
4732 h_cohumulone: hopData.h_cohumulone, |
|
4733 h_myrcene: hopData.h_myrcene, |
|
4734 h_total_oil: hopData.h_total_oil, |
|
4735 h_inventory: hopData.h_inventory, |
|
4736 h_avail: hopData.h_avail |
|
4737 }; |
|
4738 $("#hopGrid").jqxGrid('updaterow', rowID, row); |
4673 calcIBUs(); |
4739 calcIBUs(); |
4674 }); |
4740 }); |
4675 $("#wh_name").jqxInput({ theme: theme, width: 320, height: 23 }); |
4741 $("#wh_name").jqxInput({ theme: theme, width: 320, height: 23 }); |
4676 $("#wh_instock").jqxCheckBox({ theme: theme, height: 23 }); |
4742 $("#wh_instock").jqxCheckBox({ theme: theme, height: 23 }); |
4677 $("#wh_instock").on('change', function (event) { |
4743 $("#wh_instock").on('change', function (event) { |
4694 }); |
4760 }); |
4695 $("#wh_select").on('select', function (event) { |
4761 $("#wh_select").on('select', function (event) { |
4696 if (event.args) { |
4762 if (event.args) { |
4697 var index = event.args.index; |
4763 var index = event.args.index; |
4698 var datarecord = hoplist.records[index]; |
4764 var datarecord = hoplist.records[index]; |
4699 var rowdata = $("#hopGrid").jqxGrid('getrowdata', hopRow); |
4765 // console.log("select another hop:"+index+" "+datarecord.name); |
4700 $("#wh_name").val(datarecord.name); |
4766 $("#wh_name").val(datarecord.name); |
4701 rowdata.h_name = datarecord.name; |
4767 hopData.h_name = datarecord.name; |
4702 rowdata.h_origin = datarecord.origin; |
4768 hopData.h_origin = datarecord.origin; |
4703 rowdata.h_cost = datarecord.cost; |
4769 hopData.h_cost = datarecord.cost; |
4704 rowdata.h_type = datarecord.type; |
4770 hopData.h_type = datarecord.type; |
4705 rowdata.h_form = datarecord.form; |
4771 hopData.h_form = datarecord.form; |
4706 rowdata.h_alpha = datarecord.alpha; |
4772 hopData.h_alpha = datarecord.alpha; |
4707 rowdata.h_beta = datarecord.beta; |
4773 hopData.h_beta = datarecord.beta; |
4708 rowdata.h_hsi = datarecord.hsi; |
4774 hopData.h_hsi = datarecord.hsi; |
4709 rowdata.h_humulene = datarecord.humulene; |
4775 hopData.h_humulene = datarecord.humulene; |
4710 rowdata.h_caryophyllene = datarecord.caryophyllene; |
4776 hopData.h_caryophyllene = datarecord.caryophyllene; |
4711 rowdata.h_cohumulone = datarecord.cohumulone; |
4777 hopData.h_cohumulone = datarecord.cohumulone; |
4712 rowdata.h_myrcene = datarecord.myrcene; |
4778 hopData.h_myrcene = datarecord.myrcene; |
4713 rowdata.h_total_oil = datarecord.total_oil; |
4779 hopData.h_total_oil = datarecord.total_oil; |
4714 rowdata.h_inventory = datarecord.inventory; |
4780 hopData.h_inventory = datarecord.inventory; |
4715 } |
4781 } |
4716 }); |
4782 }); |
4717 $("#wh_amount").jqxNumberInput( Spin1dec ); |
4783 $("#wh_amount").jqxNumberInput( Spin1dec ); |
4718 $('#wh_amount').on('change', function (event) { |
4784 $('#wh_amount').on('change', function (event) { |
4719 console.log("amount changed: "+event.args.value); |
4785 console.log("amount changed: "+event.args.value+" time:"+hopData.h_time+" alpha:"+hopData.h_alpha); |
4720 var amount = parseFloat(event.args.value) / 1000; |
4786 var amount = parseFloat(event.args.value) / 1000; |
4721 var rowdata = $("#hopGrid").jqxGrid('getrowdata', hopRow); |
4787 var ibu = toIBU(hopData.h_useat, hopData.h_form, preboil_sg, |
4722 var ibu = toIBU(rowdata.h_useat, rowdata.h_form, preboil_sg, |
|
4723 parseFloat($("#batch_size").jqxNumberInput('decimal')), |
4788 parseFloat($("#batch_size").jqxNumberInput('decimal')), |
4724 amount, parseFloat(rowdata.h_time), |
4789 amount, parseFloat(hopData.h_time), |
4725 parseFloat(rowdata.h_alpha), $("#ibu_method").val() |
4790 parseFloat(hopData.h_alpha), $("#ibu_method").val() |
4726 ); |
4791 ); |
4727 rowdata.h_amount = amount; |
4792 hopData.h_amount = amount; |
4728 var ibu = toIBU(rowdata.h_useat, rowdata.h_form, preboil_sg, parseFloat($("#batch_size").jqxNumberInput('decimal')), |
|
4729 parseFloat(rowdata.h_amount), parseFloat(rowdata.h_time), parseFloat(rowdata.h_alpha), $("#ibu_method").val()); |
|
4730 $("#wh_ibu").val(ibu); |
4793 $("#wh_ibu").val(ibu); |
4731 calcIBUs(); |
|
4732 }); |
4794 }); |
4733 $("#wh_ibu").jqxNumberInput( Show1dec ); |
4795 $("#wh_ibu").jqxNumberInput( Show1dec ); |
4734 $("#wh_time").jqxNumberInput( PosInt ); |
4796 $("#wh_time").jqxNumberInput( PosInt ); |
4735 $("#wh_time").on('change', function (event) { |
4797 $("#wh_time").on('change', function (event) { |
4736 console.log("time changed: "+event.args.value); |
|
4737 var rowdata = $("#hopGrid").jqxGrid('getrowdata', hopRow); |
|
4738 var newtime = parseFloat(event.args.value); |
4798 var newtime = parseFloat(event.args.value); |
4739 // Check limits and correct |
4799 // Check limits and correct |
4740 if (rowdata.h_useat == 2) { // Boil |
4800 if (hopData.h_useat == 2) { // Boil |
4741 if (newtime > parseFloat($("#boil_time").jqxNumberInput('decimal'))) { |
4801 if (newtime > parseFloat($("#boil_time").jqxNumberInput('decimal'))) { |
4742 newtime = parseFloat($("#boil_time").jqxNumberInput('decimal')); |
4802 newtime = parseFloat($("#boil_time").jqxNumberInput('decimal')); |
4743 $("#wh_time").val(newtime); |
4803 $("#wh_time").val(newtime); |
4744 } |
4804 } |
4745 rowdata.h_time = newtime; |
4805 hopData.h_time = newtime; |
4746 } else if (rowdata.h_useat == 4) { // Whirlpool |
4806 } else if (hopData.h_useat == 4) { // Whirlpool |
4747 if (newtime > 120) { |
4807 if (newtime > 120) { |
4748 newtime = 120; |
4808 newtime = 120; |
4749 $("#wh_time").val(newtime); |
4809 $("#wh_time").val(newtime); |
4750 } |
4810 } |
4751 rowdata.h_time = newtime; |
4811 hopData.h_time = newtime; |
4752 } else if (rowdata.h_useat == 5) { // Dry hop |
4812 } else if (hopData.h_useat == 5) { // Dry hop |
4753 if (newtime > 21) { |
4813 if (newtime > 21) { |
4754 newtime = 21; |
4814 newtime = 21; |
4755 $("#wh_time").val(newtime); |
4815 $("#wh_time").val(newtime); |
4756 } |
4816 } |
4757 rowdata.h_time = newtime * 1440; |
4817 hopData.h_time = newtime * 1440; |
4758 } |
4818 } |
4759 var ibu = toIBU(rowdata.h_useat, rowdata.h_form, preboil_sg, parseFloat($("#batch_size").jqxNumberInput('decimal')), |
4819 var ibu = toIBU(hopData.h_useat, hopData.h_form, preboil_sg, parseFloat($("#batch_size").jqxNumberInput('decimal')), |
4760 parseFloat(rowdata.h_amount), parseFloat(rowdata.h_time), parseFloat(rowdata.h_alpha), $("#ibu_method").val()); |
4820 parseFloat(hopData.h_amount), parseFloat(hopData.h_time), parseFloat(hopData.h_alpha), $("#ibu_method").val()); |
|
4821 // console.log("time changed: "+newtime+" final:"+hopData.h_time+" ibu:"+ibu); |
4761 $("#wh_ibu").val(ibu); |
4822 $("#wh_ibu").val(ibu); |
4762 calcIBUs(); |
|
4763 }); |
4823 }); |
4764 $("#wh_useat").jqxDropDownList({ |
4824 $("#wh_useat").jqxDropDownList({ |
4765 theme: theme, |
4825 theme: theme, |
4766 source: HopUseAdapter, |
4826 source: HopUseAdapter, |
4767 valueMember: 'id', |
4827 valueMember: 'id', |
4772 dropDownVerticalAlignment: 'top' |
4832 dropDownVerticalAlignment: 'top' |
4773 }); |
4833 }); |
4774 $("#wh_useat").on('select', function (event) { |
4834 $("#wh_useat").on('select', function (event) { |
4775 if (event.args) { |
4835 if (event.args) { |
4776 var index = event.args.index; |
4836 var index = event.args.index; |
4777 var rowdata = $("#hopGrid").jqxGrid('getrowdata', hopRow); |
4837 hopData.h_useat = index; |
4778 rowdata.h_useat = index; |
|
4779 if ((index == 0) || (index == 1)) { // Mashhop or First wort hop |
4838 if ((index == 0) || (index == 1)) { // Mashhop or First wort hop |
4780 rowdata.h_time = parseFloat(dataRecord.boil_time); |
4839 hopData.h_time = parseFloat(dataRecord.boil_time); |
4781 $("#wh_time").jqxNumberInput({ spinButtons: false, readOnly: true, width: 90 }); |
4840 $("#wh_time").jqxNumberInput({ spinButtons: false, readOnly: true, width: 90 }); |
4782 $("#wh_time").val(rowdata.h_time); |
4841 $("#wh_time").val(hopData.h_time); |
4783 } else if (index == 3) { // Aroma |
4842 } else if (index == 3) { // Aroma |
4784 rowdata.h_time = 0; |
4843 hopData.h_time = 0; |
4785 $("#wh_time").jqxNumberInput({ spinButtons: false, readOnly: true, width: 90 }); |
4844 $("#wh_time").jqxNumberInput({ spinButtons: false, readOnly: true, width: 90 }); |
4786 $("#wh_time").val(0); |
4845 $("#wh_time").val(0); |
4787 } else { // Boil, Whirlpool or Dry hop |
4846 } else { // Boil, Whirlpool or Dry hop |
4788 $("#wh_time").jqxNumberInput({ spinButtons: true, readOnly: false, width: 110 }); |
4847 $("#wh_time").jqxNumberInput({ spinButtons: true, readOnly: false, width: 110 }); |
4789 } |
4848 } |
4806 cancelButton: $("#MiscReady"), |
4865 cancelButton: $("#MiscReady"), |
4807 modalOpacity: 0.40 |
4866 modalOpacity: 0.40 |
4808 }); |
4867 }); |
4809 $("#MiscReady").jqxButton({ template: "success", width: '90px', theme: theme }); |
4868 $("#MiscReady").jqxButton({ template: "success", width: '90px', theme: theme }); |
4810 $("#MiscReady").click(function () { |
4869 $("#MiscReady").click(function () { |
|
4870 var rowID = $("#miscGrid").jqxGrid('getrowid', miscRow); |
|
4871 console.log("MiscReady row:"+miscRow+" ID:"+rowID); |
|
4872 var row = { |
|
4873 m_name: miscData.m_name, |
|
4874 m_amount: miscData.m_amount, |
|
4875 m_cost: miscData.m_cost, |
|
4876 m_type: miscData.m_type, |
|
4877 m_use_use: miscData.m_use_use, |
|
4878 m_time: miscData.m_time, |
|
4879 m_amount_is_weight: miscData.m_amount_is_weight, |
|
4880 m_inventory: miscData.m_inventory, |
|
4881 m_avail: miscData.m_avail |
|
4882 }; |
|
4883 $("#miscGrid").jqxGrid('updaterow', rowID, row); |
4811 calcMiscs(); |
4884 calcMiscs(); |
4812 }); |
4885 }); |
4813 $("#wm_name").jqxInput({ theme: theme, width: 320, height: 23 }); |
4886 $("#wm_name").jqxInput({ theme: theme, width: 320, height: 23 }); |
4814 $("#wm_instock").jqxCheckBox({ theme: theme, height: 23 }); |
4887 $("#wm_instock").jqxCheckBox({ theme: theme, height: 23 }); |
4815 $("#wm_instock").on('change', function (event) { |
4888 $("#wm_instock").on('change', function (event) { |
4828 }); |
4901 }); |
4829 $("#wm_select").on('select', function (event) { |
4902 $("#wm_select").on('select', function (event) { |
4830 if (event.args) { |
4903 if (event.args) { |
4831 var index = event.args.index; |
4904 var index = event.args.index; |
4832 var datarecord = misclist.records[index]; |
4905 var datarecord = misclist.records[index]; |
4833 var rowdata = $("#miscGrid").jqxGrid('getrowdata', miscRow); |
|
4834 $("#wm_name").val(datarecord.name); |
4906 $("#wm_name").val(datarecord.name); |
4835 rowdata.m_name = datarecord.name; |
4907 miscData.m_name = datarecord.name; |
4836 rowdata.m_cost = datarecord.cost; |
4908 miscData.m_cost = datarecord.cost; |
4837 rowdata.m_type = datarecord.type; |
4909 miscData.m_type = datarecord.type; |
4838 rowdata.m_use_use = datarecord.use_use; |
4910 miscData.m_use_use = datarecord.use_use; |
4839 rowdata.m_amount_is_weight = datarecord.amount_is_weight; |
4911 miscData.m_amount_is_weight = datarecord.amount_is_weight; |
4840 rowdata.m_inventory = datarecord.inventory; |
4912 miscData.m_inventory = datarecord.inventory; |
4841 } |
4913 } |
4842 }); |
4914 }); |
4843 $("#wm_amount").jqxNumberInput( Spin1dec ); |
4915 $("#wm_amount").jqxNumberInput( Spin1dec ); |
4844 $('#wm_amount').on('change', function (event) { |
4916 $('#wm_amount').on('change', function (event) { |
4845 console.log("amount changed: "+event.args.value); |
4917 console.log("amount changed: "+event.args.value); |
4846 var amount = parseFloat(event.args.value) / 1000; |
4918 miscData.m_amount = parseFloat(event.args.value) / 1000; |
4847 var rowdata = $("#miscGrid").jqxGrid('getrowdata', miscRow); |
|
4848 rowdata.m_amount = amount; |
|
4849 }); |
4919 }); |
4850 $("#wm_time").jqxNumberInput( PosInt ); |
4920 $("#wm_time").jqxNumberInput( PosInt ); |
4851 $("#wm_time").on('change', function (event) { |
4921 $("#wm_time").on('change', function (event) { |
4852 console.log("time changed: "+event.args.value); |
4922 console.log("time changed: "+event.args.value); |
4853 var rowdata = $("#miscGrid").jqxGrid('getrowdata', miscRow); |
|
4854 var newtime = parseFloat(event.args.value); |
4923 var newtime = parseFloat(event.args.value); |
4855 |
4924 |
4856 if (rowdata.m_use_use == 2) { // Boil |
4925 if (miscData.m_use_use == 2) { // Boil |
4857 if (newtime > parseFloat($("#boil_time").jqxNumberInput('decimal'))) { |
4926 if (newtime > parseFloat($("#boil_time").jqxNumberInput('decimal'))) { |
4858 newtime = parseFloat($("#boil_time").jqxNumberInput('decimal')); |
4927 newtime = parseFloat($("#boil_time").jqxNumberInput('decimal')); |
4859 $("#wm_time").val(newtime); |
4928 $("#wm_time").val(newtime); |
4860 } |
4929 } |
4861 rowdata.m_time = newtime; |
4930 miscData.m_time = newtime; |
4862 } else if ((rowdata.m_use_use == 3) || (rowdata.m_use_use == 4)) { // Primary or Secondary |
4931 } else if ((miscData.m_use_use == 3) || (miscData.m_use_use == 4)) { // Primary or Secondary |
4863 if (newtime > 21) { |
4932 if (newtime > 21) { |
4864 newtime = 21; |
4933 newtime = 21; |
4865 $("#wm_time").val(newtime); |
4934 $("#wm_time").val(newtime); |
4866 } |
4935 } |
4867 rowdata.m_time = newtime * 1440; |
4936 miscData.m_time = newtime * 1440; |
4868 } |
4937 } |
4869 }); |
4938 }); |
4870 $("#wm_use_use").jqxDropDownList({ |
4939 $("#wm_use_use").jqxDropDownList({ |
4871 theme: theme, |
4940 theme: theme, |
4872 source: MiscUseAdapter, |
4941 source: MiscUseAdapter, |
4911 cancelButton: $("#YeastReady"), |
4979 cancelButton: $("#YeastReady"), |
4912 modalOpacity: 0.40 |
4980 modalOpacity: 0.40 |
4913 }); |
4981 }); |
4914 $("#YeastReady").jqxButton({ template: "success", width: '90px', theme: theme }); |
4982 $("#YeastReady").jqxButton({ template: "success", width: '90px', theme: theme }); |
4915 $("#YeastReady").click(function () { |
4983 $("#YeastReady").click(function () { |
|
4984 var rowID = $("#yeastGrid").jqxGrid('getrowid', yeastRow); |
|
4985 console.log("YeastReady row:"+yeastRow+" ID:"+rowID); |
|
4986 var row = { |
|
4987 y_name: yeastData.y_name, |
|
4988 y_laboratory: yeastData.y_laboratory, |
|
4989 y_product_id: yeastData.y_product_id, |
|
4990 y_amount: yeastData.y_amount, |
|
4991 y_cost: yeastData.y_cost, |
|
4992 y_type: yeastData.y_type, |
|
4993 y_form: yeastData.y_form, |
|
4994 y_flocculation: yeastData.y_flocculation, |
|
4995 y_min_temperature: yeastData.y_min_temperature, |
|
4996 y_max_temperature: yeastData.y_max_temperature, |
|
4997 y_attenuation: yeastData.y_attenuation, |
|
4998 y_use: yeastData.y_use, |
|
4999 y_cells: yeastData.y_cells, |
|
5000 y_tolerance: yeastData.y_tolerance, |
|
5001 y_inventory: yeastData.y_inventory, |
|
5002 y_avail: yeastData.y_avail |
|
5003 }; |
|
5004 $("#yeastGrid").jqxGrid('updaterow', rowID, row); |
4916 calcFermentables(); |
5005 calcFermentables(); |
4917 calcYeast(); |
5006 calcYeast(); |
4918 }); |
5007 }); |
4919 $("#wy_name").jqxInput({ theme: theme, width: 320, height: 23 }); |
5008 $("#wy_name").jqxInput({ theme: theme, width: 320, height: 23 }); |
4920 $("#wy_laboratory").jqxInput({ theme: theme, width: 320, height: 23 }); |
5009 $("#wy_laboratory").jqxInput({ theme: theme, width: 320, height: 23 }); |
4940 }); |
5029 }); |
4941 $("#wy_select").on('select', function (event) { |
5030 $("#wy_select").on('select', function (event) { |
4942 if (event.args) { |
5031 if (event.args) { |
4943 var index = event.args.index; |
5032 var index = event.args.index; |
4944 var datarecord = yeastlist.records[index]; |
5033 var datarecord = yeastlist.records[index]; |
4945 var rowdata = $("#yeastGrid").jqxGrid('getrowdata', yeastRow); |
|
4946 $("#wy_name").val(datarecord.name); |
5034 $("#wy_name").val(datarecord.name); |
4947 $("#wy_laboratory").val(datarecord.laboratory); |
5035 $("#wy_laboratory").val(datarecord.laboratory); |
4948 $("#wy_product_id").val(datarecord.product_id); |
5036 $("#wy_product_id").val(datarecord.product_id); |
4949 rowdata.y_name = datarecord.name; |
5037 yeastData.y_name = datarecord.name; |
4950 rowdata.y_cost = datarecord.cost; |
5038 yeastData.y_cost = datarecord.cost; |
4951 rowdata.y_type = datarecord.type; |
5039 yeastData.y_type = datarecord.type; |
4952 rowdata.y_form = datarecord.form; |
5040 yeastData.y_form = datarecord.form; |
4953 rowdata.y_laboratory = datarecord.laboratory; |
5041 yeastData.y_laboratory = datarecord.laboratory; |
4954 rowdata.y_product_id = datarecord.product_id; |
5042 yeastData.y_product_id = datarecord.product_id; |
4955 rowdata.y_min_temperature = datarecord.min_temperature; |
5043 yeastData.y_min_temperature = datarecord.min_temperature; |
4956 rowdata.y_max_temperature = datarecord.max_temperature; |
5044 yeastData.y_max_temperature = datarecord.max_temperature; |
4957 rowdata.y_flocculation = datarecord.flocculation; |
5045 yeastData.y_flocculation = datarecord.flocculation; |
4958 rowdata.y_attenuation = datarecord.attenuation; |
5046 yeastData.y_attenuation = datarecord.attenuation; |
4959 rowdata.y_cells = datarecord.cells; |
5047 yeastData.y_cells = datarecord.cells; |
4960 rowdata.y_inventory = datarecord.inventory; |
5048 yeastData.y_inventory = datarecord.inventory; |
4961 if (rowdata.y_form == 0) { |
5049 if (yeastData.y_form == 0) { |
4962 $("#wy_pmpt_amount").html("Pak(ken):"); |
5050 $("#wy_pmpt_amount").html("Pak(ken):"); |
4963 } else if (rowdata.y_form == 1) { |
5051 } else if (yeastData.y_form == 1) { |
4964 $("#wy_pmpt_amount").html("Gewicht gram:"); |
5052 $("#wy_pmpt_amount").html("Gewicht gram:"); |
4965 } else { |
5053 } else { |
4966 $("#wy_pmpt_amount").html("Volume ml:"); |
5054 $("#wy_pmpt_amount").html("Volume ml:"); |
4967 } |
5055 } |
4968 calcFermentables(); |
5056 calcFermentables(); |