{{-- "Sync from Live" — rendered in the tenant topbar ONLY for test instances
     (see TenantPanelProvider::renderSyncFromLiveButton). Refreshes this test
     environment from its live parent via POST /sync-from-live, and offers the
     catalog-only variant (categories/subcategories/products) via
     POST /sync-products-from-live. Both endpoints re-enforce the test-only rule. --}}

@php
    $fullAction = route('test-instance.sync-from-live');
    $productsAction = route('test-instance.sync-products-from-live');
@endphp

<div class="fi-sync-actions flex flex-wrap items-center gap-2">
    <form action="{{ $fullAction }}" method="POST" class="flex items-center gap-2"
          x-data="{ syncing: false }"
          x-on:submit.prevent="
              if (! confirm('Refresh this test instance from &quot;{{ $parentName ?? 'the live tenant' }}&quot;?' + (syncing ? '' : '\\n\\nExisting test data will be overwritten.'))) return;
              syncing = true;
              $event.target.submit();
          ">
        @csrf

        <x-filament::button type="submit" size="sm" color="primary" icon="heroicon-m-arrow-path" :disabled="false">
            Sync from Live
        </x-filament::button>
    </form>

    <form action="{{ $productsAction }}" method="POST" class="flex items-center gap-2"
          x-data="{ syncing: false }"
          x-on:submit.prevent="
              if (! confirm('Copy the product catalog (categories, subcategories, products) from &quot;{{ $parentName ?? 'the live tenant' }}&quot;?' + (syncing ? '' : '\\n\\nExisting test products will be refreshed; all other test data is untouched.'))) return;
              syncing = true;
              $event.target.submit();
          ">
        @csrf

        <x-filament::button type="submit" size="sm" color="primary" icon="heroicon-m-shopping-bag" :disabled="false">
            Sync Products
        </x-filament::button>
    </form>
</div>