@php /** @var \Illuminate\Support\Collection $shops */ /** @var bool $configured */ /** @var array $tabs */ /** @var string $activeTab */ $glyph = ''; $shop = $shop ?? $shops->first(); $stats = (array) data_get($shop?->meta_json, 'stats', []); $orders = (array) data_get($shop?->meta_json, 'recent_orders', []); $msgs = (array) data_get($shop?->meta_json, 'recent_messages', []); $products = (array) data_get($shop?->meta_json, 'products', []); $orderPill = fn ($st) => match ($st) { 'To ship' => 'bg-accent-amber/15 text-[#7B5A14]', 'Shipped' => 'bg-wa-deep/10 text-wa-deep', 'Delivered' => 'bg-wa-mint text-wa-deep', default => 'bg-paper-100 text-ink-600', }; $live = $shop && $shop->isLive() && $shop->shop_cipher; @endphp
{{-- Header --}}
{{ __('Integration') }} · {{ __('E-commerce') }}

{{ __('TikTok') }} {{ __('Shop') }}

{{ __('Manage your TikTok Shop from :brand — orders, products and buyer messages in one place, alongside Shopify and WooCommerce.', ['brand' => brand_name()]) }}

{{ __('All integrations') }}
@if (session('status'))
{{ session('status') }}
@endif @if ($errors->any())
    @foreach ($errors->all() as $e)
  • {{ $e }}
  • @endforeach
@endif @if (! $configured)
{!! $glyph !!}
{{ __('TikTok Shop is not enabled yet') }}

{{ __('The platform admin needs to add the TikTok Shop Partner app credentials under Settings → :brand Message.', ['brand' => brand_name()]) }}

@elseif (! $shop)
{!! $glyph !!}
{{ __('No TikTok Shop connected') }}

{{ __('Authorize your TikTok Shop seller account to sync orders, products and buyer conversations.') }}

{{ __('Connect TikTok Shop') }}
@else {{-- ===== Connected: store dashboard (sidebar + tabs) ===== --}} {{-- Shop identity + horizontal tab bar (full width — no side column) --}}
{!! $glyph !!}
{{ $shop->shop_name ?: $shop->shop_id }} @if ($live) {{ __('Connected') }} @else {{ __('Pending') }} @endif
{{ $shop->region ?: __('region pending') }} · TikTok Shop{{ $shop->seller_name ? ' · ' . $shop->seller_name : '' }}
{{-- Multi-shop switcher — a seller can connect several shops. --}} @if ($shops->count() > 1)
@endif + {{ __('Shop') }} {{ __('Buyer inbox') }}
{{-- Tabs --}}
@foreach ($tabs as $tab => $label) @php $isActive = $activeTab === $tab; $badge = match ($tab) { 'orders' => (string) ($stats['orders'] ?? count($orders)), 'products' => (string) ($stats['products'] ?? count($products)), 'messages' => (string) ($stats['unread_messages'] ?? count($msgs)), default => null, }; @endphp {{ __($label) }} @if ($badge !== null) {{ $badge }} @endif @endforeach
{{-- Tab content (full width) --}}
@if ($activeTab === 'overview') {{-- KPIs --}}
@foreach ([['orders','orders'],['revenue','revenue'],['products','products'],['unread_messages','unread chats']] as [$k,$lbl])
{{ __($lbl) }}
{{ $stats[$k] ?? '—' }}
@endforeach
{{-- Recent orders + messages --}}
{{ __('Recent orders') }} {{ __('All orders') }}
@foreach (array_slice($orders, 0, 4) as $o)
{{ $o['item'] ?? '' }}@if(($o['qty'] ?? 1) > 1) ×{{ $o['qty'] }}@endif
#{{ $o['id'] ?? '' }} · {{ $o['buyer'] ?? '' }} · {{ $o['when'] ?? '' }}
{{ $o['amount'] ?? '' }}
{{ $o['status'] ?? '' }}
@endforeach
{{ __('Buyer messages') }}
@foreach ($msgs as $m)
{{ $m['text'] ?? '' }}
{{ $m['buyer'] ?? '' }} · {{ $m['when'] ?? '' }}
@endforeach
@elseif ($activeTab === 'orders')
{{ __('Orders') }} · {{ $stats['orders'] ?? count($orders) }}
@forelse ($orders as $o) @empty @endforelse
{{ __('Order') }}{{ __('Buyer') }}{{ __('Total') }}{{ __('Status') }}{{ __('When') }}
{{ $o['item'] ?? '' }}@if(($o['qty'] ?? 1) > 1) ×{{ $o['qty'] }}@endif
#{{ $o['id'] ?? '' }}
{{ $o['buyer'] ?? '' }} {{ $o['amount'] ?? '' }} {{ $o['status'] ?? '' }} {{ $o['when'] ?? '' }}
{{ __('Orders sync here once the order scope is approved.') }}
@elseif ($activeTab === 'products')
{{ __('Products') }} · {{ $stats['products'] ?? count($products) }}
@csrf
@if ($products)
@foreach ($products as $p)
{{ $p['name'] ?? '' }}
{{ $p['price'] ?? '' }}
{{ __(':n sold', ['n' => $p['sold'] ?? 0]) }} @if (($p['status'] ?? '') === 'Out of stock') {{ __('Out of stock') }} @else {{ __(':n in stock', ['n' => $p['stock'] ?? 0]) }} @endif
@endforeach
@else
{{ __('Products sync here once the product scope is approved.') }}
@endif
@elseif ($activeTab === 'messages')
{{ __('Buyer messages') }} {{ __('Open in inbox') }} →
@forelse ($msgs as $m)
{{ strtoupper(mb_substr($m['buyer'] ?? 'B', 0, 1)) }}
{{ $m['buyer'] ?? '' }}@if($m['unread'] ?? false)@endif
{{ $m['text'] ?? '' }}
{{ $m['when'] ?? '' }}
@empty
{{ __('Buyer chats flow into the unified inbox once the customer-service scope is approved.') }}
@endforelse
@else {{-- settings --}}
{{ __('Settings') }}
{{ __('Shop name') }}{{ $shop->shop_name }}
{{ __('Shop ID') }}{{ $shop->shop_id }}
{{ __('Region') }}{{ $shop->region ?: '—' }}
{{ __('Shop cipher') }}{{ $shop->shop_cipher ? '••••' . mb_substr($shop->shop_cipher, -6) : __('pending') }}
{{ __('Disconnect this shop') }}
@csrf @method('DELETE')
@endif {{-- Requirements note (shown on overview + settings) --}} @if (in_array($activeTab, ['overview', 'settings'], true))
{{ __('Live data & buyer messaging') }}
{{ __('Orders, products and buyer chats shown here go live once your TikTok Shop Partner app is approved for the') }} seller.customer_service, order {{ __('and') }} product {{ __('scopes at') }} partner.tiktokshop.com.
@endif
@endif