diff -r 217ba4596c4d -r 3c680d1dea35 www/js/inv_yeasts.js --- a/www/js/inv_yeasts.js Mon Oct 14 23:13:40 2019 +0200 +++ b/www/js/inv_yeasts.js Wed Oct 16 21:05:03 2019 +0200 @@ -47,12 +47,12 @@ function calcTotal() { $('#totval').val(dataRecord.cost * dataRecord.inventory); - if (dataRecord.form == 0) { // Liquid + if (dataRecord.form == 'Vloeibaar') { // Liquid $("#pmpt_cost").html('Prijs per pak:'); $("#pmpt_inventory").html('Voorraad pak(ken):'); $("#pmpt_cells").html('Miljard cellen per pak:'); $("#inventory").jqxNumberInput({ decimalDigits: 0 }); - } else if (dataRecord.form == 1) { // Dry + } else if (dataRecord.form == 'Droog') { // Dry $("#pmpt_cost").html('Prijs per kg:'); $("#pmpt_inventory").html('Voorraad gram:'); $("#pmpt_cells").html('Miljard cellen per gram:'); @@ -73,8 +73,8 @@ datafields: [ { name: 'record', type: 'number' }, { name: 'name', type: 'string' }, - { name: 'type', type: 'int' }, - { name: 'form', type: 'int' }, + { name: 'type', type: 'string' }, + { name: 'form', type: 'string' }, { name: 'laboratory', type: 'string' }, { name: 'product_id', type: 'string' }, { name: 'min_temperature', type: 'float' }, @@ -163,7 +163,7 @@ $("#type").jqxDropDownList({ theme: theme, source: YeastTypeAdapter, - valueMember: 'id', + valueMember: 'nl', displayMember: 'nl', width: 180, height: 23, @@ -172,9 +172,9 @@ $("#form").jqxDropDownList({ theme: theme, source: YeastFormAdapter, - valueMember: 'id', + valueMember: 'nl', displayMember: 'nl', - selectedIndex: 0, + // selectedIndex: 0, width: 180, height: 23, autoDropDownHeight: true @@ -251,8 +251,8 @@ $("#name").val(''); $("#laboratory").val(''); $("#product_id").val(''); - $("#type").val(0); - $("#form").val(0); + $("#type").val('Bovengist'); + $("#form").val('Vloeibaar'); $("#min_temperature").val(18); $("#max_temperature").val(22); $("#flocculation").val(0); @@ -270,7 +270,7 @@ $("#bacteria").val(0); $("#harvest_top").val(0); $("#harvest_time").val(0); - $("pitch_temperature#").val(0); + $("#pitch_temperature").val(0); $("#pofpos").val(0); $("#zymocide").val(0); $("#popupWindow").jqxWindow('open'); @@ -285,16 +285,8 @@ { text: 'Laboratorium', datafield: 'laboratory', width: 150 }, { text: 'Product ID', datafield: 'product_id', width: 120, menu: false }, { text: 'Gist naam', datafield: 'name', menu: false }, - { text: 'Type', datafield: 'type', align: 'center', cellsalign: 'center', menu: false, width: 110, - cellsrenderer: function (index, datafield, value, defaultvalue, column, rowdata) { - return "
" + YeastTypeData[value].nl + "
"; - } - }, - { text: 'Vorm', datafield: 'form', align: 'center', cellsalign: 'center', menu: false, width: 110, - cellsrenderer: function (index, datafield, value, defaultvalue, column, rowdata) { - return "
" + YeastFormData[value].nl + "
"; - } - }, + { text: 'Type', datafield: 'type', align: 'center', cellsalign: 'center', width: 110 }, + { text: 'Vorm', datafield: 'form', align: 'center', cellsalign: 'center', width: 110 }, { text: 'SVG', datafield: 'attenuation', width: 70, align: 'right', cellsalign: 'right', menu: false, cellsformat: 'p1' }, { text: 'Tol%', datafield: 'tolerance', width: 60, align: 'right', cellsalign: 'right', menu: false, cellsrenderer: function (index, datafield, value, defaultvalue, column, rowdata) { @@ -308,11 +300,11 @@ cellsrenderer: function (index, datafield, value, defaultvalue, column, rowdata) { var amount = ""; if (value > 0) { - if ((rowdata.form == 0) && (value > 1)) + if ((rowdata.form == 'Vloeibaar') && (value > 1)) amount = dataAdapter.formatNumber(value,"f0")+" pakken"; - else if (rowdata.form == 0) + else if (rowdata.form == 'Vloeibaar') amount = dataAdapter.formatNumber(value,"f0")+" pak"; - else if (rowdata.form == 1) + else if (rowdata.form == 'Droog') amount = dataAdapter.formatNumber(value * 1000,"f1")+" gram"; else amount = dataAdapter.formatNumber(value * 1000,"f1")+" ml"; @@ -340,7 +332,7 @@ $("#notes").val(dataRecord.notes); $("#best_for").val(dataRecord.best_for); $("#max_reuse").val(dataRecord.max_reuse); - if (dataRecord.form == 0) + if (dataRecord.form == 'Vloeibaar') $("#inventory").val(dataRecord.inventory); else $("#inventory").val(dataRecord.inventory * 1000); @@ -370,17 +362,15 @@ calcTotal(); }); $("#inventory").on('change', function (event) { - if (dataRecord.form == 0) + if (dataRecord.form == 'Vloeibaar') dataRecord.inventory = parseFloat(event.args.value); else dataRecord.inventory = parseFloat(event.args.value) / 1000.0; calcTotal(); }); $("#form").on('select', function (event) { - if (event.args) { - dataRecord.form = event.args.index; - calcTotal(); - } + dataRecord.form = $("#form").val(); + calcTotal(); }); // initialize the popup window and buttons. @@ -450,7 +440,7 @@ if (editrow >= 0) { rowID = $('#jqxgrid').jqxGrid('getrowid', editrow); } - if (dataRecord.form == 0) + if (dataRecord.form == 'Vloeibaar') n_inventory = parseFloat($("#inventory").jqxNumberInput('decimal')); else n_inventory = parseFloat($("#inventory").jqxNumberInput('decimal')) / 1000.0;