@extends('setting.nav') @section('title', $template->exists ? 'Edit Template' : 'New Template') @section('content')
@include('auto_reply._tabs') @php $action = $template->exists ? route('auto_reply.templates.update', $template->id) : route('auto_reply.templates.store'); // Built here rather than inline: a literal {{token}} inside a Blade // echo would be swallowed by Blade's own parser. $token = fn($name) => '{{' . $name . '}}'; $subjectValue = old('subject', $template->subject ?: 'Re: ' . $token('original_subject')); $starterBody = "

Dear " . $token('customer_name') . ",

\n" . "

Thank you for contacting " . $token('company_name') . ". We have received your enquiry about " . $token('product_name') . " and our team is reviewing it.

\n" . "

One of our specialists will get back to you shortly with the details you asked for.

\n" . "

Warm regards,
" . $token('signature_name') . "
" . $token('company_name') . "

"; $bodyValue = old('body', $template->body ?: ($template->exists ? '' : $starterBody)); @endphp
@csrf @if ($template->exists) @method('PUT') @endif
{{ $template->exists ? 'Edit template' : 'New template' }}
@if ($template->exists) {{ $template->statusLabel() }} @endif
This is a label. What actually decides which template is used is the template assigned on the category itself.
Keeping Re: {{ $token('original_subject') }} makes the acknowledgement thread under the customer's own mail.
HTML is allowed. Placeholders are filled in when the mail is sent.
Cancel @if ($template->exists) @endif
@if ($template->exists)
Approval

Only an approved template is ever sent automatically. Changing the subject or body of an approved template returns it to draft, so nobody's edit goes out unread.

@if ($template->approved_at)

Last approved {{ $template->approved_at->format('d M Y, H:i') }}.

@endif
@foreach (\App\Models\EmailTemplate::STATUSES as $key => $label) @continue($key === $template->status)
@csrf
@endforeach
@csrf @method('DELETE')
@if (!empty($usedBy) && $usedBy->isNotEmpty())
Used by: @foreach ($usedBy as $category) {{ $category->name }} @endforeach — those categories stop replying while this template is not approved.
@endif
@endif
Available placeholders

Click one to insert it at the cursor.

@foreach ($variables as $name => $description) @endforeach
@endsection @section('scripts') @endsection