@php $defaultShopName = $storefront?->shop_name ?: ($workspace?->name ?: ''); $defaultSlug = $storefront?->slug ?: \Illuminate\Support\Str::slug($defaultShopName ?: 'shop'); $defaultDomain = $storefront?->custom_domain ?: ''; $defaultDeviceId = $storefront?->device_id ?: $connectedDevices->first()->id ?? null; @endphp
{{ __('Connect / WhatsApp Store') }}
@if ($mode === 'list') Your {{ __('shops') }} @elseif ($mode === 'edit') Edit {{ $storefront?->shop_name ?: 'shop' }} @else Set up your {{ __('store') }} @endif
{{ __('Manage all connections at /devices →') }}
@if (session('status'))
{{ session('status') }}
@endif @if ($errors->any())
@foreach ($errors->all() as $e)
{{ $e }}
@endforeach
@endif @if ($connectedDevices->isEmpty() && !$hasWaba) {{-- No way to send WhatsApp yet — block the wizard regardless of mode. --}}
{{ __('Step 1 of 3') }}
{{ __('Connect WhatsApp first') }}

{{ __('Your store needs a connected WhatsApp number to send order confirmations and let customers chat. Head to') }} /devices to pair one — it takes 30 seconds.

Go to devices
@elseif ($mode === 'list') {{-- ============================================ --}} {{-- ===== MODE: LIST — show existing shops ===== --}} {{-- ============================================ --}}

{{ $shops->count() }} {{ \Illuminate\Support\Str::plural('shop', $shops->count()) }} in {{ $workspace?->name }}

{{ __('Each shop has its own public URL, theme, and sending device. Add as many as you need — different brands, languages, or regions.') }}

Add shop
@foreach ($shops as $shop) @php $device = $shop->device_id ? \App\Models\Device::find($shop->device_id) : null; $devicePhone = $device ? trim(($device->country_code ?? '') . ' ' . ($device->phone_number ?? '')) : null; @endphp
{{-- Header strip in the shop's brand colour --}}
@if ($shop->enabled) Live @else Disabled @endif
{{ $shop->theme_key }} {{ __('theme') }}

{{ $shop->shop_name ?: 'Untitled shop' }}

{{ $shop->public_url }}
{{ __('Sending from') }}
{{ $devicePhone ?: 'No device' }}
{{ __('Domain') }}
@if ($shop->custom_domain) {{ $shop->custom_domain }} @if ($shop->custom_domain_verified) ✓ @else · pending @endif @else Built-in URL @endif
@endforeach {{-- Add-shop tile (always last, dashed) --}}
{{ __('Add another shop') }}
{{ __('Run a separate storefront with its own URL, theme, and WhatsApp number.') }}
@else {{-- ============================================ --}} {{-- ===== MODE: ADD / EDIT — wizard form ======== --}} {{-- ============================================ --}} @if ($mode === 'add' && $shops->isNotEmpty())
← Back to shops · Creating shop #{{ $shops->count() + 1 }}
@endif {{-- Progress strip --}}
  1. 1 · Shop details
  2. 2 · Public URL
  3. 3 · Sending device
@csrf @if ($storefront) @endif {{-- Step 1: Shop details --}}
1
{{ __('Shop details') }}
{{ __('Customer-facing name + the URL slug under which products will live.') }}
{{ __('Storefront slug') }} (auto)
{{ $subdomainUsable ? 'https://' : '/s/' }}
{{ old('slug', $defaultSlug) }}
@if ($storefront) Locked once the store is live so shared links keep working. @else Generated from your shop name — finalised when you save. @endif
{{-- Step 2: Public URL --}}
2
{{ __('Public URL') }}
{{ __('Choose how buyers reach your store — built-in URL is free, custom domain looks more professional.') }}
{{ __('Built-in URL · free') }}
@if ($subdomainUsable) Works as soon as you save. Hosted at {{ $subdomainHost }}. @else Works as soon as you save. Path-based URL because no public storefront host is configured — set {{ __('STOREFRONT_HOST') }} in .env to enable subdomains. @endif
{{-- Step 3: Sending device --}}
3
{{ __('Sending device') }}
{{ __('Which WhatsApp number sends order confirmations and replies to buyers.') }}
@if ($connectedDevices->isEmpty())
No connected devices on this account. {{ __('Pair one at /devices →') }}
@else
@foreach ($connectedDevices as $d) @php $phone = trim(($d->country_code ?? '') . ' ' . ($d->phone_number ?? '')); $active = (int) old('device_id', $defaultDeviceId) === (int) $d->id; @endphp @endforeach
@endif
Cancel @if ($storefront) @endif
@if ($storefront)
{{ __('This shop is live') }}
{{ $storefront->shop_name ?: 'Your shop' }} →

{{ __('Add products, pick a theme, view orders, and share your link.') }}

@endif @endif
{{-- ===== Share shop modal (WhatsApp / Copy / Email / QR) ===== --}} {{-- ===== Delete-shop confirmation modal (shared between list + edit modes) ===== --}}