diff -r 83ccc36df675 -r ad28e09e3abd www/js/recipes.js --- a/www/js/recipes.js Thu Sep 20 17:50:30 2018 +0200 +++ b/www/js/recipes.js Fri Sep 21 17:10:41 2018 +0200 @@ -314,6 +314,7 @@ var hopSource = { localdata: data.hops, datatype: "local", + cache: false, datafields: [ { name: 'h_name', type: 'string' }, { name: 'h_origin', type: 'string' }, @@ -430,9 +431,9 @@ }, columns: [ { text: 'Hop', editable: false, datafield: 'h_name' }, - { text: 'Type', editable: false, width: 100, datafield: 'h_type' }, + { text: 'Type', editable: false, width: 90, align: 'center', cellsalign: 'center', datafield: 'h_type' }, + { text: 'Vorm', editable: false, width: 90, align: 'center', cellsalign: 'center', datafield: 'h_form' }, { text: 'Alpha', datafield: 'h_alpha', width: 80, align: 'right', cellsalign: 'right', cellsformat: 'p1' }, - { text: 'Beta', datafield: 'h_beta', width: 80, align: 'right', cellsalign: 'right', cellsformat: 'p1' }, { text: 'Gewicht', datafield: 'h_amount', width: 110, align: 'right', cellsalign: 'right', cellsformat: 'f3', columntype: 'numberinput', validation: function (cell, value) { @@ -442,13 +443,28 @@ return true; } }, - { text: 'Tijd', datafield: 'h_time', width: 110, align: 'right', cellsalign: 'right', cellsformat: 'f0', + { text: 'Gebruik', width: 110, align: 'center', cellsalign: 'center', datafield: 'h_useat' }, + { text: 'Tijd', datafield: 'h_time', width: 70, align: 'right', cellsalign: 'right', cellsformat: 'f0', columntype: 'numberinput', validation: function (cell, value) { if (value < 0 || value > 100000000000 ) { return { result: false, message: "De tijd moet 0-~ zijn" }; } return true; + } // TODO: Only enable editing if Boil, else use fixed values. + }, + { text: 'IBU', editable: false, datafield: 'ibu', width: 80, align: 'right', + cellsrenderer: function (index, datafield, value, defaultvalue, column, rowdata) { + var ibu = toIBU(rowdata.h_useat, + rowdata.h_form, + parseFloat($("#est_og").jqxNumberInput('decimal')), + parseFloat($("#batch_size").jqxNumberInput('decimal')), + parseFloat(rowdata.h_amount), + parseFloat(rowdata.h_time), + parseFloat(rowdata.h_alpha), + $("#ibu_method").val() + ); + return "
" + dataAdapter.formatNumber(ibu, "f1") + "
"; } } ] @@ -788,7 +804,7 @@ mash_ph: parseFloat($("#mash_ph").jqxNumberInput('decimal')), mash_sparge_temp: parseFloat($("#mash_sparge_temp").jqxNumberInput('decimal')), fermentables: fermentablerow, - hops: hopwor, + hops: hoprow, waters: waterrow }; $('#jqxgrid').jqxGrid('updaterow', rowID, row);