{{-- /devices when active engine = waba. Renders a card grid of WaProviderConfig rows (one card per WABA phone number) instead of the Baileys device table. Vars expected (passed from DevicesController): $wabaAccounts — Collection of WaProviderConfig rows $embeddedSignupReady — bool, opens FB SDK iframe modal when true $embeddedSignupConfigId — string $wabaAppId — string --}}
{{-- Empty state --}} @if ($wabaAccounts->isEmpty())
{{ __('Connect your first WABA number') }}

{{ __('Each merchant connects their own WhatsApp Business Account from Meta Business Suite. You can add multiple numbers per workspace.') }}

@if ($embeddedSignupReady)
@endif
@else {{-- Filter + add bar --}}
{{ __('Workspace · WABA accounts') }} {{ $wabaAccounts->count() }} {{ __('connected') }}
{{-- Card grid (one per row) --}}
@foreach ($wabaAccounts as $waba) @php $meta = is_array($waba->meta_json) ? $waba->meta_json : []; $wabaId = (string) ($meta['waba_id'] ?? ''); $pnid = (string) ($meta['phone_number_id'] ?? ''); $bizId = (string) ($meta['business_id'] ?? ''); $verified = (string) ($meta['verified_name'] ?? ($waba->display_label ?: ($waba->phone_number ?: 'Unnamed WABA'))); $quality = strtoupper((string) ($meta['quality_rating'] ?? '')); $tier = (string) ($meta['messaging_limit_tier'] ?? ''); $isConnected = $waba->isConnected(); $qualityColor = match ($quality) { 'GREEN' => 'bg-wa-mint text-wa-deep border-wa-green/40', 'YELLOW' => 'bg-accent-amber/10 text-accent-amber border-accent-amber/40', 'RED' => 'bg-accent-coral/10 text-accent-coral border-accent-coral/40', default => 'bg-paper-100 text-ink-700 border-paper-200', }; @endphp
@if ($waba->is_primary) Primary @endif
{{ $verified }}
{{ $waba->phone_number ?: '+— unknown' }}
{{ __('WABA ID') }}
{{ $wabaId ?: '—' }}
{{ __('Phone ID') }}
{{ $pnid ?: '—' }}
{{ __('Quality') }}
{{ $quality ?: 'Unrated' }}
{{ __('Tier') }}
{{ $tier ? str_replace('TIER_', '', $tier) . ' / day' : '—' }}
{{ $isConnected ? 'Connected' : 'Disconnected' }} @if ($waba->connected_at) · {{ $waba->connected_at->diffForHumans() }} @endif
@if (!$waba->is_primary && $isConnected)
@csrf
@endif @if ($wabaId) Meta @endif
@csrf @method('DELETE')
@endforeach
{{ $wabaAccounts->count() }} WABA {{ \Illuminate\Support\Str::plural('account', $wabaAccounts->count()) }} {{ __('connected') }}
{{ __('Primary number is used as the default sender') }}
@endif {{-- Connect modals (hidden until [data-waba-connect="..."] click) --}} @include('user.devices._waba_modals', [ 'embeddedSignupReady' => $embeddedSignupReady ?? false, 'embeddedSignupConfigId' => $embeddedSignupConfigId ?? '', 'wabaAppId' => $wabaAppId ?? '', ])