@php $inboundUrl = preg_replace('#^http://#i', 'https://', url('/api/sms/inbound')); $statusUrl = preg_replace('#^http://#i', 'https://', url('/api/sms/status')); $activeCount = $senders->where('status', \App\Models\WaProviderConfig::STATUS_CONNECTED)->count(); // Which tab to open first — follow the user's last action. $initTab = 'numbers'; if (old('url') || session()->has('sms_test_msg')) $initTab = 'custom'; elseif ($errors->any() || old('from_number') || old('account_sid')) $initTab = 'provider'; @endphp
{{-- Header --}}

{{ __('SMS') }}

{{ __('Twilio · MSG91 · Custom API') }}
{{ $activeCount ? trans_choice('{1}:count number active|[2,*]:count numbers active', $activeCount, ['count' => $activeCount]) : __('Not connected') }}
{{-- Flash + errors --}} @if (session('status'))
{{ session('status') }}
@endif @if (session('error'))
{{ session('error') }}
@endif @if ($errors->any())
{{ __('Couldn’t connect the SMS number:') }}
    @foreach ($errors->all() as $err)
  • {{ $err }}
  • @endforeach
@endif {{-- Tabbed card --}}
{{-- Tab nav --}}
@foreach ([ ['numbers', __('Numbers'), 'list'], ['provider', __('Add provider'), 'plus'], ['custom', __('Custom API'), 'plug'], ['lookup', __('Check number'), 'search'], ['guide', __('Setup guide'), 'book-open'], ] as [$key, $label, $icon]) @endforeach
{{-- ============ NUMBERS ============ --}}
{{-- Webhook URLs reminder --}}

{{ __('Paste these into your provider') }}

@foreach ([[__('Inbound / Messaging webhook'), $inboundUrl, __('Twilio: number → Messaging → “A message comes in” (HTTP POST).')], [__('Delivery-status callback'), $statusUrl, __('Twilio: same number → “Status callback URL”.')]] as [$lbl, $url, $hint])
{{ $lbl }}
{{ $url }}
{{ $hint }}
@endforeach
{{-- Connected numbers --}}

{{ __('Connected numbers') }}

{{ $senders->count() }} {{ __('total') }}
@if ($senders->isEmpty())
{{ __('No SMS number connected yet.') }}
@else
@foreach ($senders as $s) @php $meta = is_array($s->meta_json) ? $s->meta_json : []; $prov = strtolower($meta['sms_provider'] ?? 'twilio'); $connected = $s->status === \App\Models\WaProviderConfig::STATUS_CONNECTED; $provLabel = ['twilio'=>'Twilio','msg91'=>'MSG91','vonage'=>'Vonage','plivo'=>'Plivo','messagebird'=>'MessageBird','bird'=>'MessageBird','sinch'=>'Sinch','telnyx'=>'Telnyx','custom'=>'Custom API'][$prov] ?? ucfirst($prov); $accent = $prov === 'custom' ? 'bg-[#EEF2FF] text-[#4F46E5]' : ($prov === 'msg91' ? 'bg-accent-amber/15 text-accent-amber' : 'bg-wa-mint text-wa-deep'); @endphp
{{ $s->phone_number }}
{{ $provLabel }} {{ $connected ? __('Active') : __('Inactive') }}
{{ __('Rate / segment') }}
{{ ($meta['rate_per_segment'] ?? null) !== null ? ($meta['rate_per_segment'] . ' ' . ($meta['currency'] ?? 'USD')) : __('—') }}
@if ($prov === 'msg91')
{{ __('DLT sender') }}
{{ $meta['sender_id'] ?? '—' }}
@endif @if ($prov === 'custom' && !empty($meta['custom_in']['token']))
{{ __('Inbound URL') }}
{{ $inboundUrl }}/custom/{{ $meta['custom_in']['token'] }}
@endif
@csrf
@csrf @method('DELETE')
@endforeach
@endif
{{-- ============ ADD PROVIDER ============ --}} {{-- ============ CUSTOM API ============ --}} {{-- ============ CHECK NUMBER ============ --}} {{-- ============ SETUP GUIDE ============ --}}