From 135ac118b00ca8b060bed39bd9b7be94d5d63529 Mon Sep 17 00:00:00 2001 From: Bernd Bestel Date: Tue, 6 Jul 2021 19:40:26 +0200 Subject: [PATCH] Added a filter for only done items on the /shoppinglist page (closes #1406) --- changelog/62_UNRELEASED_xxxx-xx-xx.md | 1 + localization/strings.pot | 2 ++ public/viewjs/shoppinglist.js | 4 ++-- views/shoppinglist.blade.php | 3 ++- 4 files changed, 7 insertions(+), 3 deletions(-) diff --git a/changelog/62_UNRELEASED_xxxx-xx-xx.md b/changelog/62_UNRELEASED_xxxx-xx-xx.md index b214f52f..d3a89547 100644 --- a/changelog/62_UNRELEASED_xxxx-xx-xx.md +++ b/changelog/62_UNRELEASED_xxxx-xx-xx.md @@ -41,6 +41,7 @@ ### Shopping list improvements/fixes - The amount now defaults to `1` for adding items quicker +- Added a status filter for only _done_ items - Fixed that shopping list prints had a grey background (thanks @Forceu) - Fixed the form validation on the shopping list item page (thanks @Forceu) - Fixed that when adding products to the shopping list from the stock overview page, the used quantity unit was always the products default purchase QU (and not the selected one) diff --git a/localization/strings.pot b/localization/strings.pot index 5984e96b..23e44535 100644 --- a/localization/strings.pot +++ b/localization/strings.pot @@ -2142,3 +2142,5 @@ msgstr "" msgid "Unable to print" msgstr "" +msgid "Only done items" +msgstr "" diff --git a/public/viewjs/shoppinglist.js b/public/viewjs/shoppinglist.js index bc472167..3bb90a98 100644 --- a/public/viewjs/shoppinglist.js +++ b/public/viewjs/shoppinglist.js @@ -361,11 +361,11 @@ $(document).on('click', '.order-listitem-button', function(e) var statusInfoCell = $("#shoppinglistitem-" + listItemId + "-status-info"); if (done == 1) { - statusInfoCell.text(statusInfoCell.text().replace("xxUNDONExx", "")); + statusInfoCell.text(statusInfoCell.text().replace("xxUNDONExx", "xxDONExx")); } else { - statusInfoCell.text(statusInfoCell.text() + " xxUNDONExx"); + statusInfoCell.text(statusInfoCell.text().replace("xxDONExx", "xxUNDONExx")); } shoppingListTable.rows().invalidate().draw(false); diff --git a/views/shoppinglist.blade.php b/views/shoppinglist.blade.php index bcaebf7b..c488957c 100644 --- a/views/shoppinglist.blade.php +++ b/views/shoppinglist.blade.php @@ -131,6 +131,7 @@ + @@ -239,7 +240,7 @@ @if(FindObjectInArrayByPropertyValue($missingProducts, 'id', $listItem->product_id) !== null) belowminstockamount @endif - @if($listItem->done != 1) xxUNDONExx @endif + @if($listItem->done == 1) xxDONExx @else xxUNDONExx @endif {{ $listItem->last_price_unit }}