Commission Order Import

{{-- Session Messages --}} @if(session()->has('message'))
{{ session('message') }}
@endif {{-- Customer and Season Selection --}}
@error('selectedCustomer')
{{ $message }}
@enderror
@error('selectedSeason')
{{ $message }}
@enderror @if(!empty($selectedSeason)) @if(!empty($extractedData['metadata']['detected_season'])) Auto-detected: {{ $extractedData['metadata']['detected_season'] }} @else Season manually selected @endif @else Will auto-detect from document content @endif
{{-- File Upload --}} @if(!empty($selectedCustomer))
@error('orderFiles')
{{ $message }}
@enderror @error('orderFiles.*')
{{ $message }}
@enderror Supported formats: PDF, Excel (.xlsx, .xls). Max 10MB per file. @if(!empty($orderFiles))
Selected Files:
    @foreach($orderFiles as $file)
  • {{ $file->getClientOriginalName() }} ({{ number_format($file->getSize() / 1024, 1) }} KB)
  • @endforeach
@endif
{{-- Action Buttons --}}
@else
Please select a customer to continue.
@endif {{-- Processing Status --}} @if($isProcessing)
Processing files, please wait...
@endif {{-- Validation Errors --}} @if(!empty($validationErrors))
Validation Errors
    @foreach($validationErrors as $error)
  • {{ $error }}
  • @endforeach
@endif {{-- Duplicate PO Resolution --}} @if(!empty($duplicateOrders) && $showPreview)
Duplicate Purchase Orders Detected

Choose how to handle each duplicate PO:

@foreach($duplicateOrders as $po => $info) @endforeach
PO Number Existing Order ID Action
{{ $po }} {{ $info['existing_order_id'] }}
@endif {{-- Data Preview --}} @if($showPreview && !empty($extractedData))

Data Preview

{{-- Summary Stats --}}
{{ $extractedData['metadata']['files_processed'] ?? 0 }}

Files

{{ count($extractedData['orders'] ?? []) }}

Orders

{{ array_sum(array_map(fn($o) => count($o['lines'] ?? []), $extractedData['orders'] ?? [])) }}

Total Lines

Detected Season

@if(!empty($extractedData['metadata']['season_conflict'])) Conflict: {{ implode(', ', $extractedData['metadata']['all_detected_seasons'] ?? []) }} @else {{ $extractedData['metadata']['detected_season'] ?? 'None' }} @endif

Selected Season

@if(!empty($selectedSeason)) {{ $this->seasons->find($selectedSeason)?->description ?? 'Unknown' }} @else Not selected @endif

{{-- Multi-file Information --}} @if(!empty($extractedData['metadata']['filenames']) && count($extractedData['metadata']['filenames']) > 1)
Multiple Files Processed:
    @foreach($extractedData['metadata']['filenames'] as $filename)
  • {{ $filename }}
  • @endforeach
@endif {{-- Total Validation Warning --}} @if(!empty($extractedData['metadata']['total_warning']))
Quantity Mismatch Detected

{{ $extractedData['metadata']['total_warning'] }}

Gemini Extracted: {{ $extractedData['metadata']['gemini_total'] ?? 'N/A' }} units
File Shows: {{ $extractedData['metadata']['traditional_total'] ?? 'N/A' }} units
@endif {{-- Preview Table --}}
@forelse($this->getPreviewData() as $item) @empty @endforelse @if(!empty($this->getPreviewData())) @endif
PO Number Order Date Style Number Colour Ex-Factory Date Total Qty Size / Qty / Price Set All Prices
{{ $item['purchase_order'] }} {{ $item['order_date'] }} {{ $item['style_number'] }} {{ $item['colour_name'] }} {{ $item['customer_exfty_date'] }} {{ $item['total_qty'] }}
@foreach($item['quantities'] as $sizeIndex => $qty)
{{ $qty['size'] }} {{ $qty['qty'] }}
{{ $this->getCurrencySymbol() }}
@endforeach
{{ $this->getCurrencySymbol() }}
Avg: {{ $this->getCurrencySymbol() }}{{ $item['avg_price'] }}
No data to preview
GRAND TOTAL: {{ collect($this->getPreviewData())->sum('total_qty') }} {{ count($this->getPreviewData()) }} line(s)
{{-- Import Button --}} @if(empty($validationErrors))
@if(empty($selectedSeason)) Please select a season to import @endif @if(!empty($duplicateOrders)) Duplicate POs present. Ensure an action is chosen for each. @endif
@endif
@endif {{-- Import Results --}} @if(!empty($importResults))

Import Results

@if($importResults['success'])
Import Completed Successfully!
  • Orders Created: {{ $importResults['orders_created'] }}
  • Order Lines Created: {{ $importResults['lines_created'] }}
@else
Import Failed
    @foreach($importResults['errors'] as $error)
  • {{ $error }}
  • @endforeach
@endif
@endif
{{-- Loading Overlay --}} @if($isProcessing)
Processing...

Please wait while we process your files

@endif