@extends('admin.master') @section('content')

Add / Edit Stock – Container #{{ $container->container_no }}

Container Stock Management
View Container Back to List
{{-- Alerts --}} @if(session('success'))
{{ session('success') }}
@endif @if(session('error'))
{{ session('error') }}
@endif {{-- Product Tabs --}}
{{-- ==================== IMPORT CSV TAB ==================== --}}
Import Stock from CSV
@csrf
{{-- CSV Guideline (kept exactly as your original) --}}

{{ $products->first()->name ?? 'Polo Shirt' }}({{ $products->first()->product_code ?? 'Polo Shirt' }})

Required Columns (exact order):

Color xs s m l xl 2xl 3xl 4xl 5xl
Heather Grey 11232410085655701
Black 8824066420652110
White 65876405410513010
Navy 784543346510566554
Royal 45214012545454780
Charcoal 105582025200
Sapphire 1101254203802801705600
Yellow 150275440302201052900
Red 06342032022021025020
Kelly Green 2253738392035100
Sky 2024352035205200
Orange 65545895756575400
Maroon 545542424424200
Bottle Green 5775673442425400
Purple 222340250254320400105010

Note: Use the exact product names as shown below.

Products: @foreach($products as $product) {{ $product->name }}@if(!$loop->last), @endif @endforeach

{{--

Colors: Heather Grey, Black, White, Navy, Royal, Charcoal, Sapphire, Yellow, Red, Kelly Green, Sky, Orange, Maroon, Bottle Green, Purple

--}} {{--
Important: CSV import currently still uses the old static color list. Dynamic colors & sizes support for CSV will be added later.
--}}
{{-- End CSV Guideline --}}
{{-- ==================== DYNAMIC PRODUCT TABS ==================== --}} @foreach($products as $product) @php $productStock = $existingStock[$product->id] ?? collect(); $stockByColor = $productStock->keyBy('color'); $colors = $product->productColors; $sizes = $product->availableSizes; @endphp
@if($colors->isEmpty() || $sizes->isEmpty())
No Colors or Sizes defined for this product.
Please go to Product Edit and add Colors + Sizes first.
@else
@csrf
{{ $product->name }} ({{ $product->product_code }})
@foreach($sizes as $size) @endforeach @foreach($colors as $cIndex => $color) @php $item = $stockByColor[$color->color_name] ?? null; @endphp @foreach($sizes as $size) @php $qty = 0; if ($item) { // support both lowercase and original case keys from old data $key1 = strtolower($size->size); $key2 = $size->size; $qty = $item[$key1] ?? $item[$key2] ?? 0; } @endphp @endforeach @endforeach
Sr. Color SIZES Total
{{ $size->size }}
{{ $cIndex + 1 }}
{{ $color->color_name }}
0
Total 0
@endif
@endforeach
@endsection @push('js-script') @endpush