diff -r c26af32428a4 -r b8c3ca152984 www/js/inv_hops.js --- a/www/js/inv_hops.js Sun Aug 12 23:20:17 2018 +0200 +++ b/www/js/inv_hops.js Mon Aug 13 15:11:26 2018 +0200 @@ -1,5 +1,5 @@ /***************************************************************************** - * Copyright (C) 2014=2018 + * Copyright (C) 2014-2018 * * Michiel Broek * @@ -57,6 +57,7 @@ { name: 'caryophyllene', type: 'float' }, { name: 'cohumulone', type: 'float' }, { name: 'myrcene', type: 'float' }, + { name: 'hsi', type: 'float' }, { name: 'useat', type: 'string' }, { name: 'type', type: 'string' }, { name: 'form', type: 'string' }, @@ -68,7 +69,8 @@ { name: 'cost', type: 'float' }, { name: 'production_date', type: 'string' }, { name: 'tht_date', type: 'string' }, - { name: 'supplier_rec', type: 'float' } + { name: 'supplier_rec', type: 'number' }, + { name: 'total_oil', type: 'float' } ], id: 'record', url: url, @@ -121,7 +123,7 @@ }); } }; - var srcUse = [ "Boil", "Dry Hop", "Mash", "First Wort", "Aroma" ]; +// var srcUse = [ "Boil", "Dry Hop", "Mash", "First Wort", "Aroma" ]; // Only in recipes var srcType = [ "Bittering", "Aroma", "Both" ]; var srcForm = [ "Pellet", "Plug", "Leaf" ]; // initialize the input fields. @@ -132,11 +134,12 @@ $("#caryophyllene").jqxNumberInput({ inputMode: 'simple', spinMode: 'simple', theme: theme, width: 70, height: 23, min: 0, decimalDigits: 1, spinButtons: true }); $("#cohumulone").jqxNumberInput({ inputMode: 'simple', spinMode: 'simple', theme: theme, width: 70, height: 23, min: 0, decimalDigits: 1, spinButtons: true }); $("#myrcene").jqxNumberInput({ inputMode: 'simple', spinMode: 'simple', theme: theme, width: 70, height: 23, min: 0, decimalDigits: 1, spinButtons: true }); + $("#hsi").jqxNumberInput({ inputMode: 'simple', spinMode: 'simple', theme: theme, width: 70, height: 23, min: 0, decimalDigits: 1, spinButtons: true }); - $("#useat").jqxDropDownList({ theme: theme, source: srcType, width: 90, height: 23, dropDownHeight: 130 }); - $("#type").jqxDropDownList({ theme: theme, source: srcType, width: 90, height: 23, dropDownHeight: 130 }); - $("#form").jqxDropDownList({ theme: theme, source: srcType, width: 90, height: 23, dropDownHeight: 130 }); - $("#notes").jqxInput({ theme: theme, width: 640, height: 48 }); +// $("#useat").jqxDropDownList({ theme: theme, source: srcUse, width: 90, height: 23, dropDownHeight: 130 }); // Only in recipes + $("#type").jqxDropDownList({ theme: theme, source: srcType, width: 90, height: 23, dropDownHeight: 95 }); + $("#form").jqxDropDownList({ theme: theme, source: srcForm, width: 90, height: 23, dropDownHeight: 95 }); + $("#notes").jqxInput({ theme: theme, width: 640, height: 100 }); $("#origin").jqxInput({ theme: theme, width: 250, height: 23 }); $("#substitutes").jqxInput({ theme: theme, width: 250, height: 23 }); $("#always_on_stock").jqxCheckBox({ theme: theme, width: 120, height: 23 }); @@ -144,7 +147,8 @@ $("#production_date").jqxDateTimeInput({ theme: theme, width: 100, height: 23, formatString: 'yyyy-MM-dd' }); $("#cost").jqxNumberInput({ inputMode: 'simple', spinMode: 'simple', theme: theme, width: 70, height: 23, min: 0, decimalDigits: 2, spinButtons: true }); $("#tht_date").jqxDateTimeInput({ theme: theme, width: 100, height: 23, formatString: 'yyyy-MM-dd' }); - $("#supplier_rec").jqxNumberInput({ inputMode: 'simple', spinMode: 'simple', theme: theme, width: 70, height: 23, min: 0, decimalDigits: 1, spinButtons: true }); +// $("#supplier_rec").jqxNumberInput({ inputMode: 'simple', spinMode: 'simple', theme: theme, width: 70, height: 23, min: 0, decimalDigits: 1, spinButtons: true }); // Implement later. + $("#total_oil").jqxNumberInput({ inputMode: 'simple', spinMode: 'simple', theme: theme, width: 70, height: 23, min: 0, decimalDigits: 1, spinButtons: true }); var dataAdapter = new $.jqx.dataAdapter(source); var editrow = -1; // initialize jqxGrid @@ -153,7 +157,9 @@ height: 630, source: dataAdapter, theme: theme, + //altrows: true, showstatusbar: true, + localization: getLocalization(), renderstatusbar: function (statusbar) { var container = $("
"); var addButton = $("
Add
"); @@ -163,7 +169,7 @@ // add new row. addButton.click(function (event) { editrow = -1; - $("#popupWindow").jqxWindow({ position: { x: 80, y: 10 } }); + $("#popupWindow").jqxWindow({ position: { x: 230, y: 30 } }); $("#name").val(''); $("#alpha").val(''); $("#beta").val(''); @@ -171,6 +177,7 @@ $("#caryophyllene").val(''); $("#cohumulone").val(''); $("#myrcene").val(''); + $("#hsi").val(''); $("#useat").val('Boil'); $("#type").val('Bittering'); $("#form").val('Pellet'); @@ -183,24 +190,30 @@ $("#production_date").val(''); $("#tht_date").val(''); $("#supplier_rec").val(''); + $("#total_oil").val(''); $("#popupWindow").jqxWindow('open'); }); }, filterable: true, filtermode: 'excel', columns: [ - { text: 'Hop Name', datafield: 'name', width: 250 }, - { text: 'Type', datafield: 'type', width: 90 }, - { text: 'Alpha', datafield: 'alpha', width: 70, cellsalign: 'right', cellsformat: 'c2' }, - { text: 'Origin', datafield: 'origin', width: 150 }, - { text: 'Inv.', datafield: 'inventory', width: 70, cellsalign: 'right' }, - { text: 'Cost', datafield: 'cost', width: 70, cellsalign: 'right', cellsformat: 'c2' }, + { text: 'Hop Naam', datafield: 'name', width: 250 }, + { text: 'Soort', datafield: 'type', width: 90 }, + { text: 'Vorm', datafield: 'form', width: 90 }, + { text: 'Alpha %', datafield: 'alpha', width: 80, cellsalign: 'right', cellsformat: 'p1' }, + { text: 'Beta %', datafield: 'beta', width: 80, cellsalign: 'right', cellsformat: 'p1' }, + { text: 'Cohumuloon %%', datafield: 'cohumulone', width: 80, cellsalign: 'right', cellsformat: 'p1' }, + { text: 'HSI', datafield: 'hsi', width: 60, cellsalign: 'right', cellsformat: 'f1' }, + { text: 'Herkomst', datafield: 'origin', width: 150 }, + { text: 'Oogst datum', datafield: 'production_date', width: 100 }, + { text: 'Voorraad', datafield: 'inventory', width: 70, cellsalign: 'right' }, + { text: 'Prijs /kg', datafield: 'cost', width: 70, cellsalign: 'right', cellsformat: 'c2' }, { text: 'Edit', datafield: 'Edit', columntype: 'button', cellsrenderer: function () { return "Edit"; }, buttonclick: function (row) { // open the popup window when the user clicks a button. editrow = row; - $("#popupWindow").jqxWindow({ position: { x: 80, y: 10 } }); + $("#popupWindow").jqxWindow({ position: { x: 230, y: 30 } }); // get the clicked row's data and initialize the input fields. var dataRecord = $("#jqxgrid").jqxGrid('getrowdata', editrow); $("#name").val(dataRecord.name); @@ -210,6 +223,7 @@ $("#caryophyllene").val(dataRecord.caryophyllene); $("#cohumulone").val(dataRecord.cohumulone); $("#myrcene").val(dataRecord.myrcene); + $("#hsi").val(dataRecord.hsi); $("#useat").val(dataRecord.useat); $("#type").val(dataRecord.type); $("#form").val(dataRecord.form); @@ -222,6 +236,7 @@ $("#production_date").val(dataRecord.production_date); $("#tht_date").val(dataRecord.tht_date); $("#supplier_rec").val(dataRecord.supplier_rec); + $("#total_oil").val(dataRecord.total_oil); // show the popup window. $("#popupWindow").jqxWindow('open'); } @@ -262,6 +277,7 @@ caryophyllene: parseFloat($("#caryophyllene").jqxNumberInput('decimal')), cohumulone: parseFloat($("#cohumulone").jqxNumberInput('decimal')), myrcene: parseFloat($("#myrcene").jqxNumberInput('decimal')), + hsi: parseFloat($("#hsi").jqxNumberInput('decimal')), useat: $("#useat").val(), type: $("#type").val(), form: $("#form").val(), @@ -273,7 +289,8 @@ cost: parseFloat($("#cost").jqxNumberInput('decimal')), production_date: $("#production_date").val(), tht_date: $("#tht_date").val(), - supplier_rec: parseFloat($("#supplier_rec").jqxNumberInput('decimal')) + supplier_rec: parseFloat($("#supplier_rec").jqxNumberInput('decimal')), + total_oil: parseFloat($("#total_oil").jqxNumberInput('decimal')) }; $('#jqxgrid').jqxGrid('updaterow', rowID, row); $("#popupWindow").jqxWindow('hide'); @@ -288,6 +305,7 @@ caryophyllene: parseFloat($("#caryophyllene").jqxNumberInput('decimal')), cohumulone: parseFloat($("#cohumulone").jqxNumberInput('decimal')), myrcene: parseFloat($("#myrcene").jqxNumberInput('decimal')), + hsi: parseFloat($("#hsi").jqxNumberInput('decimal')), useat: $("#useat").val(), type: $("#type").val(), form: $("#form").val(), @@ -299,7 +317,8 @@ cost: parseFloat($("#cost").jqxNumberInput('decimal')), production_date: $("#production_date").val(), tht_date: $("#tht_date").val(), - supplier_rec: parseFloat($("#supplier_rec").jqxNumberInput('decimal')) + supplier_rec: parseFloat($("#supplier_rec").jqxNumberInput('decimal')), + total_oil: parseFloat($("#total_oil").jqxNumberInput('decimal')) }; $('#jqxgrid').jqxGrid('addrow', null, newrow); $("#popupWindow").jqxWindow('hide');