Added the possibility to merge chores

This commit is contained in:
Bernd Bestel
2021-11-14 16:19:52 +01:00
parent 693dcc1020
commit 4d21668265
9 changed files with 208 additions and 2 deletions

View File

@@ -79,3 +79,28 @@ if (GetUriParam('include_disabled'))
{
$("#show-disabled").prop('checked', true);
}
$(".merge-chores-button").on("click", function(e)
{
var choreId = $(e.currentTarget).attr("data-chore-id");
$("#merge-chores-keep").val(choreId);
$("#merge-chores-remove").val("");
$("#merge-chores-modal").modal("show");
});
$("#merge-chores-save-button").on("click", function()
{
var choreIdToKeep = $("#merge-chores-keep").val();
var choreIdToRemove = $("#merge-chores-remove").val();
Grocy.Api.Post("chores/" + choreIdToKeep.toString() + "/merge/" + choreIdToRemove.toString(), {},
function(result)
{
window.location.href = U('/chores');
},
function(xhr)
{
Grocy.FrontendHelpers.ShowGenericError('Error while merging', xhr.response);
}
);
});