{{-- Thirteen answers on one screen. The first version was one column: name, subject, two clamped lines of body and two full-width buttons per entry. Thirteen of those is four screens of scrolling to find the one you want, and the body preview was the least useful part of it — the whole text is one click away in the modal anyway. So: two columns of one-line entries, actions as icons that do not compete with the name, the create form folded away behind a button, and the placeholder list as a compact grid rather than a tall sidebar that pushed the entries into half the window. --}}

{{ __('templates.title') }}

{{ __('templates.subtitle') }}

{{ __('templates.new') }}
{{-- Folded away by default. A form that is always open is a screen of form between the operator and the thing they came for — and creating a template is the rarer of the two things done here. It stays a form that IS the page (R20 exempts exactly that); only its visibility changed. --}}
@error('body')

{{ $message }}

@enderror
{{ __('templates.create') }} {{ __('templates.cancel') }}
{{-- The placeholders, as a grid across the page rather than a column beside it. Rendered from the renderer's own list, so a token added there appears here without being written down twice. --}}

{{ __('templates.placeholders') }}

{{ __('templates.placeholders_note') }}

@foreach ($placeholders as $token => $explanation) {{-- Assembled in PHP, not inline: Blade's echo tag ends at the first }} it finds, so a literal one inside the expression cuts the tag in half and compiles to nonsense. --}} @php $literal = '{{'.$token.'}}'; @endphp
{{ $literal }}
{{ __($explanation) }}
@endforeach

{{ __('templates.unknown_note') }}

{{-- The entries. Two columns, one line each: what an operator scans for is the name, and the subject is the only other thing that tells two similar ones apart. The text itself is in the modal. --}} @if ($templates->isEmpty())

{{ __('templates.empty') }}

@else
@foreach ($templates as $template) {{-- `opening` is local to the row: fetching the modal is a round trip, and a click with nothing to show for it reads as a click that missed. It clears when the modal is up (the package announces that) and on a timer as well, so a request that never answers cannot leave the row spinning for ever. --}}
$template->active, // A retired one stays visible and stays quiet. 'border-line bg-surface-2' => ! $template->active, ])>
$template->active, 'text-muted line-through' => ! $template->active, ])>{{ $template->name }} @if (! $template->active) {{ __('templates.retired') }} @endif

{{ $template->subject }}

{{-- Every button reports its own click: pressed state on the way down, disabled while the request is out. The global bar at the top of the window says that SOMETHING is happening; these say which thing. --}}
{{-- R20: editing opens a modal. A five-line textarea in a list row is the height jump the rule exists to stop. The spinner is this button's own: opening the modal is a Livewire request made by the MODAL component, so wire:loading on this page never sees it. --}}
@endforeach
@endif