@php /** @var array $providerAllowed */ /** @var \App\Models\WaProviderConfig|null $providerConfig */ $allowed = $providerAllowed ?? ['waba', 'baileys', 'twilio']; $cfg = $providerConfig ?? null; $current = $cfg?->provider; $appIdSet = (bool) \App\Models\SystemSetting::get('waba_app_id', ''); $appConfigIdSet = (bool) \App\Models\SystemSetting::get('waba_config_id', ''); $sharedNodeUrl = (string) \App\Models\SystemSetting::get('baileys_server_url', env('SERVER_URL', '')); $sharedTwilioSid = (string) \App\Models\SystemSetting::get('twilio_account_sid', ''); $cards = [ 'waba' => [ 'title' => 'Official WABA', 'subtitle' => 'Meta Cloud · catalog · in-chat orders', 'iconBg' => 'bg-wa-mint', 'iconFg' => 'text-wa-deep', 'icon' => '', ], 'baileys' => [ 'title' => 'Unofficial API · QR', 'subtitle' => 'Pair your phone (free, no Meta verification)', 'iconBg' => 'bg-[#D9E5F2]', 'iconFg' => 'text-[#13478A]', 'icon' => '', ], 'twilio' => [ 'title' => 'Twilio', 'subtitle' => 'Sandbox or paid · Account SID + token', 'iconBg' => 'bg-accent-amber/20', 'iconFg' => 'text-[#7B5A14]', 'icon' => '', ], ]; @endphp
{{ __('Sending providers') }}

{{ __('Connect WhatsApp to this workspace') }}

{{ __('Your messages — chat, broadcasts, scheduled, auto-reply, store — all flow through whichever provider you connect here. Pick one.') }}

@if ($cfg && $cfg->isConnected()) Connected via {{ ucfirst($cfg->provider) }} @endif
@foreach (['waba', 'baileys', 'twilio'] as $key) @php $card = $cards[$key]; $isAllowed = in_array($key, $allowed, true); $isCurrent = $current === $key && $cfg?->isConnected(); $borderCls = $isCurrent ? 'border-wa-deep ring-2 ring-wa-deep/15' : ($isAllowed ? 'border-paper-200' : 'border-paper-100 opacity-50'); @endphp
{!! $card['icon'] !!} @if (!$isAllowed) {{ __('Disabled by admin') }} @elseif ($isCurrent) Connected @endif
{{ $card['title'] }}

{{ $card['subtitle'] }}

@if (!$isAllowed)
{{ __('Ask your admin to enable this method at /admin/settings.') }}
@elseif ($isCurrent)
{{ $cfg->phone_number ?: $cfg->display_label }}
@else @endif
@endforeach
{{-- Inline expansion panels — only one shows at a time, controlled by the JS --}}