Sat, 23 May 2020 17:33:35 +0200
In profile fermentations added column to show the sensor mode. Renamed other prompts for sensor selection. Added clone record.
www/js/profile_fermentation.js | file | annotate | diff | comparison | revisions | |
www/profile_fermentation.php | file | annotate | diff | comparison | revisions |
--- a/www/js/profile_fermentation.js Sat May 23 12:03:33 2020 +0200 +++ b/www/js/profile_fermentation.js Sat May 23 17:33:35 2020 +0200 @@ -1,5 +1,5 @@ /***************************************************************************** - * Copyright (C) 2019 + * Copyright (C) 2019-2020 * * Michiel Broek <mbroek at mbse dot eu> * @@ -145,12 +145,8 @@ { name: 'target_hi', type: 'float' }, { name: 'fridgemode', type: 'int' } ], - addrow: function(rowid, rowdata, position, commit) { - commit(true); - }, - deleterow: function(rowid, commit) { - commit(true); - } + addrow: function(rowid, rowdata, position, commit) { commit(true); }, + deleterow: function(rowid, commit) { commit(true); } }, stepAdapter = new $.jqx.dataAdapter(stepSource); $('#grid').jqxGrid({ @@ -240,8 +236,8 @@ theme: theme, showstatusbar: true, renderstatusbar: function(statusbar) { - var addButton, container = $('<div style="overflow: hidden; position: relative; margin: 5px;"></div>'); - addButton = $('<div style="float: right; margin-right: 15px;"><img style="position: relative; margin-top: 2px;" ' + + var container = $('<div style="overflow: hidden; position: relative; margin: 5px;"></div>'); + var addButton = $('<div style="float: right; margin-right: 15px;"><img style="position: relative; margin-top: 2px;" ' + 'src="images/add.png"/><span style="margin-left: 4px; position: relative; top: -3px;">Nieuw</span></div>'); container.append(addButton); statusbar.append(container); @@ -263,27 +259,35 @@ filterable: false, columns: [ { text: 'Vergisting profiel', datafield: 'name' }, - { text: 'Min. start °C', datafield: 'inittemp_lo', width: 150, align: 'right', cellsalign: 'right', cellsformat: 'f1' }, - { text: 'Max. start °C', datafield: 'inittemp_hi', width: 150, align: 'right', cellsalign: 'right', cellsformat: 'f1' }, + { text: 'Min. start °C', datafield: 'inittemp_lo', width: 120, align: 'right', cellsalign: 'right', cellsformat: 'f1' }, + { text: 'Max. start °C', datafield: 'inittemp_hi', width: 120, align: 'right', cellsalign: 'right', cellsformat: 'f1' }, + { text: 'Sensor', datafield: 'fridgemode', align: 'right', width: 80, + cellsrenderer: function(row, columnfield, value, defaulthtml, column) { + if (value == 0) + return '<span style="margin: 3px; margin-top: 6px; float: right;">Bier</span>'; + else + return '<span style="margin: 3px; margin-top: 6px; float: right;">Koelkast</span>'; + } + }, { text: 'Stappen', datafield: 'totalsteps', width: 80, align: 'right', cellsalign: 'right' }, { text: 'Tijdsduur', datafield: 'duration', width: 150, align: 'right', cellsrenderer: function(row, columnfield, value, defaulthtml, column) { - var show, days, hours; - if (value < 24) { - show = value + ' uur'; - } else { - days = Math.floor(value / 24); - hours = value % 24; - if (days == 1) - show = days + ' dag, ' + hours + ' uur'; - else - show = days + ' dagen, ' + hours + ' uur'; - } - return '<span style="margin: 3px; margin-top: 6px; float: right;">' + show + '</span>'; + var show, days, hours; + if (value < 24) { + show = value + ' uur'; + } else { + days = Math.floor(value / 24); + hours = value % 24; + if (days == 1) + show = days + ' dag, ' + hours + ' uur'; + else + show = days + ' dagen, ' + hours + ' uur'; + } + return '<span style="margin: 3px; margin-top: 6px; float: right;">' + show + '</span>'; } }, { text: '', datafield: 'Edit', width: 100, align: 'center', columntype: 'button', cellsrenderer: - function() { + function() { return 'Wijzig'; }, buttonclick: function(row) { editrow = row; @@ -328,6 +332,20 @@ $('#popupWindow').jqxWindow('hide'); }); $('#Cancel').jqxButton({ template: 'primary', width: '90px', theme: theme }); + $('#Clone').jqxButton({ template: 'warning', width: '90px', theme: theme }); + $('#Clone').click(function() { + var steprows = $('#grid').jqxGrid('getrows'); + var row = { + record: -1, + name: $('#name').val() + ' kopie', + inittemp_lo: parseFloat($('#inittemp_lo').jqxNumberInput('decimal')), + inittemp_hi: parseFloat($('#inittemp_hi').jqxNumberInput('decimal')), + fridgemode: $('#fridgemode').val(), + steps: steprows + }; + $('#jqxgrid').jqxGrid('addrow', null, row); + $('#popupWindow').jqxWindow('hide'); + }); $('#Save').jqxButton({ template: 'success', width: '90px', theme: theme }); // update the edited row when the user clicks the 'Save' button. $('#Save').click(function() {
--- a/www/profile_fermentation.php Sat May 23 12:03:33 2020 +0200 +++ b/www/profile_fermentation.php Sat May 23 17:33:35 2020 +0200 @@ -25,7 +25,7 @@ <td align="left"><div id="inittemp_hi"></div></td> </tr> <tr> - <td align="right" style="vertical-align: top;">Koelkast of bier:</td> + <td align="right" style="vertical-align: top;">Koelkast sensor:</td> <td align="left" colspan="3"><div id="fridgemode"></div></td> </tr> <tr> @@ -34,7 +34,7 @@ </tr> <tr> <td style="padding-top: 40px;" align="right"><input type="button" id="Delete" value="Verwijder" /></td> - <td align="right"></td> + <td style="padding-top: 40px;" align="left"><input type="button" id="Clone" value="Kloon" /></td> <td align="right"></td> <td style="padding-top: 40px;" align="left"> <input style="margin-right: 5px;" type="button" id="Save" value="Sla op" />