@extends('layouts.dashboard') @section('content') @php /** * @var array $templates the fixed set of transactional templates * @var array $mergeFields [template key => merge fields that template receives] * @var array $globalFields merge fields every template receives * @var bool $canSend whether outbound mail is configured */ $templates = $templates ?? []; $mergeFields = $mergeFields ?? []; $globalFields = $globalFields ?? []; $canSend = $canSend ?? false; $adminEmail = $adminEmail ?? ''; @endphp @php /* .qm-d2: the dashboard density standard (app.css ยง35) */ @endphp
@php /* Bold card head โ€” the red-bar stays a page-section device. */ @endphp

{{ t_raw('admin.emailtemplates.list_heading') }}

@php /* Status is a live toggle switch (no sortable text content), so that th carries no data-sort. */ @endphp @foreach ($templates as $tpl) @php $active = (int) $tpl['is_active'] === 1; @endphp @endforeach
{{ t_raw('admin.emailtemplates.col_template') }} {{ t_raw('admin.emailtemplates.col_subject') }} {{ t_raw('common.status') }} {{ t_raw('common.actions') }}
{{ (string) $tpl['name'] }} @if (!empty($tpl['description']))
{{ (string) $tpl['description'] }}
@endif
{{ (string) $tpl['subject'] }}
@csrf
@php // Send a real message through the saved mail settings. Uses the same endpoint and the // same result idiom as the SMTP check on Settings โ†’ Email, so there is one answer to // "does outbound mail work?" wherever it is asked. @endphp

{{ t_raw('admin.emailtemplates.test_heading') }}

@if (!$canSend)

{{ t_raw('admin.emailtemplates.test_needs_smtp') }} {{ t_raw('admin.messages.mail_off_link') }}

@else

@endif
@php // Which @{{tokens}} resolve in which template. A token used outside its template would // reach the reader as the literal text, so this is the reference that prevents it. @endphp

{{ t_raw('admin.emailtemplates.fields_heading') }}

{{ t_raw('admin.emailtemplates.fields_help') }}

@foreach ($templates as $tpl) @php $fields = $mergeFields[(string) $tpl['key']] ?? []; @endphp @endforeach
{{ t_raw('admin.emailtemplates.col_template') }} {{ t_raw('admin.emailtemplates.fields_col_tokens') }}
{{ t_raw('admin.emailtemplates.fields_all_templates') }}
{{ t_raw('admin.emailtemplates.fields_all_help') }}
@foreach ($globalFields as $f){{ '{{' . $f . '}' . '}' }}@endforeach
{{ (string) $tpl['name'] }}
{{ (string) $tpl['key'] }}
@if ($fields) @foreach ($fields as $f){{ '{{' . $f . '}' . '}' }}@endforeach @else{!! dash() !!}@endif
@php /* /.qm-d2 */ @endphp @endsection