Added the possibility to undo a task (closes #252)

This commit is contained in:
Bernd Bestel
2019-07-06 20:34:01 +02:00
parent 914dde4609
commit b4d2e2a20a
8 changed files with 103 additions and 1 deletions

View File

@@ -102,6 +102,32 @@ $(document).on('click', '.do-task-button', function(e)
);
});
$(document).on('click', '.undo-task-button', function(e)
{
e.preventDefault();
// Remove the focus from the current button
// to prevent that the tooltip stays until clicked anywhere else
document.activeElement.blur();
Grocy.FrontendHelpers.BeginUiBusy();
var taskId = $(e.currentTarget).attr('data-task-id');
var taskName = $(e.currentTarget).attr('data-task-name');
Grocy.Api.Post('tasks/' + taskId + '/undo', { },
function()
{
window.location.reload();
},
function(xhr)
{
Grocy.FrontendHelpers.EndUiBusy();
console.error(xhr);
}
);
});
$(document).on('click', '.delete-task-button', function (e)
{
e.preventDefault();