diff --git a/changelog/60_UNRELEASED_2020-xx-xx.md b/changelog/60_UNRELEASED_2020-xx-xx.md index fcae0bd1..a9fce24c 100644 --- a/changelog/60_UNRELEASED_2020-xx-xx.md +++ b/changelog/60_UNRELEASED_2020-xx-xx.md @@ -19,6 +19,7 @@ - Products can now be hidden instead of deleted to prevent problems / missing information on existing references (new checkbox on the product edit page) (thanks @kriddles) - Improved/fixed that changing the products "Factor purchase to stock quantity unit" not longer messes up historical prices (which results for example in wrong recipe costs) (thanks @kriddles) - On the stock journal page, it's now visible if a consume-booking was spoiled +- Added a "Clear filter"-button on the stock overview page to quickly reset applied filters - Fixed that it was not possible to leave the "Barcode(s)" on the product edit page by `TAB` - Fixed that when adding products through a product picker workflow and when the created products contains special characters, the product was not preselected on the previous page (thanks @Forceu) - Fixed that when editing a product the default store was not visible / always empty regardless if the product had one set (thanks @kriddles) diff --git a/localization/strings.pot b/localization/strings.pot index b13a152d..109beff1 100644 --- a/localization/strings.pot +++ b/localization/strings.pot @@ -1846,3 +1846,6 @@ msgstr "" msgid "Quantity unit stock cannot be changed after first purchase" msgstr "" + +msgid "Clear filter" +msgstr "" diff --git a/public/viewjs/stockoverview.js b/public/viewjs/stockoverview.js index 187fb2f2..ba2ee941 100644 --- a/public/viewjs/stockoverview.js +++ b/public/viewjs/stockoverview.js @@ -20,8 +20,12 @@ $("#location-filter").on("change", function() { value = ""; } + else + { + value = "xx" + value + "xx"; + } - stockOverviewTable.column(5).search("xx" + value + "xx", true, false, true).draw(); + stockOverviewTable.column(5).search(value).draw(); }); $("#product-group-filter").on("change", function() @@ -31,8 +35,12 @@ $("#product-group-filter").on("change", function() { value = ""; } + else + { + value = "xx" + value + "xx"; + } - stockOverviewTable.column(7).search("xx" + value + "xx").draw(); + stockOverviewTable.column(7).search(value).draw(); }); $("#status-filter").on("change", function() @@ -56,6 +64,18 @@ $(".status-filter-message").on("click", function() $("#status-filter").trigger("change"); }); +$("#clear-filter-button").on("click", function() +{ + $("#search").val(""); + $("#status-filter").val("all"); + $("#product-group-filter").val("all"); + $("#location-filter").val("all"); + stockOverviewTable.column(5).search("").draw(); + stockOverviewTable.column(6).search("").draw(); + stockOverviewTable.column(7).search("").draw(); + stockOverviewTable.search("").draw(); +}); + $("#search").on("keyup", Delay(function() { var value = $(this).val(); diff --git a/views/stockoverview.blade.php b/views/stockoverview.blade.php index cb82b3d3..e892ed6e 100644 --- a/views/stockoverview.blade.php +++ b/views/stockoverview.blade.php @@ -38,10 +38,13 @@

@endif

+ + {{ $__t('Clear filter') }} +
-
+