mirror of
https://github.com/grocy/grocy.git
synced 2026-04-09 14:06:16 +02: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', [
|
return $this->renderPage($response, 'stockoverview', [
|
||||||
'currentStock' => $this->getDatabase()->uihelper_stock_current_overview()->where($where),
|
'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(),
|
'currentStockLocations' => $this->getStockService()->GetCurrentStockLocations(),
|
||||||
'nextXDays' => $nextXDays,
|
'nextXDays' => $nextXDays,
|
||||||
'productGroups' => $this->getDatabase()->product_groups()->where('active = 1')->orderBy('name', 'COLLATE NOCASE'),
|
'productGroups' => $this->getDatabase()->product_groups()->where('active = 1')->orderBy('name', 'COLLATE NOCASE'),
|
||||||
|
|
|
||||||
|
|
@ -112,7 +112,7 @@
|
||||||
id="location-filter">
|
id="location-filter">
|
||||||
<option value="all">{{ $__t('All') }}</option>
|
<option value="all">{{ $__t('All') }}</option>
|
||||||
@foreach($locations as $location)
|
@foreach($locations as $location)
|
||||||
<option value="{{ $location->name }}">{{ $location->name }}</option>
|
<option value="{{ $location->name }}">{{ $location->location_path }}</option>
|
||||||
@endforeach
|
@endforeach
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
|
|
@ -377,7 +377,14 @@
|
||||||
</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)
|
||||||
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
|
@endforeach
|
||||||
</td>
|
</td>
|
||||||
<td class="d-none">
|
<td class="d-none">
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user