{{-- Title Bar --}} ASOS Packing List Import - Waltz Fashion
Upload ASOS Packing List PDFs
@if (Session::get('message')) @endif @if($errors->all()) @endif
{{-- File Upload Section --}} @if(!$showPreview)
Maximum 30 files allowed. Supported format: PDF
@if($processingFiles)
Processing files... Please wait.
@endif
@endif {{-- Preview Table Section --}} @if($showPreview && !empty($previewData))
Review Extracted Data
Please review the extracted data and database matches before confirming
{{-- Summary Section --}}
Processing Summary

Files Processed: {{ count($previewData) }}

Database Matches: {{ collect($previewData)->where('db_matches.found', true)->count() }}

Files with Changes: {{ collect($previewData)->filter(fn($data) => $this->hasChanges($data))->count() }}

Total ASNs Found: {{ collect($previewData)->sum(fn($data) => count($data['asn_numbers'] ?? [])) }}

Next Steps
  1. Review the extracted data below
  2. Verify database matches are correct
  3. Check that changes look accurate
  4. Click "Confirm & Save Changes" when ready
@foreach($previewData as $index => $data)
{{ $data['filename'] }}
{{-- File Summary --}}
PO Number {{ $data['po_number'] ?? 'Not found' }}
Factory Invoice {{ $data['factory_invoice'] ?? 'Not found' }}
ExFty Date {{ $data['exfty'] ?? 'Not found' }}
ASN Numbers @if(!empty($data['asn_numbers']) && count($data['asn_numbers']) > 0) @foreach($data['asn_numbers'] as $index => $asn)
{{ $asn }}
@endforeach @else Not found @endif
{{-- ASN Summary --}} @if(!empty($data['asn_numbers']) && count($data['asn_numbers']) > 0)
{{ count($data['asn_numbers']) }} ASN(s) found: @foreach($data['asn_numbers'] as $index => $asn) {{ $asn }} @endforeach
@endif {{-- Debug Information --}} @if(config('app.debug'))
Debug Information

Data Keys: {{ json_encode(array_keys($data)) }}

ASN Data Count: {{ count($data['asn_data'] ?? []) }}

ASN Numbers: {{ json_encode($data['asn_numbers'] ?? []) }}

Has ASN Data: {{ !empty($data['asn_data']) ? 'Yes' : 'No' }}

@if(!empty($data['asn_data']))

ASN Data Structure:

{{ json_encode($data['asn_data'], JSON_PRETTY_PRINT) }}
@endif

Full Data Structure:

{{ json_encode($data, JSON_PRETTY_PRINT) }}
@endif {{-- Database Match Status --}} @if(!empty($data['db_matches']) && $data['db_matches']['found'])
Database match found for PO: {{ $data['db_matches']['customer_po'] ?? 'Unknown' }}
@if($this->hasChanges($data))
Changes detected! Review the data below before confirming.
@else
No changes detected. All data matches current database values.
@endif {{-- ASN Breakdown Section --}} @if(count($data['asn_numbers']) > 0)
ASN Breakdown
@foreach($data['asn_numbers'] as $asn)
ASN: {{ $asn }} ASN #{{ $loop->iteration }}
{{-- Safety check for db_matches --}} @if(!empty($data['db_matches']) && $data['db_matches']['found']) {{-- Database comparison table --}}
ASN Data Comparison
Field Current (Database) New (PDF) Status
Net Weight (kg) {!! $this->formatCurrentValue($data['db_matches']['current_data']['net_weight'] ?? null) !!} {{ $data['asn_data'][$loop->index]['net_weight'] ?: 'Not found' }} @if(($data['db_matches']['current_data']['net_weight'] ?? null) != ($data['asn_data'][$loop->index]['net_weight'] ?? null)) Will Update @else No Change @endif
Gross Weight (kg) {!! $this->formatCurrentValue($data['db_matches']['current_data']['gross_weight'] ?? null) !!} {{ $data['asn_data'][$loop->index]['gross_weight'] ?: 'Not found' }} @if(($data['db_matches']['current_data']['gross_weight'] ?? null) != ($data['asn_data'][$loop->index]['gross_weight'] ?? null)) Will Update @else No Change @endif
Carton Count {!! $this->formatCurrentValue($data['db_matches']['current_data']['no_cartons'] ?? null) !!} {{ $data['asn_data'][$loop->index]['carton_count'] ?: 'Not found' }} @if(($data['db_matches']['current_data']['no_cartons'] ?? null) != ($data['asn_data'][$loop->index]['carton_count'] ?? null)) Will Update @else No Change @endif
ExFty Date {!! $this->formatCurrentValue($data['db_matches']['current_data']['exfty'] ?? null) !!} {{ $data['asn_data'][$loop->index]['date'] ?: 'Not found' }} @if(($data['db_matches']['current_data']['exfty'] ?? null) != ($data['asn_data'][$loop->index]['date'] ?? null)) Will Update @else No Change @endif
Factory Invoice {!! $this->formatCurrentValue($data['db_matches']['current_data']['factory_invoice'] ?? null) !!} {{ $data['asn_data'][$loop->index]['factory_invoice'] ?: 'Not found' }} @if(($data['db_matches']['current_data']['factory_invoice'] ?? null) != ($data['asn_data'][$loop->index]['factory_invoice'] ?? null)) Will Update @else No Change @endif
ASN Numbers {!! $this->formatAsnNumbers($data['db_matches']['current_data']['asn'] ?? []) !!} @if(!empty($data['asn_numbers'])) @foreach($data['asn_numbers'] as $asn)
{{ $asn }}
@endforeach @else No ASN numbers found @endif
@php $currentAsns = $data['db_matches']['current_data']['asn'] ?? []; $newAsns = $data['asn_numbers'] ?? []; sort($currentAsns); sort($newAsns); $asnChanged = $currentAsns != $newAsns; @endphp @if($asnChanged) Will Update @else No Change @endif
@else {{-- No database match found --}}
No database match found - This appears to be new data that will be created.
@endif {{-- Size Breakdown for this ASN --}} @if(!empty($data['asn_data'][$loop->index]['sizes']))
Size Breakdown
@foreach($data['asn_data'][$loop->index]['sizes'] as $sizeData) @php // Find matching size in database for comparison $sizeMatch = collect($data['db_matches']['size_matches'] ?? [])->firstWhere('size', $sizeData['size']); $currentQty = $sizeMatch['current_qty'] ?? 0; $found = $sizeMatch['found'] ?? false; @endphp @endforeach
Size Current Qty New Qty Composition Status
{{ $sizeData['size'] }} {{ $currentQty }} {{ $sizeData['quantity'] }} {{ $sizeMatch['composition'] ?? 'Not found' }} @if($found) @if($currentQty != $sizeData['quantity']) Will Update @else No Change @endif @else Size Not Found @endif
@else
No size information found for this ASN.
@endif
@endforeach @else {{-- Fallback: Show global data when ASN-specific data is not available --}}
ASN-specific data not available. Showing global extracted data instead.
Global Data (Fallback)
Global Data Comparison
Field Current Value New Value Status
Net Weight (kg) {!! $this->formatCurrentValue($data['db_matches']['current_data']['net_weight'] ?? null) !!} {{ $data['net_weight'] ?: 'Not found' }} @if(($data['db_matches']['current_data']['net_weight'] ?? null) != ($data['net_weight'] ?? null)) Will Update @else No Change @endif
Gross Weight (kg) {!! $this->formatCurrentValue($data['db_matches']['current_data']['gross_weight'] ?? null) !!} {{ $data['gross_weight'] ?: 'Not found' }} @if(($data['db_matches']['current_data']['gross_weight'] ?? null) != ($data['gross_weight'] ?? null)) Will Update @else No Change @endif
Carton Count {!! $this->formatCurrentValue($data['db_matches']['current_data']['no_cartons'] ?? null) !!} {{ $data['no_cartons'] ?: 'Not found' }} @if(($data['db_matches']['current_data']['no_cartons'] ?? null) != ($data['no_cartons'] ?? null)) Will Update @else No Change @endif
@if(!empty($data['sizes']))
Global Size Breakdown
@foreach($data['sizes'] as $size) @php $sizeMatch = collect($data['db_matches']['size_matches'] ?? [])->firstWhere('size', $size['size']); $currentQty = $sizeMatch['current_qty'] ?? 0; $found = $sizeMatch['found'] ?? false; @endphp @endforeach
Size Current Qty New Qty Composition Status
{{ $size['size'] }} {{ $currentQty }} {{ $size['qty'] ?? $size['quantity'] ?? 'Not found' }} {{ $size['composition'] ?: 'Not found' }} @if($found) @if($currentQty != ($size['qty'] ?? $size['quantity'] ?? 0)) Will Update @else No Change @endif @else Size Not Found @endif
@endif
@endif
@endforeach @endif {{-- Action Buttons --}}
@php $filesWithChanges = collect($previewData)->filter(fn($data) => $this->hasChanges($data))->count(); $totalFiles = count($previewData); @endphp @if($filesWithChanges > 0)
{{ $filesWithChanges }} of {{ $totalFiles }} files have changes
@endif
@endif @script @endscript