{{-- Stock Adjustments - Modern Design with Color-Coded Actions --}}
@if(session('success'))
✅ {{ session('success') }}
@endif @if(session('error'))
❌ {{ session('error') }}
@endif @if($errors->any())
Please fix the following errors:
@endif

⚖️ Adjust Stock Level

@csrf
📦 Select Product
@foreach($products as $product) @php $img = $product->images->where('is_primary', true)->first(); if(!$img) $img = $product->images->first(); $imgUrl = $img ? asset('storage/' . $img->image_path) : null; $totalStock = $product->stockLevels->sum('qty'); $variationsData = []; foreach($product->variations as $v) { $vImg = $v->image_path ? asset('storage/' . $v->image_path) : null; $vColor = null; if($v->attributeValues && $v->attributeValues->count() > 0) { $firstAttr = $v->attributeValues->first(); $vColor = $firstAttr ? $firstAttr->color_code : null; } $vName = $v->variation_name; if (!$vName && $v->attributeValues) { $parts = []; foreach($v->attributeValues as $av) { $parts[] = $av->value; } $vName = implode(' / ', $parts); } if (!$vName) $vName = $v->sku; $variationsData[] = [ 'id' => $v->id, 'sku' => $v->sku, 'name' => $vName, 'stock' => $v->stockLevels ? $v->stockLevels->sum('qty') : 0, 'purchase_price' => $v->purchase_price, 'sale_price' => $v->sale_price, 'effective_purchase' => $v->purchase_price ?? $product->purchase_price ?? 0, 'effective_sale' => $v->sale_price ?? $product->sale_price ?? 0, 'image' => $vImg, 'color' => $vColor ]; } $hasRealVariants = count($variationsData) > 0; @endphp
@if($imgUrl) @else
{{ strtoupper(substr($product->name, 0, 2)) }}
@endif
{{ $product->name }}
{{ $product->sku }} @if($product->is_batch_managed)Batch@endif @if($hasRealVariants){{ count($variationsData) }} Variants@endif
{{ number_format($totalStock, 0) }}
{{ $product->unit->short_name ?? 'PCS' }}
@endforeach
No products found
🎨 Select Variation: *
Purchase
₹0
Product
Sale
₹0
Product
Stock
0
PCS
Unit
-
Base Unit
🏷️ Select Lot to Adjust
🏷️
₹0
Purchase
₹0
Sale
📍 Location
Current Stock at This Location
0 PCS
⚖️ Adjustment Details
🎯
Set Exact
Set stock to this value
Add
Add to current stock
Subtract
Remove from stock
Cancel