diff --git a/changelog/67_UNRELEASED_xxxx-xx-xx.md b/changelog/67_UNRELEASED_xxxx-xx-xx.md index 3a244ffc..9f80f089 100644 --- a/changelog/67_UNRELEASED_xxxx-xx-xx.md +++ b/changelog/67_UNRELEASED_xxxx-xx-xx.md @@ -34,6 +34,7 @@ - New product option "Disable own stock" (defaults to disabled) - When enabled, the corresponding product can't have own stock, means it will not be selectable on purchase (useful for parent products which are just used as a summary/total view of the child products) - The location content sheet can now optionally list also out of stock products (at the products default location, new checkbox "Show only in-stock products " at the top of the page, defaults to enabled) +- Added a location filter to the stock entries page - Added the product grocycode as a (hidden by default) column to the products list (master data) - Fixed that consuming via the consume page was not possible when `FEATURE_FLAG_STOCK_LOCATION_TRACKING` was disabled diff --git a/public/viewjs/stockentries.js b/public/viewjs/stockentries.js index 6eaef7a6..788742c0 100644 --- a/public/viewjs/stockentries.js +++ b/public/viewjs/stockentries.js @@ -29,10 +29,24 @@ $.fn.dataTable.ext.search.push(function(settings, data, dataIndex) $("#clear-filter-button").on("click", function() { + $("#location-filter").val("all"); + $("#location-filter").trigger("change"); Grocy.Components.ProductPicker.Clear(); stockEntriesTable.draw(); }); +$("#location-filter").on("change", function() +{ + var value = $(this).val(); + var text = $("#location-filter option:selected").text(); + if (value === "all") + { + text = ""; + } + + stockEntriesTable.column(stockEntriesTable.colReorder.transpose(5)).search(text).draw(); +}); + Grocy.Components.ProductPicker.GetPicker().on('change', function(e) { stockEntriesTable.draw(); diff --git a/views/components/productpicker.blade.php b/views/components/productpicker.blade.php index a48ff463..0752d5e0 100644 --- a/views/components/productpicker.blade.php +++ b/views/components/productpicker.blade.php @@ -14,8 +14,9 @@ @php if(empty($hint)) { $hint = ''; } @endphp @php if(empty($nextInputSelector)) { $nextInputSelector = ''; } @endphp @php if(empty($validationMessage)) { $validationMessage = 'You have to select a product'; } @endphp +@php if(empty($additionalGroupCssClasses)) { $additionalGroupCssClasses = ''; } @endphp -
$products, 'disallowAllProductWorkflows' => true, - 'isRequired' => false + 'isRequired' => false, + 'additionalGroupCssClasses' => 'mb-0' ))
-
+ @if(GROCY_FEATURE_FLAG_STOCK_LOCATION_TRACKING) +
+
+
+  {{ $__t('Location') }} +
+ +
+
+ @endif +
+ @if(GROCY_FEATURE_FLAG_STOCK_LOCATION_TRACKING)
@@ -87,6 +88,7 @@
+ @endif