mirror of
https://github.com/grocy/grocy.git
synced 2025-04-29 09:39:57 +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'),
|
'locations' => $this->Database->locations()->orderBy('name'),
|
||||||
'currentStock' => $this->StockService->GetCurrentStock(),
|
'currentStock' => $this->StockService->GetCurrentStock(),
|
||||||
'missingProducts' => $this->StockService->GetMissingProducts(),
|
'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',
|
'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',
|
'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',
|
'No picture available' => 'Kein Bild vorhanden',
|
||||||
|
'Filter by product group' => 'Nach Produktgruppe filtern',
|
||||||
|
|
||||||
//Constants
|
//Constants
|
||||||
'manually' => 'Manuell',
|
'manually' => 'Manuell',
|
||||||
|
@ -31,6 +31,17 @@ $("#location-filter").on("change", function()
|
|||||||
stockOverviewTable.column(4).search(value).draw();
|
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()
|
$("#status-filter").on("change", function()
|
||||||
{
|
{
|
||||||
var value = $(this).val();
|
var value = $(this).val();
|
||||||
|
@ -36,6 +36,15 @@
|
|||||||
@endforeach
|
@endforeach
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</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">
|
<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>
|
<label for="status-filter">{{ $L('Filter by status') }}</label> <i class="fas fa-filter"></i>
|
||||||
<select class="form-control" id="status-filter">
|
<select class="form-control" id="status-filter">
|
||||||
@ -62,6 +71,7 @@
|
|||||||
<th>{{ $L('Next best before date') }}</th>
|
<th>{{ $L('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>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
@ -103,6 +113,10 @@
|
|||||||
<td class="d-none">
|
<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
|
@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>
|
</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>
|
</tr>
|
||||||
@endforeach
|
@endforeach
|
||||||
</tbody>
|
</tbody>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user