{{-- Test Mode Banner --}} @if(config('services.channel_test_mode') && $channel !== 'email')
Test Mode Active — {{ ucfirst($channel) }} messages will be saved locally but NOT actually delivered. Disable CHANNEL_TEST_MODE in .env for real delivery.
@endif {{-- Flash Messages --}} @if(session('compose-success'))
{{ session('compose-success') }}
@endif @if(session('compose-error'))
{{ session('compose-error') }}
@endif {{-- Compose Form --}}
{{-- Channel Selector — when $lockChannel is true (the user clicked Compose from a specific-channel inbox like SMS), only the active channel's tab renders. Otherwise the usual full strip of connected-channel tabs shows. --}}
{{ __('Channel') }}
@if(! $lockChannel || $channel === 'email') @endif @if((! $lockChannel || $channel === 'sms') && in_array('sms', $connectedChannels)) @endif @if((! $lockChannel || $channel === 'whatsapp') && in_array('whatsapp', $connectedChannels)) @endif @if((! $lockChannel || $channel === 'telegram') && in_array('telegram', $connectedChannels)) @endif @if((! $lockChannel || $channel === 'slack') && in_array('slack', $connectedChannels)) @endif
@if($channel === 'email') {{-- From --}}
{{-- To --}}
@if($selectedGroupId) {{-- Selected group display --}}
{{ $selectedGroupName }} ({{ $selectedGroupCount }} {{ __('contacts') }})
@else @endif {{-- Loading spinner while searching contacts --}}
{{-- Contact & Group Autocomplete Dropdown --}} @if(!$selectedGroupId && $showContactSuggestions && (!empty($contactSuggestions) || !empty($groupSuggestions)))
{{-- Group suggestions --}} @if(!empty($groupSuggestions))
{{ __('Groups') }}
@foreach($groupSuggestions as $group) @endforeach @endif {{-- Contact suggestions --}} @if(!empty($contactSuggestions)) @if(!empty($groupSuggestions))
{{ __('Contacts') }}
@endif @foreach($contactSuggestions as $suggestion) @endforeach @endif
@endif
{{-- CC/BCC Toggle --}}
{{-- CC / BCC --}} @if($showCcBcc)
@endif {{-- Subject --}}
{{-- Canned responses dropdown (triggered by typing "/" in the body) --}} @if($showCannedResponses && $cannedResponses->isNotEmpty())
@foreach($cannedResponses as $canned) @endforeach
@endif {{-- Body (Quill Rich Text Editor) --}}
@else {{-- Non-email: To (phone / username / slack channel) --}}
@if($channel === 'slack') {{-- Slack sends need a channel ID (e.g. C0123) or user ID (U0123), never a phone. Use a dropdown pre-populated from the bot's visible channels so users can't fat-finger an invalid ID. --}} @else @endif
@error('toPhone')

{{ $message }}

@enderror {{-- Message body for non-email --}}
@error('messageBody')

{{ $message }}

@enderror @if($channel === 'sms')

{{ strlen($messageBody) }}/160 {{ __('characters') }} ({{ max(1, ceil(strlen($messageBody) / 160)) }} {{ __('SMS segment') }}{{ max(1, ceil(strlen($messageBody) / 160)) > 1 ? 's' : '' }})

@endif
@endif {{-- AI Write Panel (email only) --}} @if($channel === 'email' && $showAiWrite)

{{ __('AI Email Writer') }}

{{-- Prompt --}}
{{-- Tone Selector --}}
@foreach(['professional' => __('Professional'), 'friendly' => __('Friendly'), 'casual' => __('Casual'), 'persuasive' => __('Persuasive')] as $toneKey => $toneLabel) @endforeach
{{-- Generate Button --}} {{-- AI Generated Content --}} @if($aiGeneratedContent)
{{ __('Generated Email') }}
{{ $aiGeneratedContent }}
@endif
@endif {{-- Attachments (email only) --}} @if($channel === 'email' && !empty($attachments))
@foreach($attachments as $index => $file) @if($file && method_exists($file, 'getSize') && $file->exists())
{{ $file->getClientOriginalName() }} ({{ number_format(($file->getSize() ?: 0) / 1024, 0) }}KB)
@endif @endforeach
@endif {{-- Schedule Panel (email only) --}} @if($channel === 'email' && $showSchedule)
{{ __('Schedule Send') }}
{{-- Quick-pick Presets --}}
{{-- Custom Date/Time Picker --}}
@error('scheduledAt')

{{ $message }}

@enderror

@if($scheduledAt) {{ __('Scheduled for') }} {{ \Carbon\Carbon::parse($scheduledAt)->format('M j, Y \a\t g:i A') }} @else {{ __('Pick a time or use a preset above') }} @endif

{{-- Honest expectation: the scheduler runs once per minute, so the actual send can lag the chosen time by up to ~60 seconds. --}}

{{ __('Scheduled messages may be delayed by 1-2 minutes.') }}

@endif {{-- Validation errors --}} @if($errors->any())
@foreach($errors->all() as $error)

{{ $error }}

@endforeach
@endif {{-- Action Bar --}}
@if($channel === 'email') {{-- Attach (email only) --}} {{-- AI Write (email only) --}} {{-- Schedule (email only) --}} @endif
@if($channel === 'email') {{-- Save Draft (email only) --}} @endif {{-- Send --}}
{{-- Session expiry warning --}}

{{ __('Session expiring soon') }}

{{ __('Your session is about to expire. Click anywhere to stay logged in. Your draft is saved.') }}

{{-- Undo Send Bar --}} @if($showUndoBar)
{{ __('Email sending in') }} {{ __('s...') }}
@endif