diff --git a/changelog/70_UNRELEASED_xxxx.xx.xx.md b/changelog/70_UNRELEASED_xxxx.xx.xx.md index e8cf2bdb..b94e5c86 100644 --- a/changelog/70_UNRELEASED_xxxx.xx.xx.md +++ b/changelog/70_UNRELEASED_xxxx.xx.xx.md @@ -12,7 +12,7 @@ ### Shopping list -- xxx +- Added a new button "Clear done items" (to clear all done items with one click) ### Recipes diff --git a/localization/strings.pot b/localization/strings.pot index 9f3fded1..22a97a7a 100644 --- a/localization/strings.pot +++ b/localization/strings.pot @@ -2338,3 +2338,6 @@ msgstr "" msgid "Decimal places allowed for prices (display)" msgstr "" + +msgid "Clear done items" +msgstr "" diff --git a/public/viewjs/shoppinglist.js b/public/viewjs/shoppinglist.js index 762898bb..965a30a8 100644 --- a/public/viewjs/shoppinglist.js +++ b/public/viewjs/shoppinglist.js @@ -236,6 +236,20 @@ $(document).on('click', '#clear-shopping-list', function(e) }); }); +$(document).on("click", "#clear-done-items", function(e) +{ + Grocy.Api.Post('stock/shoppinglist/clear', { "list_id": $("#selected-shopping-list").val(), "done_only": true }, + function(result) + { + window.location.reload(); + }, + function(xhr) + { + console.error(xhr); + } + ); +}); + $(document).on('click', '.shopping-list-stock-add-workflow-list-item-button', function(e) { e.preventDefault(); diff --git a/views/shoppinglist.blade.php b/views/shoppinglist.blade.php index c371e470..a789202c 100644 --- a/views/shoppinglist.blade.php +++ b/views/shoppinglist.blade.php @@ -92,11 +92,18 @@ href="{{ $U('/shoppinglistitem/new?embedded&list=' . $selectedShoppingListId) }}"> {{ $__t('Add item') }} - - {{ $__t('Clear list') }} - +
+ + {{ $__t('Clear list') }} + + + {{ $__t('Clear done items') }} + +