Optimized shopping list done items filter handling (fixes #2169)

This commit is contained in:
Bernd Bestel 2023-03-16 18:47:01 +01:00
parent 6857796ef0
commit 1090f070c9
No known key found for this signature in database
GPG Key ID: 71BD34C0D4891300

View File

@ -355,17 +355,24 @@ $(document).on('click', '.order-listitem-button', function(e)
Grocy.Api.Put('objects/shopping_list/' + listItemId, { 'done': done },
function()
{
var statusInfoCell = $("#shoppinglistitem-" + listItemId + "-status-info");
if (done == 1)
{
$('#shoppinglistitem-' + listItemId + '-row').addClass("text-muted");
$('#shoppinglistitem-' + listItemId + '-row').addClass("text-strike-through");
statusInfoCell.text(statusInfoCell.text().replace("xxUNDONExx", "xxDONExx"));
}
else
{
$('#shoppinglistitem-' + listItemId + '-row').removeClass("text-muted");
$('#shoppinglistitem-' + listItemId + '-row').removeClass("text-strike-through");
statusInfoCell.text(statusInfoCell.text().replace("xxDONExx", "xxUNDONExx"));
}
shoppingListTable.rows().invalidate().draw(false);
$("#status-filter").trigger("change");
Grocy.FrontendHelpers.EndUiBusy();
},
function(xhr)
@ -374,20 +381,6 @@ $(document).on('click', '.order-listitem-button', function(e)
console.error(xhr);
}
);
var statusInfoCell = $("#shoppinglistitem-" + listItemId + "-status-info");
if (done == 1)
{
statusInfoCell.text(statusInfoCell.text().replace("xxUNDONExx", "xxDONExx"));
}
else
{
statusInfoCell.text(statusInfoCell.text().replace("xxDONExx", "xxUNDONExx"));
}
shoppingListTable.rows().invalidate().draw(false);
$("#status-filter").trigger("change");
});
function OnListItemRemoved()