mirror of
https://github.com/grocy/grocy.git
synced 2025-04-29 01:32:38 +00:00
Add possibility to filter by product group on stock overview page
This commit is contained in:
parent
132999ce36
commit
03eaa6c79f
@ -23,7 +23,8 @@ class StockController extends BaseController
|
||||
'locations' => $this->Database->locations()->orderBy('name'),
|
||||
'currentStock' => $this->StockService->GetCurrentStock(),
|
||||
'missingProducts' => $this->StockService->GetMissingProducts(),
|
||||
'nextXDays' => 5
|
||||
'nextXDays' => 5,
|
||||
'productGroups' => $this->Database->product_groups()->orderBy('name')
|
||||
]);
|
||||
}
|
||||
|
||||
|
@ -278,6 +278,7 @@ return array(
|
||||
'No instruction manual available' => 'Keine Bedienungsanleitung vorhanden',
|
||||
'The current instruction manual will be deleted when you save the equipment' => 'Die aktuelle Bedienungsanleitung wird beim Speichern des Geräts gelöscht',
|
||||
'No picture available' => 'Kein Bild vorhanden',
|
||||
'Filter by product group' => 'Nach Produktgruppe filtern',
|
||||
|
||||
//Constants
|
||||
'manually' => 'Manuell',
|
||||
|
@ -31,6 +31,17 @@ $("#location-filter").on("change", function()
|
||||
stockOverviewTable.column(4).search(value).draw();
|
||||
});
|
||||
|
||||
$("#product-group-filter").on("change", function()
|
||||
{
|
||||
var value = $(this).val();
|
||||
if (value === "all")
|
||||
{
|
||||
value = "";
|
||||
}
|
||||
|
||||
stockOverviewTable.column(6).search(value).draw();
|
||||
});
|
||||
|
||||
$("#status-filter").on("change", function()
|
||||
{
|
||||
var value = $(this).val();
|
||||
|
@ -36,6 +36,15 @@
|
||||
@endforeach
|
||||
</select>
|
||||
</div>
|
||||
<div class="col-xs-12 col-md-6 col-xl-3">
|
||||
<label for="location-filter">{{ $L('Filter by product group') }}</label> <i class="fas fa-filter"></i>
|
||||
<select class="form-control" id="product-group-filter">
|
||||
<option value="all">{{ $L('All') }}</option>
|
||||
@foreach($productGroups as $productGroup)
|
||||
<option value="{{ $productGroup->name }}">{{ $productGroup->name }}</option>
|
||||
@endforeach
|
||||
</select>
|
||||
</div>
|
||||
<div class="col-xs-12 col-md-6 col-xl-3">
|
||||
<label for="status-filter">{{ $L('Filter by status') }}</label> <i class="fas fa-filter"></i>
|
||||
<select class="form-control" id="status-filter">
|
||||
@ -62,6 +71,7 @@
|
||||
<th>{{ $L('Next best before date') }}</th>
|
||||
<th class="d-none">Hidden location</th>
|
||||
<th class="d-none">Hidden status</th>
|
||||
<th class="d-none">Hidden product group</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@ -103,6 +113,10 @@
|
||||
<td class="d-none">
|
||||
@if($currentStockEntry->best_before_date < date('Y-m-d', strtotime('-1 days')) && $currentStockEntry->amount > 0) expired @elseif($currentStockEntry->best_before_date < date('Y-m-d', strtotime("+$nextXDays days")) && $currentStockEntry->amount > 0) expiring @elseif (FindObjectInArrayByPropertyValue($missingProducts, 'id', $currentStockEntry->product_id) !== null) belowminstockamount @endif
|
||||
</td>
|
||||
@php $productGroup = FindObjectInArrayByPropertyValue($productGroups, 'id', FindObjectInArrayByPropertyValue($products, 'id', $currentStockEntry->product_id)->product_group_id) @endphp
|
||||
<td class="d-none">
|
||||
@if($productGroup !== null){{ $productGroup->name }}@endif
|
||||
</td>
|
||||
</tr>
|
||||
@endforeach
|
||||
</tbody>
|
||||
|
Loading…
x
Reference in New Issue
Block a user