@php $tz = config('app.display_timezone'); $statusColors = ['draft' => 'slate', 'processing' => 'sky', 'completed' => 'emerald', 'failed' => 'rose', 'undone' => 'amber']; $metrics = [ ['label' => __('Created'), 'value' => $batch->created_count, 'icon' => 'plus', 'accent' => '#10b981', 'sub' => __('New prospects')], ['label' => __('Linked'), 'value' => $batch->linked_count, 'icon' => 'link', 'accent' => '#0ea5e9', 'sub' => __('Existing records')], ['label' => __('Updated'), 'value' => $batch->updated_count, 'icon' => 'pencil', 'accent' => '#6366f1', 'sub' => __('Blanks filled in')], ['label' => __('Skipped'), 'value' => $batch->skipped_count, 'icon' => 'arrow-right', 'accent' => '#64748b', 'sub' => __('Chosen, or already listed')], ['label' => __('Failed'), 'value' => $batch->failed_count, 'icon' => 'exclamation-triangle', 'accent' => '#e11d48', 'sub' => __('Download to fix')], ]; @endphp
status === 'processing' && $canRun) wire:poll.750ms="processNext" @endif>
{{ __('Imports and Exports') }}
{{ __(\App\Models\Crm\ImportBatch::STATUSES[$batch->status] ?? $batch->status) }} @if ($batch->failed_count > 0 && $batch->failed_rows_path) {{ __('Failed rows') }} @endif @if ($portfolioLive) {{ __('Open the work queue') }} @endif @if ($batch->status === 'processing')
{{ $canRun ? __('Writing the rows…') : __('This import is still being written by the person who started it.') }} {{ number_format($batch->options['offset'] ?? 0) }} / {{ number_format($batch->total_rows) }}
@if ($canRun)

{{ __('Keep this page open. If it closes, opening it again carries on where it stopped.') }}

@endif
@elseif ($batch->status === 'draft') {{ __('This import was not finished, so nothing from it was written.') }} {{ __('Start an import') }} @endif
@foreach ($metrics as $m)

{{ $m['label'] }}

{{ number_format($m['value']) }}

{{ $m['sub'] }}
@endforeach

{{ __('About this import') }}

{{ __('Rows in the file') }}
{{ number_format($batch->total_rows) }}
{{ __('Contacts added') }}
{{ number_format($batch->options['contacts_created'] ?? 0) }}
{{ __('From') }}
{{ __(\App\Models\Crm\ImportBatch::SOURCES[$batch->source] ?? $batch->source) }}{{ ! empty($batch->options['sheet']) ? ', '.__('sheet :name', ['name' => $batch->options['sheet']]) : '' }}
{{ __('Portfolio') }}
{{ $batch->portfolio?->name ?? __('Not available') }}
@if ($batch->completed_at)
{{ __('Finished') }}
{{ $batch->completed_at->timezone($tz)->format('j M Y, H:i') }}
@endif @if ($batch->undone_at)
{{ __('Undone') }}
{{ __(':date by :name', ['date' => $batch->undone_at->timezone($tz)->format('j M Y, H:i'), 'name' => $batch->undoneBy?->name ?? __('someone')]) }}
@endif
@if ($mapping !== [])

{{ __('Columns used') }}

@foreach ($mapping as $field => $header) {{ __($field) }} ← {{ $header }} @endforeach
@endif

{{ __('Undo') }}

@if ($batch->status === 'undone')

{{ __('This import has been undone.') }}

@elseif ($batch->status !== 'completed')

{{ __('An import can be undone once it has finished.') }}

@elseif ($undoBlocker)

{{ $undoBlocker }}

@else

{{ __('Until :date, and while nothing from it has been worked, this import can be taken back out: the organisations and contacts it created are removed and the blanks it filled in are emptied again.', ['date' => $batch->undo_expires_at?->timezone($tz)->format('j M Y')]) }}

@if ($canUndo) @endif @endif