www/js/prod_edit.js

changeset 740
04c0e444e48e
parent 738
11e6bd8d8107
child 741
4ec5de404bc1
equal deleted inserted replaced
739:bb923d2cbc35 740:04c0e444e48e
1 /***************************************************************************** 1 6*****************************************************************************
2 * Copyright (C) 2018-2021 2 * Copyright (C) 2018-2021
3 * 3 *
4 * Michiel Broek <mbroek at mbse dot eu> 4 * Michiel Broek <mbroek at mbse dot eu>
5 * 5 *
6 * This file is part of BMS 6 * This file is part of BMS
1601 $('#saddrowbutton').on('click', function() { 1601 $('#saddrowbutton').on('click', function() {
1602 var row = {}, rowscount = $('#mashGrid').jqxGrid('getdatainformation').rowscount; 1602 var row = {}, rowscount = $('#mashGrid').jqxGrid('getdatainformation').rowscount;
1603 row['step_name'] = 'Stap ' + (rowscount + 1); 1603 row['step_name'] = 'Stap ' + (rowscount + 1);
1604 if (rowscount > 0) { 1604 if (rowscount > 0) {
1605 row['step_type'] = 1; 1605 row['step_type'] = 1;
1606 row['step_infuse_amount'] = 0; 1606 row['step_infuse_amount'] = 0.0;
1607 row['step_volume'] = mash_infuse; 1607 row['step_volume'] = mash_infuse;
1608 } else { 1608 } else {
1609 row['step_type'] = 0; 1609 row['step_type'] = 0;
1610 row['step_infuse_amount'] = 15; 1610 row['step_infuse_amount'] = 15.0;
1611 row['step_volume'] = 15; 1611 row['step_volume'] = 15;
1612 } 1612 }
1613 row['step_infuse_temp'] = 0; 1613 row['step_infuse_temp'] = 0;
1614 row['step_temp'] = 62.0; 1614 row['step_temp'] = 62.0;
1615 row['step_time'] = 20.0; 1615 row['step_time'] = 20.0;
1616 row['step_wg_ratio'] = 0; 1616 row['step_wg_ratio'] = 0.0;
1617 row['ramp_time'] = 1.0; 1617 row['ramp_time'] = 1.0;
1618 row['end_temp'] = 62.0; 1618 row['end_temp'] = 62.0;
1619 row['step_ph'] = 0.0; 1619 row['step_ph'] = 0.0;
1620 row['step_sg'] = 0.0; 1620 row['step_sg'] = 0.0;
1621 $('#mashGrid').jqxGrid('addrow', null, row); 1621 $('#mashGrid').jqxGrid('addrow', null, row);
5705 row['step_sg'] = 0.0; 5705 row['step_sg'] = 0.0;
5706 //console.log(i + ' type: ' + row['step_type'] + ' start infusion: ' + parseFloat(row['step_infuse_amount']) + ' mash_infuse: ' + mash_infuse); 5706 //console.log(i + ' type: ' + row['step_type'] + ' start infusion: ' + parseFloat(row['step_infuse_amount']) + ' mash_infuse: ' + mash_infuse);
5707 infused += parseFloat(row['step_infuse_amount']); 5707 infused += parseFloat(row['step_infuse_amount']);
5708 row['step_volume'] = infused; 5708 row['step_volume'] = infused;
5709 if (mashkg > 0) 5709 if (mashkg > 0)
5710 row['step_wg_ratio'] = Round(parseFloat(mash_infuse / mashkg), 2); 5710 row['step_wg_ratio'] = Round(parseFloat(mash_infuse / mashkg), 6);
5711 else 5711 else
5712 row['step_wg_ratio'] = 0; 5712 row['step_wg_ratio'] = 0.0;
5713 $('#mashGrid').jqxGrid('addrow', null, row); 5713 $('#mashGrid').jqxGrid('addrow', null, row);
5714 } 5714 }
5715 calcMash(); 5715 calcMash();
5716 } 5716 }
5717 }); 5717 });
5820 var rowdata = $('#mashGrid').jqxGrid('getrowdata', mashRow); 5820 var rowdata = $('#mashGrid').jqxGrid('getrowdata', mashRow);
5821 rowdata.step_sg = parseFloat(event.args.value); 5821 rowdata.step_sg = parseFloat(event.args.value);
5822 }); 5822 });
5823 $('#wstep_brix').jqxNumberInput(Spin1dec); 5823 $('#wstep_brix').jqxNumberInput(Spin1dec);
5824 $('#wstep_brix').on('change', function(event) { 5824 $('#wstep_brix').on('change', function(event) {
5825 var sg = brix_to_sg(parseFloat(event.args.value)); 5825 /* Use plato_to_sg at this stage */
5826 var sg = plato_to_sg(parseFloat(event.args.value));
5826 console.log('brix: ' + parseFloat(event.args.value) + ' sg: ' + sg); 5827 console.log('brix: ' + parseFloat(event.args.value) + ' sg: ' + sg);
5827 if (sg > 1.005) { 5828 if (sg > 1.005) {
5828 var rowdata = $('#mashGrid').jqxGrid('getrowdata', mashRow); 5829 var rowdata = $('#mashGrid').jqxGrid('getrowdata', mashRow);
5829 rowdata.step_sg = sg; 5830 rowdata.step_sg = sg;
5830 $('#wstep_sg').val(sg); 5831 $('#wstep_sg').val(sg);

mercurial