{{-- Header --}}

@if($invoiceGroupId) Invoice #{{ $invoiceGroupId }} @elseif($mode === 'create') New Invoice @else Import Invoice @endif

@if($this->currentInvoiceGroup) {{ ucfirst(str_replace('_', ' ', $this->currentInvoiceGroup->status)) }} @endif
@if($invoiceGroupId && $this->currentInvoiceGroup?->status === 'draft') @php $unshippedCount = $this->unshippedDropsCount; $hasDrops = count($selectedDrops) > 0; @endphp @if($unshippedCount > 0 && $hasDrops) @elseif($hasDrops) @endif @endif
{{-- Content --}}
{{-- Left Column: Invoice Details --}}

Invoice Details

{{-- Customer --}}
{{-- Reference --}}
{{-- Row: Date + Supplier Ref --}}
{{-- Notes --}}
{{-- File Upload Section --}}

Attachment (optional)

@if($this->currentInvoiceGroup?->invoice_file_path && !$invoiceFile)
{{ $this->currentInvoiceGroup->invoice_file_name }} {{ $this->currentInvoiceGroup->invoice_uploaded_at?->diffForHumans() }}
@elseif($invoiceFile)
{{ $invoiceFile->getClientOriginalName() }} {{ round($invoiceFile->getSize() / 1024) }} KB
@else @endif
@error('invoiceFile') {{ $message }} @enderror
{{-- Actions --}}
{{-- Right Column: Drops --}}

Drops @if(count($selectedDrops) > 0) {{ count($selectedDrops) }} @endif

@if($selectedCustomer && $this->availableDrops->isNotEmpty())
@endif
@if(!$selectedCustomer)

Select a customer first

@elseif($this->availableDrops->isEmpty())

No shipped drops available

Only shipped drops can be invoiced
@else {{-- Search --}} {{-- Drops List --}}
@foreach($this->availableDrops as $drop) @php $isSelected = in_array($drop->id, $selectedDrops); $order = $drop->line?->order; $line = $drop->line; @endphp
{{ $order?->customer_po ?? 'N/A' }} {{ $line?->imported_style_ref ?? 'N/A' }}
{{ $line?->imported_colour ?? $line?->colourway?->name ?? '—' }} {{ number_format($drop->total_shipped_qty ?: $drop->total_qty) }} pcs @if($drop->shipped_date) {{ $drop->shipped_date->format('d M') }} @endif
@endforeach
@endif {{-- Summary Footer --}} @if(count($selectedDrops) > 0 && $this->currentInvoiceGroup)
Total Quantity {{ number_format($this->currentInvoiceGroup->total_qty ?? 0) }}
Total Value £{{ number_format($this->currentInvoiceGroup->total_value ?? 0, 2) }}
@endif