mirror of
https://github.com/grocy/grocy.git
synced 2026-03-28 15:49:25 +01:00
#481 - stock overview works with hierarchic locations
This commit is contained in:
parent
49e134d5fe
commit
ea9234eaaf
|
|
@ -161,7 +161,8 @@ class StockController extends BaseController
|
|||
|
||||
return $this->renderPage($response, 'stockoverview', [
|
||||
'currentStock' => $this->getDatabase()->uihelper_stock_current_overview()->where($where),
|
||||
'locations' => $this->getDatabase()->locations()->where('active = 1')->orderBy('name', 'COLLATE NOCASE'),
|
||||
'locations' => $this->getDatabase()->locations_hierarchy()->where('active = 1')->orderBy('location_path', 'COLLATE NOCASE'),
|
||||
'locationsResolved' => $this->getDatabase()->locations_resolved(),
|
||||
'currentStockLocations' => $this->getStockService()->GetCurrentStockLocations(),
|
||||
'nextXDays' => $nextXDays,
|
||||
'productGroups' => $this->getDatabase()->product_groups()->where('active = 1')->orderBy('name', 'COLLATE NOCASE'),
|
||||
|
|
|
|||
|
|
@ -112,7 +112,7 @@
|
|||
id="location-filter">
|
||||
<option value="all">{{ $__t('All') }}</option>
|
||||
@foreach($locations as $location)
|
||||
<option value="{{ $location->name }}">{{ $location->name }}</option>
|
||||
<option value="{{ $location->name }}">{{ $location->location_path }}</option>
|
||||
@endforeach
|
||||
</select>
|
||||
</div>
|
||||
|
|
@ -377,7 +377,14 @@
|
|||
</td>
|
||||
<td class="d-none">
|
||||
@foreach(FindAllObjectsInArrayByPropertyValue($currentStockLocations, 'product_id', $currentStockEntry->product_id) as $locationsForProduct)
|
||||
xx{{ FindObjectInArrayByPropertyValue($locations, 'id', $locationsForProduct->location_id)->name }}xx
|
||||
@php
|
||||
// Include all ancestor locations for hierarchical filtering
|
||||
$ancestorMappings = FindAllObjectsInArrayByPropertyValue($locationsResolved, 'location_id', $locationsForProduct->location_id);
|
||||
@endphp
|
||||
@foreach($ancestorMappings as $ancestorMapping)
|
||||
@php $ancestorLocation = FindObjectInArrayByPropertyValue($locations, 'id', $ancestorMapping->ancestor_location_id); @endphp
|
||||
@if($ancestorLocation)xx{{ $ancestorLocation->name }}xx @endif
|
||||
@endforeach
|
||||
@endforeach
|
||||
</td>
|
||||
<td class="d-none">
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user