@php $integration = $this->integration; @endphp
← {{ __('Back to integrations') }}
@if ($integration === null)
{{ __('Integration not available in this workspace.') }}
@else
{{ ucfirst($integration->provider->value) }} {{ $integration->name }} {{ ucwords(str_replace('_', ' ', $integration->status->value)) }}
@if ($integration->store_id)
{{ __('Store') }}: {{ $integration->store?->name }}
@else
{{ __('Account-level') }}
@endif @if ($integration->last_error && $integration->status->value === 'error')
{{ $integration->last_error }}
@endif
{{ __('Credentials') }} {{ __('Stored encrypted. Secret fields are blank — leave them empty to keep the current saved value.') }}
@if ($integration->provider->value === 'helm') @endif @if ($integration->provider->value === 'shopify') @endif @if ($integration->provider->value === 'returngo')
{{ __('ReturnGo is retired in favour of direct Royal Mail Click & Drop. This integration is preserved for audit but is no longer used for new return labels — generate labels through your Click & Drop integration instead.') }}
@endif @if ($integration->provider->value === 'royal_mail_click_and_drop')
{{ __('Return warehouse address') }} {{ __("This is where Royal Mail sends the parcel back to. Address line 1, postcode, and country code are required — Royal Mail's API refuses without all three.") }}
@endif
@if ($this->canManage)
{{ __('Save and test connection') }} {{ __('Test connection only') }}
@endif @error('provider')
{{ $message }}
@enderror
{{-- Helm order cache panel — only for configured, enabled Helm rows. Surfaces the cached row count + last import time + a button to dispatch a fresh import job onto the helm-sync queue. --}} @if ( $integration->provider->value === 'helm' && $integration->enabled && $integration->status->value === 'configured' )

{{ __('Helm order cache') }}

{{ __('Local cache of Helm orders used to accelerate the inbox matching path. Helm remains the source of truth — destructive actions still re-verify live before mutating.') }}

@if ($this->canManage) {{ __('Import Helm orders now') }} @endif
{{ __('Cached orders') }}
{{ number_format($this->cachedHelmOrdersCount) }}
{{ __('Last import') }}
@if ($this->lastHelmImportAt) {{ $this->lastHelmImportAt->diffForHumans() }} {{ $this->lastHelmImportAt->toDateTimeString() }} @else {{ __('Never') }} @endif
{{ __('Queue') }}
{{ $this->helmQueueName }}
@if ($this->isLocal)
{{ __('Pending jobs') }}
@if ($this->pendingHelmJobsCount === null) @else {{ $this->pendingHelmJobsCount }} @endif
@if ($this->helmJobsBreakdown)
{{ __(':a available · :r running · :d delayed', [ 'a' => $this->helmJobsBreakdown['available'], 'r' => $this->helmJobsBreakdown['reserved'], 'd' => $this->helmJobsBreakdown['delayed'], ]) }}
@endif
@endif
{{-- Failed-jobs banner. Surfaces helm-sync entries in `failed_jobs`. Local/dev only — same reason the breakdown is local-only (we don't query the queue table in production from this view). --}} @if ($this->isLocal && $this->failedHelmJobsCount !== null && $this->failedHelmJobsCount > 0)
{{ __(':n failed Helm sync job(s)', ['n' => $this->failedHelmJobsCount]) }} php artisan queue:retry helm-sync
@if ($this->latestHelmJobFailure)
{{ $this->latestHelmJobFailure }}
@endif
@endif

{{ __('Each import job paginates ~50 pages from Helm and self-dispatches a continuation if more remain. The chain stops automatically when Helm returns no further pages or the safety cap (500 pages) is hit.') }}

@if ($this->canManage && $this->isLocal)
{{ __('Process Helm queue now') }} {{ __('Clear queued imports') }} {{ __('Process drains up to 5 jobs / 30 seconds (kept under Herd\'s 60s upstream limit). Clear removes all queued imports. Local/dev only.') }}
@endif
@endif {{-- Shopify sync panel — only for configured, enabled Shopify rows. Same chrome as on /integrations so operators can drive the sync from either page. --}} @if ( $integration->provider->value === 'shopify' && $integration->enabled && $integration->status->value === 'configured' )
@include('livewire.integrations._sync-panel', [ 'integration' => $integration, 'snapshots' => $this->syncSnapshots(), 'canManage' => $this->canManage, 'resetConfirm' => $resetConfirm, 'isLocal' => $this->isLocal, 'queueDriver' => $this->queueDriver, 'shopifyQueueName' => $this->shopifyQueueName, 'pendingShopifyJobsCount' => $this->pendingShopifyJobsCount, 'nextShopifyJobAt' => $this->nextShopifyJobAt, 'autoProcess' => $autoProcess, 'lastAutoProcessAt' => $lastAutoProcessAt, 'lastAutoProcessResult' => $lastAutoProcessResult, 'autoProcessPollSeconds' => \App\Livewire\Integrations\Edit::AUTO_PROCESS_POLL_SECONDS, ]) @include('livewire.integrations._incremental-panel', [ 'integration' => $integration, 'incrementalSnapshots' => $this->incrementalSnapshots(), 'canManage' => $this->canManage, 'isLocal' => $this->isLocal, ])
@endif @endif