@extends('layouts.admin') @section('page-title','Inventory') @section('topbar-actions') + Add Product @endsection @section('content') {{-- LOW STOCK ALERTS --}} @if($outStock->isNotEmpty())
🚨
{{ $outStock->count() }} product(s) are OUT OF STOCK: {{ $outStock->map(fn($p)=>$p->emoji.' '.$p->name)->join(', ') }}
@endif @if($lowStock->isNotEmpty())
⚠️
{{ $lowStock->count() }} product(s) running LOW (≤ threshold): {{ $lowStock->map(fn($p)=>$p->emoji.' '.$p->name.' ('.$p->stock.')')->join(', ') }}
@endif {{-- KPIs --}}
Total SKUs
{{ $summary['total'] }}
In Stock
{{ $summary['in_stock'] }}
Low Stock
{{ $summary['low_stock'] }}
Out of Stock
{{ $summary['out_of_stock'] }}
{{-- STOCK VALUE BY CATEGORY --}}
@foreach($stockByCategory as $cat)
{{ ucfirst($cat->category) }}
${{ number_format($cat->stock_value,2) }}
{{ number_format($cat->total_units) }} units at cost
@endforeach
{{-- FILTER + SEARCH --}}
@if($search)✕ Clear@endif
@foreach(['all'=>'All','good'=>'In Stock','low'=>'Low Stock','out'=>'Out of Stock'] as $val=>$label) {{ $label }} @endforeach
@forelse($products as $product) @php $status = $product->stock_status; $statusMap = ['in_stock'=>['green','In Stock'],'low_stock'=>['amber','Low Stock'],'out_of_stock'=>['red','Out of Stock']]; [$cls,$label] = $statusMap[$status]; $maxStock = 100; $pct = $maxStock > 0 ? min(100, round($product->stock / $maxStock * 100)) : 0; $barColor = $cls === 'red' ? 'var(--red)' : ($cls === 'amber' ? 'var(--amber)' : 'var(--green)'); @endphp @empty @endforelse
Product Category Cost Sale Price Margin Stock Level Status
{{ $product->emoji }} {{ $product->name }} {{ $product->category }} ${{ number_format($product->cost_price,2) }} ${{ number_format($product->price,2) }} {{ $product->margin_percent }}% {{ number_format($product->stock) }} units
threshold: {{ $product->low_stock_threshold }}
{{ $label }}
No products found.
{{ $products->links() }}
@endsection @push('modals') @endpush @push('scripts') @endpush