View Orders
{{-- Upload Form --}}

New Batch Import

{{-- Batch Name --}}
@error('batchName')
{{ $message }}
@enderror
{{-- Customer --}}
@error('customerId')
{{ $message }}
@enderror @if($this->selectedCustomer && $this->selectedCustomer->commission_gemini_instructions)
Custom instructions will be added to extraction
@endif
{{-- Season --}}
@error('seasonId')
{{ $message }}
@enderror
{{-- File Upload --}}

Drag & drop files here or click to browse

PDF, Excel, or CSV files (max 20MB each)
@error('files')
{{ $message }}
@enderror @error('files.*')
{{ $message }}
@enderror
{{-- File List --}} @if(count($files) > 0)
@foreach($files as $index => $file)
{{ $file->getClientOriginalName() }} {{ number_format($file->getSize() / 1024, 1) }} KB
@endforeach
@endif {{-- Submit --}}
{{-- Processing Notice --}}
Processing runs in background

Files are processed using AI. You'll receive an email when complete.

{{-- Recent Batches --}}

Recent Imports

@if($this->recentBatches->isEmpty())

No recent imports

@else
@foreach($this->recentBatches as $batch)
{{ $batch->batch_name }} {{ $batch->customer_name }}
@if($batch->status === 'pending') @elseif($batch->status === 'processing') @elseif($batch->status === 'completed') @elseif($batch->status === 'completed_with_warnings') @elseif($batch->status === 'failed') @endif {{ ucfirst(str_replace('_', ' ', $batch->status)) }} {{ $batch->created_at->diffForHumans() }}
{{ $batch->processed_files ?? 0 }}/{{ $batch->total_files }} @if($batch->failed_files > 0) {{ $batch->failed_files }} @endif
@if($batch->commission_orders_count > 0) {{ $batch->commission_orders_count }} {{ Str::plural('PO', $batch->commission_orders_count) }} @endif @if($batch->commissionOrder || $batch->commission_orders_count > 0) @endif
@endforeach
@endif
{{-- Backdrop for Side Panel --}} @if($showDetailModal)
@endif {{-- Detail Side Panel --}}
@if($showDetailModal && $this->detailBatch) {{-- Header --}}

{{ $this->detailBatch->batch_name }}

{{-- Content --}}
{{-- Batch Info --}}
Customer {{ $this->detailBatch->customer_name }}
Season {{ $this->detailBatch->season?->description ?? 'N/A' }}
Uploaded By {{ $this->detailBatch->user?->name ?? 'Unknown' }}
Uploaded {{ $this->detailBatch->created_at->format('d M Y H:i') }}
Status @if($this->detailBatch->status === 'completed_with_warnings') @endif {{ ucfirst(str_replace('_', ' ', $this->detailBatch->status)) }}
Progress {{ $this->detailBatch->processed_files ?? 0 }} / {{ $this->detailBatch->total_files }} files @if($this->detailBatch->failed_files > 0) ({{ $this->detailBatch->failed_files }} failed) @endif
@if($this->detailBatch->error_message)
Error

{{ $this->detailBatch->error_message }}

@endif
{{-- Files --}}

Files

@foreach($this->detailBatch->files as $file)
@if(Str::endsWith($file->original_filename, '.pdf')) @else @endif
{{ $file->original_filename }} @if($file->status === 'pending') Pending @elseif($file->status === 'processing') Processing @elseif($file->status === 'extracted') Extracted @elseif($file->status === 'matched') Matched @elseif($file->status === 'verified') Verified @elseif($file->status === 'completed') Completed @elseif($file->status === 'failed') Failed @endif
@if($file->status === 'failed') @endif
@if($file->error_message)
{{ $file->error_message }}
@endif @endforeach
{{-- AI Processing Results --}} @if($this->detailBatch->agent1_result || $this->detailBatch->agent2_result || $this->detailBatch->agent3_result)

AI Processing

@if($this->detailBatch->agent1_result)
Agent 1 (Extraction) {{ ucfirst($this->detailBatch->agent1_result['status'] ?? 'Pending') }} @if(isset($this->detailBatch->agent1_result['orders_found'])) {{ $this->detailBatch->agent1_result['orders_found'] }} orders found @endif
@endif @if($this->detailBatch->agent2_result)
Agent 2 (Matching) {{ ucfirst($this->detailBatch->agent2_result['status'] ?? 'Pending') }} @if(isset($this->detailBatch->agent2_result['matched_lines'])) {{ $this->detailBatch->agent2_result['matched_lines'] }}/{{ $this->detailBatch->agent2_result['total_lines'] ?? '?' }} matched @endif
@endif @if($this->detailBatch->agent3_result)
Agent 3 (Verification) {{ ucfirst($this->detailBatch->agent3_result['status'] ?? 'Pending') }} @if(isset($this->detailBatch->agent3_result['confidence'])) {{ $this->detailBatch->agent3_result['confidence'] }}% confidence @endif
@endif
@endif {{-- Created Orders --}} @if($this->detailBatch->commissionOrders->count() > 0)

Created Orders ({{ $this->detailBatch->commissionOrders->count() }})

@foreach($this->detailBatch->commissionOrders as $order)
{{ $order->customer_po }} #{{ $order->id }}
{{ ucfirst(str_replace('_', ' ', $order->status)) }} {{ $order->lines->count() }} lines
@endforeach
@elseif($this->detailBatch->commissionOrder) {{-- Fallback for legacy single order link --}}

Created Order

Order #{{ $this->detailBatch->commissionOrder->id }}
{{ ucfirst(str_replace('_', ' ', $this->detailBatch->commissionOrder->status)) }} {{ $this->detailBatch->commissionOrder->lines->count() }} lines
@endif
{{-- Footer --}} @endif