From 2c151fb4dee16820d2500bac21dae1806119e884 Mon Sep 17 00:00:00 2001 From: Bernd Bestel Date: Mon, 24 Aug 2020 17:57:43 +0200 Subject: [PATCH] Do an exact search for product group and location filters on the stock overview pages (fixes #778) --- changelog/60_UNRELEASED_2020-xx-xx.md | 1 + public/viewjs/stockoverview.js | 9 +++++---- views/stockoverview.blade.php | 6 +++++- 3 files changed, 11 insertions(+), 5 deletions(-) diff --git a/changelog/60_UNRELEASED_2020-xx-xx.md b/changelog/60_UNRELEASED_2020-xx-xx.md index 1d3d241f..938fcfeb 100644 --- a/changelog/60_UNRELEASED_2020-xx-xx.md +++ b/changelog/60_UNRELEASED_2020-xx-xx.md @@ -25,6 +25,7 @@ - Fixed that the "Expiring soon" sum (yellow header-button) on the stock overview page didn't include products which expire today (thanks @fipwmaqzufheoxq92ebc) - Fixed that the shopping cart icon on the stock overview page was also shown if the product was on an already deleted shopping list (if enabled) (thanks @fipwmaqzufheoxq92ebc) - Fixed that when editing a stock entry without a price, the price field was prefilled with `1` +- Fixed that location & product groups filter on the stock overview page did a contains search instead an exact search ### Recipe improvements/fixes - It's now possible to print recipes (button next to the recipe title) (thanks @zsarnett) diff --git a/public/viewjs/stockoverview.js b/public/viewjs/stockoverview.js index 191ec9a7..f3a3da18 100644 --- a/public/viewjs/stockoverview.js +++ b/public/viewjs/stockoverview.js @@ -6,7 +6,8 @@ { 'searchable': false, "targets": 0 }, { 'searchable': false, "targets": 0 }, { 'visible': false, 'targets': 5 }, - { 'visible': false, 'targets': 6 } + { 'visible': false, 'targets': 6 }, + { 'visible': false, 'targets': 7 } ], }); $('#stock-overview-table tbody').removeClass("d-none"); @@ -20,7 +21,7 @@ $("#location-filter").on("change", function() value = ""; } - stockOverviewTable.column(5).search(value).draw(); + stockOverviewTable.column(5).search("xx" + value + "xx", true, false, true).draw(); }); $("#product-group-filter").on("change", function() @@ -30,8 +31,8 @@ $("#product-group-filter").on("change", function() { value = ""; } - - stockOverviewTable.column(2).search(value).draw(); + + stockOverviewTable.column(7).search("xx" + value + "xx").draw(); }); $("#status-filter").on("change", function() diff --git a/views/stockoverview.blade.php b/views/stockoverview.blade.php index 97d90325..82363852 100644 --- a/views/stockoverview.blade.php +++ b/views/stockoverview.blade.php @@ -109,6 +109,7 @@ {{ $__t('Next best before date') }} Hidden location Hidden status + Hidden product group @include('components.userfields_thead', array( 'userfields' => $userfields @@ -235,12 +236,15 @@ @foreach(FindAllObjectsInArrayByPropertyValue($currentStockLocations, 'product_id', $currentStockEntry->product_id) as $locationsForProduct) - {{ FindObjectInArrayByPropertyValue($locations, 'id', $locationsForProduct->location_id)->name }} + xx{{ FindObjectInArrayByPropertyValue($locations, 'id', $locationsForProduct->location_id)->name }}xx @endforeach @if($currentStockEntry->best_before_date < date('Y-m-d 23:59:59', strtotime('-1 days')) && $currentStockEntry->amount > 0) expired @elseif($currentStockEntry->best_before_date < date('Y-m-d 23:59:59', strtotime("+$nextXDays days")) && $currentStockEntry->amount > 0) expiring @endif @if($currentStockEntry->product_missing) belowminstockamount @endif + + xx{{ $currentStockEntry->product_group_name }}xx + @include('components.userfields_tbody', array( 'userfields' => $userfields,