{{-- Line Editor Component --}} @if($this->activeLine)
{{-- Line Header --}}
@if($this->activeLine->colourways->style_versions->image_base64) Item @else
@endif
{{ $this->activeLine->colourways->style_versions->styles->designs_id ?? 'N/A' }} @if($this->activeLine->cancelled) Cancelled @endif
Customer Ref: {{ $this->activeLine->colourways->style_versions->styles->customer_ref ?? 'N/A' }}
Style: {{ $this->activeLine->colourways->style_versions->name ?? 'N/A' }}
Colourway: {{ $this->activeLine->colourways->name ?? 'N/A' }}
Factory: {{ $this->activeLine->colourways->style_versions->factories->name ?? 'N/A' }}
{{-- Line Tabs --}} {{-- Dates & Quantities Tab --}}
{{-- Date Fields --}}
@php $totalDrops = $this->activeLine->shipment_lines->count() + ($this->pendingDrops[$this->activeLine->id] ?? 0); @endphp @if($totalDrops === 1 && $this->activeLine->shipment_lines->count() === 1) {{-- Show ExFty when there's exactly 1 drop (and it exists) --}} @php $singleDrop = $this->activeLine->shipment_lines->first(); @endphp
readOnly) disabled @endif>
@endif
readOnly) disabled @endif>
readOnly) disabled @endif>
readOnly) disabled @endif>
{{-- Size Management Actions --}} @if(!$this->readOnly)
@endif {{-- Quantities Table --}}
@foreach($this->activeLine->customer_order_line_quantities->sortBy('sizes.order') as $qty) @php $markedForDeletion = isset($this->pendingSizeRemovals[$this->activeLine->id]) && in_array($qty->id, $this->pendingSizeRemovals[$this->activeLine->id]); @endphp @endforeach {{-- Pending Sizes --}} @if(isset($this->pendingSizes[$this->activeLine->id])) @foreach($this->pendingSizes[$this->activeLine->id] as $tempId => $sizeData) @endforeach @endif {{-- Price Row (Wholesale) --}} @if($this->order && $this->order->order_type === 'wholesale') @php $prices = $this->activeLine->colourways->style_versions->prices ?? collect(); // Batch load all prices that are referenced $priceIds = $this->activeLine->customer_order_line_quantities->pluck('prices_id')->filter()->unique()->values(); $loadedPrices = $priceIds->isNotEmpty() ? \App\Models\Price::whereIn('id', $priceIds)->get()->keyBy('id') : collect(); @endphp @foreach($this->activeLine->customer_order_line_quantities->sortBy('sizes.order') as $qty) @php $markedForDeletion = isset($this->pendingSizeRemovals[$this->activeLine->id]) && in_array($qty->id, $this->pendingSizeRemovals[$this->activeLine->id]); $currentPriceQuote = null; if ($qty->prices_id && $loadedPrices->has($qty->prices_id)) { $currentPriceQuote = $loadedPrices[$qty->prices_id]->quote; } elseif ($qty->price_model && isset($qty->price_model['quote'])) { $currentPriceQuote = $qty->price_model['quote']; } @endphp @endforeach {{-- Pending Sizes --}} @if(isset($this->pendingSizes[$this->activeLine->id])) @foreach($this->pendingSizes[$this->activeLine->id] as $tempId => $sizeData) @endforeach @endif @endif {{-- Commission Order Fields --}} @if($this->order && $this->order->order_type === 'commission') @foreach($this->activeLine->customer_order_line_quantities->sortBy('sizes.order') as $qty) @php $markedForDeletion = isset($this->pendingSizeRemovals[$this->activeLine->id]) && in_array($qty->id, $this->pendingSizeRemovals[$this->activeLine->id]); @endphp @endforeach {{-- Pending Sizes --}} @if(isset($this->pendingSizes[$this->activeLine->id])) @foreach($this->pendingSizes[$this->activeLine->id] as $tempId => $sizeData) @endforeach @endif @foreach($this->activeLine->customer_order_line_quantities->sortBy('sizes.order') as $qty) @php $markedForDeletion = isset($this->pendingSizeRemovals[$this->activeLine->id]) && in_array($qty->id, $this->pendingSizeRemovals[$this->activeLine->id]); @endphp @endforeach {{-- Pending Sizes --}} @if(isset($this->pendingSizes[$this->activeLine->id])) @foreach($this->pendingSizes[$this->activeLine->id] as $tempId => $sizeData) @endforeach @endif @foreach($this->activeLine->customer_order_line_quantities->sortBy('sizes.order') as $qty) @php $markedForDeletion = isset($this->pendingSizeRemovals[$this->activeLine->id]) && in_array($qty->id, $this->pendingSizeRemovals[$this->activeLine->id]); @endphp @endforeach {{-- Pending Sizes --}} @if(isset($this->pendingSizes[$this->activeLine->id])) @foreach($this->pendingSizes[$this->activeLine->id] as $tempId => $sizeData) @endforeach @endif @endif {{-- Ordered Row --}} @foreach($this->activeLine->customer_order_line_quantities->sortBy('sizes.order') as $qty) @php $markedForDeletion = isset($this->pendingSizeRemovals[$this->activeLine->id]) && in_array($qty->id, $this->pendingSizeRemovals[$this->activeLine->id]); @endphp @endforeach {{-- Pending Sizes --}} @if(isset($this->pendingSizes[$this->activeLine->id])) @foreach($this->pendingSizes[$this->activeLine->id] as $tempId => $sizeData) @endforeach @endif {{-- Drops Section --}} @if($totalDrops === 1 && $this->activeLine->shipment_lines->count() === 1) {{-- Single Drop - Show only Packed row --}} @php $drop = $this->activeLine->shipment_lines->first(); @endphp @foreach($this->activeLine->customer_order_line_quantities->sortBy('sizes.order') as $qty) @php $dropQty = $drop->shipment_line_sizes->where('sizes_id', $qty->sizes_id)->first(); @endphp @endforeach {{-- Pending Sizes --}} @if(isset($this->pendingSizes[$this->activeLine->id])) @foreach($this->pendingSizes[$this->activeLine->id] as $tempId => $sizeData) @endforeach @endif @elseif($totalDrops > 1) {{-- Multiple Drops - Show full drop headers --}} @foreach($this->activeLine->shipment_lines as $drop) @php $pendingSizeCount = isset($this->pendingSizes[$this->activeLine->id]) ? count($this->pendingSizes[$this->activeLine->id]) : 0; @endphp @foreach($this->activeLine->customer_order_line_quantities->sortBy('sizes.order') as $qty) @php $dropQty = $drop->shipment_line_sizes->where('sizes_id', $qty->sizes_id)->first(); @endphp @endforeach {{-- Pending Sizes - not applicable to existing drops --}} @if(isset($this->pendingSizes[$this->activeLine->id])) @foreach($this->pendingSizes[$this->activeLine->id] as $tempId => $sizeData) @endforeach @endif @foreach($this->activeLine->customer_order_line_quantities->sortBy('sizes.order') as $qty) @php $dropQty = $drop->shipment_line_sizes->where('sizes_id', $qty->sizes_id)->first(); @endphp @endforeach {{-- Pending Sizes - not applicable to existing drops --}} @if(isset($this->pendingSizes[$this->activeLine->id])) @foreach($this->pendingSizes[$this->activeLine->id] as $tempId => $sizeData) @endforeach @endif @endforeach {{-- Pending Drops --}} @if(isset($this->pendingDrops[$this->activeLine->id]) && $this->pendingDrops[$this->activeLine->id] > 0) @for($i = 0; $i < $this->pendingDrops[$this->activeLine->id]; $i++) @foreach($this->activeLine->customer_order_line_quantities->sortBy('sizes.order') as $qty) @endforeach @foreach($this->activeLine->customer_order_line_quantities->sortBy('sizes.order') as $qty) @endforeach @endfor @endif @else {{-- No Drops Yet --}} @foreach($this->activeLine->customer_order_line_quantities->sortBy('sizes.order') as $qty) @endforeach {{-- Pending Sizes --}} @if(isset($this->pendingSizes[$this->activeLine->id])) @foreach($this->pendingSizes[$this->activeLine->id] as $tempId => $sizeData) @endforeach @endif @endif {{-- SKU Row --}} @foreach($this->activeLine->customer_order_line_quantities->sortBy('sizes.order') as $qty) @php $markedForDeletion = isset($this->pendingSizeRemovals[$this->activeLine->id]) && in_array($qty->id, $this->pendingSizeRemovals[$this->activeLine->id]); @endphp @endforeach {{-- Pending Sizes - SKU not editable until saved --}} @if(isset($this->pendingSizes[$this->activeLine->id])) @foreach($this->pendingSizes[$this->activeLine->id] as $tempId => $sizeData) @endforeach @endif {{-- Barcode Row --}} @foreach($this->activeLine->customer_order_line_quantities->sortBy('sizes.order') as $qty) @php $markedForDeletion = isset($this->pendingSizeRemovals[$this->activeLine->id]) && in_array($qty->id, $this->pendingSizeRemovals[$this->activeLine->id]); @endphp @endforeach {{-- Pending Sizes - Barcode not editable until saved --}} @if(isset($this->pendingSizes[$this->activeLine->id])) @foreach($this->pendingSizes[$this->activeLine->id] as $tempId => $sizeData) @endforeach @endif
Size @if(!$this->readOnly)
@if($markedForDeletion) @else @endif
@if($markedForDeletion) Will be deleted @endif @else {{ $qty->sizes->name }} @endif
@if(!$this->readOnly)
Pending @else {{ $sizeData['size_name'] }} @endif
Total
Price
Price readOnly || $markedForDeletion) disabled @endif> readOnly) disabled @endif>
Commission % readOnly || $markedForDeletion) disabled @endif> readOnly) disabled @endif>
Discount % readOnly || $markedForDeletion) disabled @endif> readOnly) disabled @endif>
Ordered readOnly || $markedForDeletion) disabled @endif> readOnly) disabled @endif> @php $savedTotal = $this->activeLine->customer_order_line_quantities->sum('qty'); $pendingTotal = isset($this->pendingSizes[$this->activeLine->id]) ? array_sum(array_column($this->pendingSizes[$this->activeLine->id], 'qty')) : 0; @endphp {{ $savedTotal + $pendingTotal }}
Packed readOnly) disabled @endif> {{ $drop->shipment_line_sizes->sum('shipped_qty') }}
Drop {{ $loop->iteration }}
readOnly) disabled @endif> @if(!$this->readOnly) @endif
Dropping readOnly) disabled @endif> {{ $drop->shipment_line_sizes->sum('qty') }}
Packed readOnly) disabled @endif> {{ $drop->shipment_line_sizes->sum('shipped_qty') }}
Drop {{ $this->activeLine->shipment_lines->count() + $i + 1 }} (Pending - Save to Create)
readOnly) disabled @endif> @if(!$this->readOnly) @endif
Dropping readOnly) disabled @endif> {{ array_sum($this->pendingDropData[$this->activeLine->id][$i]['dropping'] ?? []) }}
Packed readOnly) disabled @endif> {{ array_sum($this->pendingDropData[$this->activeLine->id][$i]['packed'] ?? []) }}
Dropping readOnly) disabled @endif> readOnly) disabled @endif> @php $savedTotal = $this->activeLine->customer_order_line_quantities->sum('qty'); $pendingTotal = isset($this->pendingSizes[$this->activeLine->id]) ? array_sum(array_column($this->pendingSizes[$this->activeLine->id], 'qty')) : 0; @endphp {{ $savedTotal + $pendingTotal }}
SKU readOnly || $markedForDeletion) disabled @endif>
Barcode readOnly || $markedForDeletion) disabled @endif>
{{-- Notes Tab --}}
@endif