{{-- One clear banner when a linked product has local changes. No Prepare detour. --}}
@php
$currentStep = $wizardStep ?? null;
$linked = filled($import->shopify_product_gid);
$needsPrepare = $import->shopifyPayloadNeedsPrepare();
$shopifyDirty = $import->hasPendingShopifySync();
// Only show Update CTA when sync is actually dirty — not forever when prepare alone fails.
$needsPush = $linked && $shopifyDirty;
$shopifyUrl = route('product-ai-import.show', ['productAiImport' => $import, 'step' => 'shopify']);
$autoBusy = $import->isAutoRunning();
$bgBusy = $import->isBackgroundBusy();
$isImprove = $import->isImproveExisting();
$syncLabel = $isImprove ? 'Sync media' : 'Update Shopify';
$syncAction = $isImprove
? route('product-ai-import.sync-improve-media', $import)
: route('product-ai-import.run-pending', $import);
@endphp
@if($needsPush)
Shopify · pending
{{ $isImprove ? 'Improved media is not on Shopify yet' : 'Local changes are not on Shopify yet' }}
@if($isImprove)
Press Sync media — prepares if needed, then replaces gallery only (variants remapped; title/pricing/status untouched).
@else
Press Update Shopify — prepares media if needed, then pushes to the linked product.
@endif
Watch the dark “Working” banner for progress.@if($bgBusy) If another job is running, this joins the queue (1-by-1).@endif
@if($autoBusy)
Wait for Auto to finish
@else
{{-- Always run-pending (stored listing) — never submit the big Shopify form from here.
Form submit was easy to “silently” block on HTML5/required validation.
When a bg job is running, server queues Update Shopify behind it. --}}
@if($currentStep !== 'shopify')
Or review on Shopify step →
@endif
@endif