@php $currentStatus = $currentStatus ?? 'all'; $modePill = [ 'ai' => ['bg' => 'bg-wa-mint', 'text' => 'text-wa-deep', 'dot' => 'bg-wa-green', 'label' => 'AI'], 'whatsapp' => [ 'bg' => 'bg-[#D9E5F2]', 'text' => 'text-[#13478A]', 'dot' => 'bg-[#3D6FB5]', 'label' => 'WhatsApp', ], 'both' => [ 'bg' => 'bg-[#F3E9FF]', 'text' => 'text-[#5B3D8A]', 'dot' => 'bg-[#7A52B2]', 'label' => 'AI + WA', ], ]; $statusPill = [ 'active' => ['bg' => 'bg-wa-mint', 'text' => 'text-wa-deep', 'dot' => 'bg-wa-green', 'label' => 'Active'], 'paused' => ['bg' => 'bg-paper-50', 'text' => 'text-ink-500', 'dot' => 'bg-paper-200', 'label' => 'Paused'], ]; $accentPalette = [ ['bg' => 'bg-wa-mint', 'text' => 'text-wa-deep'], ['bg' => 'bg-[#D9E5F2]', 'text' => 'text-[#13478A]'], ['bg' => 'bg-[#F3E9FF]', 'text' => 'text-[#5B3D8A]'], ['bg' => 'bg-paper-100', 'text' => 'text-ink-700'], ]; @endphp
@if (session('success'))
{{ session('success') }}
@endif
{{ __('Workspace') }}

{{ __('Chatbot') }} {{ __('widgets') }}

{{ __('Embed a floating chat bubble on any page. Smart-agent replies in-browser, hands off to Team Inbox when needed.') }}

{{ $stats['active'] }} {{ __('active') }} New widget
{{-- Stats cards — same 4-column shape as /devices --}}
{{ __('Total widgets') }}
{{ $stats['all'] }}{{ $stats['active'] }} {{ __('active') }}
{{ __('Visitors') }}
{{ number_format($stats['visitors']) }}{{ __('all-time') }}
{{ __('Avg / widget') }}
{{ $stats['all'] > 0 ? number_format($stats['visitors'] / $stats['all'], 1) : '0' }}{{ __('visitors') }}
{{ __('Health') }}{{ $stats['all'] > 0 ? round(($stats['active'] / max($stats['all'], 1)) * 100) : 0 }}%
{{ $stats['all'] > 0 && $stats['active'] === $stats['all'] ? 'healthy' : ($stats['all'] === 0 ? 'empty' : 'attention') }}
{{-- Top bar: status tabs + search (matches /devices) --}}
{{-- Column headers — same column template as the data rows --}}
{{ __('Widget') }}
{{ __('Engine') }}
{{ __('Smart agent') }}
{{ __('Visitors') }}
{{ __('Updated') }}
{{ __('Actions') }}
@forelse ($widgets as $widget) @php $accent = $accentPalette[$widget->id % 4]; $mode = $modePill[$widget->mode] ?? $modePill['ai']; $status = $statusPill[$widget->status] ?? $statusPill['active']; $assistant = $widget->relationLoaded('assistant') ? $widget->assistant : $widget->assistant()->first(); $agentName = $assistant?->name ?: '—'; @endphp
{{-- Widget: icon avatar + name + slug --}}
{{ $widget->name }} {{ $status['label'] }}
/{{ $widget->slug }}
{{-- Engine mode pill --}}
{{ $mode['label'] }}
{{-- Smart agent --}}
{{ $agentName }}
{{-- Visitors count --}}
{{ ($widget->visitors_count ?? 0) > 0 ? number_format($widget->visitors_count) : '—' }}
{{-- Updated --}}
{{ $widget->updated_at->diffForHumans(short: true) }}
{{ $widget->updated_at->format('M d, H:i') }}
{{-- Actions: Preview · Copy snippet · Edit · Rotate token · Duplicate · Delete --}}
@csrf
@empty
{{ __('No widgets yet') }}

{{ __("Build your first chat widget — it'll live as a floating bubble on the page you embed it on.") }}

Create widget
@endforelse
{{-- Footer with counts --}}
{{ __('Showing') }} {{ $widgets->count() }} of {{ method_exists($widgets, 'total') ? number_format($widgets->total()) : number_format($stats['all']) }}
Workspace · {{ $stats['all'] }} {{ __('widgets') }}
@if (method_exists($widgets, 'links')) {{ $widgets->links() }} @endif