@extends('layouts.app') @section('title', 'Inventory Report') @section('content')
Inventory Report Viewing: {{ request('location_type') ? ucfirst(str_replace('_', ' ', request('location_type'))) : 'All Locations' }}
Total Inventory Value ({{ request('location_type') ? str_replace('_', ' ', request('location_type')) : 'All' }})

{{ number_format($totalValue, 2) }} LKR

Total Stock Quantity ({{ request('location_type') ? str_replace('_', ' ', request('location_type')) : 'All' }})

{{ number_format($totalQuantity) }}

Total SKUs in Stock ({{ request('location_type') ? str_replace('_', ' ', request('location_type')) : 'All' }})

{{ $totalSKUs }}

Reset
@php $isAllLocations = !request()->filled('location_type') && !request()->filled('location_id'); $hasProductFilter = request()->filled('product_id') || request()->filled('category'); // Group inventory if product filter is active $displayItems = $hasProductFilter ? $inventory->groupBy('location_type') : ['all' => $inventory]; @endphp @forelse($displayItems as $type => $items) @if($hasProductFilter && $items->count() > 0) @endif @foreach($items as $item) @endforeach @empty @endforelse
Product Name SKU Location Quantity Total Value
{{ str_replace('_', ' ', $type) }}s
{{ $item->product->name ?? 'Unknown' }}
{{ $item->product->category ?? '-' }}
{{ $item->product->code ?? '-' }} @if($isAllLocations && !request()->filled('product_id'))
Combined Stock
Across All Locations
@else
@php $iconColor = 'text-muted'; $icon = 'fa-map-pin'; $locationName = $item->location->name ?? null; if ($item->location_type == 'warehouse' || $item->location_type == 'distribution_center') { $iconColor = 'text-primary'; $icon = 'fa-warehouse'; $locationName = $locationName ?? ($warehouseMap[$item->location_id] ?? 'Warehouse'); } elseif ($item->location_type == 'distribution_point') { $iconColor = 'text-success'; $icon = 'fa-truck-ramp-box'; $locationName = $locationName ?? ($dpMap[$item->location_id] ?? 'Distribution Point'); } elseif ($item->location_type == 'outlet') { $iconColor = 'text-info'; $icon = 'fa-store'; $locationName = $locationName ?? ($outletMap[$item->location_id] ?? 'Outlet'); } @endphp
{{ $locationName }}
{{ str_replace('_', ' ', $item->location_type) }} @if($item->location_type == 'outlet' && isset($item->location->rt_code)) • {{ $item->location->rt_code }} @endif
@endif
{{ number_format($item->quantity) }} {{ number_format($item->quantity * ($item->product->unit_price ?? 0), 2) }}

No inventory records found.

Showing {{ $inventory->firstItem() ?? 0 }} to {{ $inventory->lastItem() ?? 0 }} of {{ $inventory->total() }} records
{{ $inventory->appends(request()->query())->links() }}
@endsection @push('js') @endpush