{{-- Always-on 5s poll so the page auto-updates while a sync is running --}} {{-- ─── Running sync banner ──────────────────────────────────────────────── --}} @php $runningSyncs = $this->getRunningSyncs(); @endphp @if($runningSyncs->isNotEmpty())
{{-- Spinner --}}
Sync in progress — all sync buttons are locked until complete
@foreach($runningSyncs as $sync)
{{ ucwords(str_replace('_', ' ', $sync->sync_type)) }} {{ $sync->progress_message ?? 'Starting…' }}
@if($sync->records_processed > 0) {{ number_format($sync->records_processed) }} records @endif {{ $sync->started_at->diffForHumans(null, true) }} elapsed
@endforeach
@endif {{-- ─── Stats ────────────────────────────────────────────────────────────── --}}
@php $stats = $this->getStats(); @endphp
{{ number_format($stats['products']) }}
Active products
{{ number_format($stats['brands']) }}
Total brands
{{ number_format($stats['active_brands']) }}
Synced brands
{{ number_format($stats['discontinued']) }}
Discontinued
{{-- ─── Sync History ──────────────────────────────────────────────────────── --}}

Last Sync Run

@php $syncs = $this->getRecentSyncs(); @endphp @if(empty($syncs))

No sync runs recorded yet.

@else
@foreach($syncs as $type => $s) @endforeach
Sync Type Last Run Status Progress / Records Duration
{{ str_replace('_', ' ', $type) }} {{ $s['last_run'] }} @php $badgeClass = match($s['status']) { 'success' => 'bg-green-100 text-green-700', 'failed' => 'bg-red-100 text-red-700', 'partial' => 'bg-amber-100 text-amber-700', 'running' => 'bg-blue-100 text-blue-700', default => 'bg-gray-100 text-gray-600', }; @endphp @if($s['status'] === 'running') @endif {{ ucfirst($s['status']) }} @if($s['status'] === 'running' && !empty($s['progress_message'])) {{ $s['progress_message'] }} @else {{ number_format($s['records_processed']) }} @endif {{ $s['duration'] }}
@endif
{{-- ─── Background jobs description ──────────────────────────────────────── --}}

Background Sync Jobs

All sync actions dispatch background queue jobs. Ensure php artisan queue:work is running (or use ddev exec php artisan queue:work in DDEV).

@foreach([ ['Sync Brands', 'Pull latest brand list from Turn14 API', 'Weekly'], ['Sync Products', 'Delta product update — new/changed items from last 24hrs', 'Nightly'], ['Sync Pricing', 'Crawl /pricing — update USD buy prices for all products', 'Nightly'], ['Sync Stock (Delta)','Incremental stock update — changed items only', 'Every 2–4 hrs'], ['Full Stock Crawl', 'Paginated full stock refresh for all products', 'Weekly'], ['Check Discontinued','Mark products no longer sold by Turn14', 'Nightly'], ['Fetch Images', 'Download high-quality product images from Turn14', 'On demand'], ] as [$name, $purpose, $freq]) @endforeach
Job Purpose Frequency
{{ $name }} {{ $purpose }} {{ $freq }}