@extends('layouts.app') @section('title', __('Global stock')) @section('content') {{-- Summary cards --}}

{{ __('Total quantity') }}

{{ number_format($totalQuantity) }}

{{ __('units in all stores') }}

{{ __('Stock value') }}

{{ money($totalValue) }}

{{ __('at purchase cost') }}

{{ __('Low stock') }}

{{ $lowStock }}

{{ __('Review items') }}

{{ __('Expiring soon') }}

{{ $expiringSoon }}

{{ __('View batches') }}
{{-- Per-store breakdown --}}

{{ __('Stock by store') }}

@forelse ($stores as $store)

{{ $store['name'] }}

{{ $store['type'] === 'warehouse' ? __('Warehouse') : __('POS') }}

{{ number_format($store['quantity']) }}

{{ __('units') }}

{{ $store['products'] }} {{ __('products') }} {{ money($store['value']) }}
@empty
{{ __('No stores configured.') }}
@endforelse
{{-- Per-product global table --}}

{{ __('Stock by product') }}

@foreach ($stores as $store) @endforeach @forelse ($products as $product) @php $perStore = $stockByProduct[$product->id] ?? collect(); @endphp @foreach ($stores as $store) @php $row = $perStore->firstWhere('store_id', $store['id']); $quantity = (int) ($row->total ?? 0); @endphp @endforeach @empty @endforelse
{{ __('Product') }} {{ __('Category') }}{{ $store['name'] }}{{ __('Total stock') }} {{ __('Minimum') }} {{ __('Status') }}
{{ $product->name }} @if ($product->barcode){{ $product->barcode }}@endif {{ $product->category?->name ?? '—' }}{{ number_format($quantity) }}{{ (int) $product->total_quantity }} {{ $product->min_stock }} @if ((int) $product->total_quantity <= $product->min_stock) {{ __('Low') }} @else {{ __('OK') }} @endif
{{ __('No products found.') }}

{{ __('The total is the sum of every store: a transfer between two stores does not change it, only the per-store columns.') }}

{{ $products->links() }}
@endsection