Do an exact search for product group and location filters on the stock overview pages (fixes #778)

This commit is contained in:
Bernd Bestel 2020-08-24 17:57:43 +02:00
parent e039db22f5
commit 2c151fb4de
No known key found for this signature in database
GPG Key ID: 71BD34C0D4891300
3 changed files with 11 additions and 5 deletions

View File

@ -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 "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 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 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 ### Recipe improvements/fixes
- It's now possible to print recipes (button next to the recipe title) (thanks @zsarnett) - It's now possible to print recipes (button next to the recipe title) (thanks @zsarnett)

View File

@ -6,7 +6,8 @@
{ 'searchable': false, "targets": 0 }, { 'searchable': false, "targets": 0 },
{ 'searchable': false, "targets": 0 }, { 'searchable': false, "targets": 0 },
{ 'visible': false, 'targets': 5 }, { 'visible': false, 'targets': 5 },
{ 'visible': false, 'targets': 6 } { 'visible': false, 'targets': 6 },
{ 'visible': false, 'targets': 7 }
], ],
}); });
$('#stock-overview-table tbody').removeClass("d-none"); $('#stock-overview-table tbody').removeClass("d-none");
@ -20,7 +21,7 @@ $("#location-filter").on("change", function()
value = ""; value = "";
} }
stockOverviewTable.column(5).search(value).draw(); stockOverviewTable.column(5).search("xx" + value + "xx", true, false, true).draw();
}); });
$("#product-group-filter").on("change", function() $("#product-group-filter").on("change", function()
@ -31,7 +32,7 @@ $("#product-group-filter").on("change", function()
value = ""; value = "";
} }
stockOverviewTable.column(2).search(value).draw(); stockOverviewTable.column(7).search("xx" + value + "xx").draw();
}); });
$("#status-filter").on("change", function() $("#status-filter").on("change", function()

View File

@ -109,6 +109,7 @@
<th class="@if(!GROCY_FEATURE_FLAG_STOCK_BEST_BEFORE_DATE_TRACKING) d-none @endif">{{ $__t('Next best before date') }}</th> <th class="@if(!GROCY_FEATURE_FLAG_STOCK_BEST_BEFORE_DATE_TRACKING) d-none @endif">{{ $__t('Next best before date') }}</th>
<th class="d-none">Hidden location</th> <th class="d-none">Hidden location</th>
<th class="d-none">Hidden status</th> <th class="d-none">Hidden status</th>
<th class="d-none">Hidden product group</th>
@include('components.userfields_thead', array( @include('components.userfields_thead', array(
'userfields' => $userfields 'userfields' => $userfields
@ -235,12 +236,15 @@
</td> </td>
<td class="d-none"> <td class="d-none">
@foreach(FindAllObjectsInArrayByPropertyValue($currentStockLocations, 'product_id', $currentStockEntry->product_id) as $locationsForProduct) @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 @endforeach
</td> </td>
<td class="d-none"> <td class="d-none">
@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 @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
</td> </td>
<td class="d-none">
xx{{ $currentStockEntry->product_group_name }}xx
</td>
@include('components.userfields_tbody', array( @include('components.userfields_tbody', array(
'userfields' => $userfields, 'userfields' => $userfields,