# HG changeset patch # User Michiel Broek # Date 1590248015 -7200 # Node ID 499c4921a90f04bc70589b030caefd5f4af84d44 # Parent 0ce464e42d8bb04b9f258f17b704e7a4eeb49922 In profile fermentations added column to show the sensor mode. Renamed other prompts for sensor selection. Added clone record. diff -r 0ce464e42d8b -r 499c4921a90f www/js/profile_fermentation.js --- 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 * @@ -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 = $('
'); - addButton = $('
'); + var addButton = $('
Nieuw
'); 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 'Bier'; + else + return 'Koelkast'; + } + }, { 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 '' + show + ''; + 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 '' + show + ''; } }, { 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() { diff -r 0ce464e42d8b -r 499c4921a90f www/profile_fermentation.php --- 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 @@
- Koelkast of bier: + Koelkast sensor:
@@ -34,7 +34,7 @@ - +