@extends('layouts.admin') @section('title','Inventory') @section('content') @php $columns = [ 'sku' => 'SKU / Product', 'location' => 'Location', 'on_hand' => 'On hand', 'available' => 'Available', 'committed' => 'Committed', 'incoming' => 'Incoming', 'threshold' => 'Threshold', 'status' => 'Status', 'actions' => 'Actions', ]; $label = fn (string $v) => ucwords(str_replace(['_', '-'], ' ', $v)); $statusTone = fn (string $s) => match ($s) { 'out' => 'danger', 'low' => 'warning', 'overstock' => 'info', default => 'success', }; $statusLabel = fn (string $s) => match ($s) { 'out' => 'Out of stock', 'low' => 'Low stock', 'overstock' => 'Overstock', default => 'In stock', }; $filterParams = array_filter([ 'location_id' => request('location_id'), 'q' => request('q'), 'sort' => request('sort'), ], fn ($v) => filled($v)); $activeChips = collect([ 'status' => request('status'), 'location_id' => request('location_id') ? ($locations->firstWhere('id', (int) request('location_id'))?->code ?? request('location_id')) : null, 'sort' => request('sort') && request('sort') !== 'sku' ? request('sort') : null, ])->filter(); @endphp Movements Transfers Stocktakes Export CSV
@csrf @if(request('location_id')) @endif
SKU levels {{ number_format($stats['skus']) }} {{ number_format($stats['locations']) }} active locations
Available {{ number_format($stats['available']) }} {{ number_format($stats['on_hand']) }} on hand · {{ number_format($stats['committed']) }} committed
Low stock {{ number_format($stats['low_stock']) }} At or below threshold Out of stock {{ number_format($stats['out_of_stock']) }} Available ≤ 0 Incoming {{ number_format($stats['incoming']) }} {{ number_format($stats['recent_moves']) }} moves / 24h
@foreach([ ['label' => 'All', 'params' => []], ['label' => 'In stock', 'params' => ['status' => 'in']], ['label' => 'Low', 'params' => ['status' => 'low']], ['label' => 'Out', 'params' => ['status' => 'out']], ['label' => 'Committed', 'params' => ['status' => 'committed']], ['label' => 'Incoming', 'params' => ['status' => 'incoming']], ['label' => 'Overstock', 'params' => ['status' => 'overstock']], ] as $chip) @php $params = array_merge($filterParams, $chip['params']); unset($params['status']); if (! empty($chip['params']['status'])) { $params['status'] = $chip['params']['status']; } $isActive = empty($chip['params']) ? ! request('status') : request('status') === ($chip['params']['status'] ?? null); @endphp {{ $chip['label'] }} @endforeach @foreach($locations as $location) {{ $location->code }} @endforeach
@if($activeChips->isNotEmpty())
Active @foreach($activeChips as $key => $value) {{ $label($key) }}: {{ $label((string) $value) }} @endforeach Clear all
@endif @if($errors->any())
{{ $errors->first() }}
@endif
Bulk adjust or set thresholds on selected levels. SKU / Product Location On hand Available Committed Incoming Threshold Status @forelse($levels as $level) @php $sku = $level->item?->sku ?? $level->item?->variant?->sku ?? '—'; $title = $level->item?->variant?->product?->title ?? 'Unlinked item'; $status = $level->stockStatus(); @endphp
{{ $sku }}
{{ $title }}
{{ $level->location?->code ?? '—' }}
{{ $level->location?->name }}
{{ number_format($level->on_hand) }} {{ number_format($level->available) }} {{ number_format($level->committed) }} {{ number_format($level->incoming) }} {{ number_format($level->low_stock_threshold) }} {{ $statusLabel($status) }} Manage @empty No inventory levels match these filters. @endforelse
{{ $levels->links() }}
@endsection