@endif
{{-- Composer area.
NOTE: no `overflow-hidden` on the editor card — that used to
clip the AI-zap and Schedule popovers (which open upwards via
`absolute bottom-full`) inside the card, making the menu appear
to overlap the typing area. The popovers now float freely above
the toolbar. --}}
@if($mode === 'note')
{{ __('Internal note (not sent to customer)') }}
@endif
{{-- ── TEMPLATE PREVIEW MODE ──
When the agent has inserted a template via the
TemplatePicker, $templateActive is true and we show
an iframe rendering the raw $body HTML byte-for-byte.
Quill is hidden in this mode because it sanitises
inline styles (breaking email visuals) and re-syncs
from its empty Delta model (wiping pasted HTML on the
next keystroke). The iframe is isolated from the
inbox's dark theme too — what the agent sees is what
the recipient gets. --}}
@if($templateActive)
{{ __('Template inserted — sent as-is') }}
{{-- srcdoc gives us a sandboxed document scope so
the template's CSS / inline styles don't
leak into the inbox UI and vice versa. The
iframe height is set via JS once the body
loads — we start at 320px so something is
visible before the resize. --}}
@else
{{-- Quill Rich Text Editor --}}
{{-- Toolbar --}}
{{-- Editor --}}
@endif {{-- end of !$templateActive (Quill editor branch) --}}
{{-- Attachments preview --}}
@if(!empty($attachments))
@foreach($attachments as $index => $file)
{{ $file->getClientOriginalName() }}
@endforeach
@endif
{{-- Schedule popover lives down with the clock-icon button
(rendered absolutely just above it) so opening the
schedule doesn't push Send / Send & Close to a new
line and break their alignment. --}}
{{-- Toolbar — padded on every side so the Send / Send & Close
buttons sit centred in the strip with equal breathing
room above, below, and on the sides, instead of hugging
the card's bottom edge. --}}
{{-- Attach file — only channels that support media
attachments. SMS / Slack / Telegram replies in
this composer are text-only, so the paperclip
(the "pin" icon) is hidden there. --}}
@if($mode === 'note' || in_array($conversationChannel, ['email', 'whatsapp']))
@endif
{{-- CC/BCC toggle (email only). The "person" icon
doesn't apply to SMS / WhatsApp / Slack / Telegram
replies — those have one recipient determined by
the conversation. --}}
@if($mode !== 'note' && $conversationChannel === 'email')
@endif
{{-- Insert Template — VISIBLE toolbar button (not
buried in the AI dropdown). Dispatches the
`open-template-picker` event to the embedded
at the
bottom of the composer; the picker dispatches
`template-inserted` back which the Livewire
#[On('template-inserted')] handler uses to
replace $body with the rendered HTML. --}}
@if($mode !== 'note')
@endif
{{-- AI Dropdown --}}
{{-- Schedule send — clock button + floating popover.
The popover is `absolute bottom-full left-0` so
opening it does NOT shift Send / Send & Close
downward like the previous inline block did. --}}
@if($mode !== 'note')
@if($showSchedule)
{{ __('Schedule send') }}
{{ __('Scheduled messages may be delayed by 1-2 minutes.') }}
@endif
@endif
{{-- Send and close --}}
@if($mode === 'reply')
@endif
{{-- Primary send.
We route the click through Alpine so we can pass the
current conversation id from `window.__activeConversationId`
as a fallback argument. The Livewire send() method only
adopts it if its own conversationId is genuinely null,
which fixes the intermittent "aborted - no conversation"
bug where the listener missed the last select. --}}
{{-- Upload errors --}}
@error('attachments.*')
{{ $message }}
@enderror
{{-- Undo Send Bar --}}
@if($showUndoBar)
{{ __('Email sending in') }} {{ __('s...') }}
@endif
{{-- Template picker — listens for `open-template-picker` from the
toolbar button and emits `template-inserted` back up to the
parent component's #[On('template-inserted')] handler, which
replaces $body with the rendered HTML. wire:key is mandatory
here: without it the parent's re-renders (autosave, typing,
attachment changes) drop the picker's internal $isOpen state
and the modal collapses moments after the user opens it. --}}