@extends('admin.layouts.app') @section('title', __('admin.sync.show_title') . ' #' . $run->id . ' — ' . __('admin.brand.name')) @section('page_title', __('admin.sync.show_title')) @php $dash = '—'; $fmt = function ($ts) use ($dash) { if (!$ts) return $dash; return \Illuminate\Support\Carbon::parse($ts)->format('Y-m-d H:i:s'); }; $rel = function ($ts) use ($dash) { if (!$ts) return $dash; return \Illuminate\Support\Carbon::parse($ts)->diffForHumans(); }; $stats = $run->stats ?? []; $errors = $run->error_messages ?? []; $statusColors = [ 'pending' => '#92400e', 'running' => '#1e40af', 'succeeded' => '#166534', 'partial' => '#9a3412', 'failed' => '#991b1b', ]; $statusBg = [ 'pending' => '#fef3c7', 'running' => '#dbeafe', 'succeeded' => '#dcfce7', 'partial' => '#fed7aa', 'failed' => '#fee2e2', ]; @endphp {{-- Alpine.js is already loaded by admin.layouts.app — loading it again would double-bind every directive on this page. --}} @push('styles') @endpush @section('content') @if ($run->isActive())
@csrf
@endif {{ __('admin.sync.back_to_list') }}
isActive()) x-data="runWatcher({ statusUrl: @js(route('admin.sync.runs.status', $run)), })" @endif > {{-- ────────────── Summary ────────────── --}}

{{ __('admin.sync.boards.' . $run->module) }} #{{ $run->id }} isActive()) x-text="labels.status[currentStatus]" @endif> {{ __('admin.sync.status_labels.' . $run->status) }} @if ($run->isActive()) {{ __('admin.sync.live.auto_refresh') }} @endif

{{ __('admin.sync.fields.triggered_by') }}: {{ $run->admin?->name ?: $dash }} {{ __('admin.sync.fields.queued_at') }}: {{ $fmt($run->created_at) }} @if ($run->started_at) {{ __('admin.sync.fields.started_at') }}: {{ $fmt($run->started_at) }} @endif @if ($run->finished_at) {{ __('admin.sync.fields.finished_at') }}: {{ $fmt($run->finished_at) }} @endif
{{-- ────────────── Progress bar (when total known) ────────────── --}} @if ($run->total_estimated)

{{ __('admin.sync.progress') }}

{{ number_format($run->items_processed) }} / {{ number_format($run->total_estimated) }} · {{ $run->pages_processed }} {{ __('admin.sync.pages') }} {{ $run->progressPct() ?? 0 }}%
@endif {{-- ────────────── Stats tiles ────────────── --}}

{{ __('admin.sync.sections.results') }}

{{ __('admin.sync.fields.processed') }}

isActive()) x-text="liveStats.items_processed" @endif>{{ number_format($run->items_processed) }}

{{ __('admin.sync.fields.upserted') }}

isActive()) x-text="liveStats.items_upserted" @endif>{{ number_format($run->items_upserted) }}

{{ __('admin.sync.fields.errored') }}

isActive()) x-text="liveStats.items_errored" @endif> {{ number_format($run->items_errored) }}

{{ __('admin.sync.fields.duration') }}

@if ($run->durationSeconds() !== null) {{ $run->durationSeconds() }}s @else {{ $dash }} @endif

@foreach (['geographic_focuses_inserted', 'geographic_focuses_removed', 'members_upserted', 'positions_inserted', 'positions_removed', 'sectors_inserted', 'stages_inserted', 'payment_methods_inserted', 'tags_inserted', 'files_ingested'] as $k) @if (isset($stats[$k]) && $stats[$k] > 0)

{{ str_replace('_', ' ', $k) }}

{{ number_format($stats[$k]) }}

@endif @endforeach
{{-- ────────────── Inputs ────────────── --}}

{{ __('admin.sync.sections.inputs') }}

{{ __('admin.sync.fields.module') }}
{{ __('admin.sync.boards.' . $run->module) }}
{{ __('admin.sync.fields.limit_requested') }}
{{ number_format($run->limit_requested) }}
{{ __('admin.sync.fields.skip_files') }}
{{ $run->skip_files ? __('admin.statuses.active') ?? 'Yes' : ($dash) }}
{{ __('admin.sync.fields.triggered_by') }}
@if ($run->admin) {{ $run->admin->name }} {{ $run->admin->email }} @else {{ $dash }} @endif
{{-- ────────────── Timing ────────────── --}}

{{ __('admin.sync.sections.timing') }}

{{ __('admin.sync.fields.queued_at') }}
{{ $fmt($run->created_at) }} ({{ $rel($run->created_at) }})
{{ __('admin.sync.fields.started_at') }}
{{ $fmt($run->started_at) }}
{{ __('admin.sync.fields.finished_at') }}
{{ $fmt($run->finished_at) }}
{{ __('admin.sync.fields.duration') }}
@if ($run->durationSeconds() !== null) {{ $run->durationSeconds() }}s @else {{ $dash }} @endif
{{-- ────────────── Errors ────────────── --}}

{{ __('admin.sync.sections.errors') }} @if (count($errors) > 0) {{ count($errors) }} @endif

@if ($run->exception)
  • {{ __('admin.sync.fields.exception') }}: {{ $run->exception }}
  • @endif @if (count($errors) === 0 && !$run->exception)
    {{ __('admin.sync.errors.no_errors') }}
    @elseif (count($errors) > 0)
      @foreach ($errors as $err)
    1. {{ $err }}
    2. @endforeach
    @endif
    {{-- ────────────── Raw stats ────────────── --}} @if (! empty($stats))

    {{ __('admin.sync.sections.raw') }}

    {{ json_encode($stats, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE) }}
    @endif
    @if ($run->isActive()) @endif @endsection