@if (session()->has('message'))
{{ session('message') }}
@endif @if (session()->has('error'))
{{ session('error') }}
@endif

Manage All Product Stocks

Edit stock quantities for all products inline without page refresh

@forelse($products as $product)

{{ $product->name }}

@if($product->brand) Brand: {{ $product->brand->name }} @endif @if($product->style) Style: {{ $product->style }} @endif @if($product->category) Category: {{ $product->category->name }} @endif
@if($editingProductId === $product->id)
@else @endif
@if($editingProductId === $product->id)
@if($product->category && $product->category->sizeGroup && $product->category->sizeGroup->sizes->count() > 0)
@foreach($product->category->sizeGroup->sizes->sortBy('sort_order') as $size)
@endforeach
@else

This product doesn't have a category with sizes assigned.

@endif
@else
@if($product->category && $product->category->sizeGroup && $product->category->sizeGroup->sizes->count() > 0) @php $sizes = $product->category->sizeGroup->sizes->sortBy('sort_order'); $existingStocks = $product->stocks->keyBy('size_id'); $hasStocks = $existingStocks->count() > 0; @endphp @if($hasStocks)
@foreach($sizes as $size) @php $stockRecord = $existingStocks->get($size->id); $quantity = $stockRecord ? $stockRecord->quantity : 0; @endphp
{{ $size->name }}: {{ $quantity }}
@endforeach
@else

No stock data available

@endif @else

No sizes available

@endif
@endif
@empty

No Products Found

Products with categories and size groups will appear here

@endforelse @if($products->hasPages())
{{ $products->links() }}
@endif