{{-- Toast --}} @if(session('success'))
{{ session('success') }}
@endif @if(session('error'))
{{ session('error') }}
@endif {{-- Empty state if no email accounts connected yet --}} @if($accounts->isEmpty())

{{ __('No email accounts connected') }}

{{ __('Connect a Gmail, Outlook, or IMAP account to start using signatures.') }}

{{ __('Connect email account') }}
@else {{-- Account picker (only shown if more than one account) --}} @if($accounts->count() > 1)
@foreach($accounts as $acc) @endforeach
@endif {{-- Header with current account + Add button --}}

{{ __('Email Signatures') }}

{{ __('Auto-append a signature to emails sent from') }} {{ $accounts->firstWhere('id', $selectedAccountId)?->email ?? '—' }}

@if(!$showForm) @endif
{{-- Add / Edit form --}} @if($showForm)

{{ $editingId ? __('Edit signature') : __('New signature') }}

{{-- Signature name --}}
@error('signatureName')

{{ $message }}

@enderror
{{-- Rich-text editor with WYSIWYG + raw HTML source toggle. The `` Source button flips between the contenteditable view and a textarea where the user can paste full HTML signatures (with inline styles, tables, brand banners) that the WYSIWYG editor would otherwise escape into `<tag>` text. Toggling back rebuilds the contenteditable from the textarea so both modes always reflect the latest content. --}}
{{-- Toolbar --}}
{{-- Source HTML toggle — pushed to the right of the toolbar. When ON, the WYSIWYG buttons above grey out and the textarea below replaces the contenteditable so the user can edit raw HTML directly without the browser escaping `<` to `<`. --}}
{{-- WYSIWYG editor (hidden when Source mode is on) --}}
{{-- Raw HTML textarea (shown when Source mode is on) --}} @error('contentHtml')

{{ $message }}

@enderror

{{ __('Tip: paste an HTML signature from your existing email client and it will render exactly as it does today. Click') }} </> {{ __('to edit raw HTML.') }} {{ __('Raw HTML mode — tags and inline styles render as-is in the email.') }}

{{-- Toggles --}}
{{-- Form actions --}}
@endif {{-- Signature list --}} @if(!$showForm) @if($signatures->isEmpty())

{{ __('No signatures yet') }}

{{ __('Create one to auto-append it to every email this account sends.') }}

@else
@foreach($signatures as $sig)

{{ $sig->name }}

@if($sig->is_default) {{ __('Default') }} @endif
{{ __('New emails') }}: {{ $sig->append_to_new ? __('On') : __('Off') }} | {{ __('Replies') }}: {{ $sig->append_to_replies ? __('On') : __('Off') }}
@if(!$sig->is_default) @endif
{{-- Preview --}}
{{ __('Preview') }}
{!! $sig->content_html !!}
@endforeach
@endif @endif @endif