@extends('central.super.layout') @section('title', __('central.EditEmailTemplate') . ': ' . $template->name) @section('content') @php $defaultLocale = \App\Models\Central\CentralLanguage::defaultLocale(); $isTranslation = !empty($currentLocale); $editSubject = $isTranslation ? old('subject', $translation->subject ?? '') : old('subject', $template->subject); $editBody = $isTranslation ? old('body_html', $translation->body_html ?? '') : old('body_html', $template->body_html); $translatedLocales = $template->translations->pluck('locale')->toArray(); @endphp {{-- Language Tabs --}} @if($languages->count() > 1)
{{ __('central.Language') }}: {{ __('central.Default') }} ({{ strtoupper($defaultLocale) }}) @foreach($languages as $lang) @if($lang->locale !== $defaultLocale) @if($lang->flag) @endif {{ $lang->name }} @if(in_array($lang->locale, $translatedLocales)) @else @endif @endif @endforeach
@endif {{-- Translation notice --}} @if($isTranslation)

{{ __('central.EditingTranslation') }}: {{ $languages->firstWhere('locale', $currentLocale)->name ?? strtoupper($currentLocale) }}

{{ __('central.TranslationFallbackNotice') }}

@endif
@csrf @method('PUT') @if($isTranslation) @endif
{{-- Subject --}}

{{ __('central.EmailSubject') }}

@error('subject')
{{ $message }}
@enderror @if($isTranslation)

{{ __('central.DefaultLabel') }}: {{ $template->subject }}

@else

{{ __('central.SubjectVariableHint') }}

@endif
{{-- HTML Body --}}

{{ __('central.EmailBodyHtml') }}

@if($isTranslation && !$translation) @endif
@error('body_html')
{{ $message }}
@enderror
{{-- Actions --}}
@if(!$isTranslation) @else
@if($translation) {{ __('central.TranslationExists') }} @else {{ __('central.NewTranslation') }} @endif
@endif
@if($isTranslation && $translation) @endif {{ __('central.Preview') }}
{{-- Sidebar --}}
{{-- Variables reference --}} {{-- Test email form (outside the main form) --}}
@if($isTranslation && $translation)
@csrf @method('DELETE')
@endif {{-- Separate test-email form --}}
@csrf @if($isTranslation) @endif
@error('test_email')
{{ $message }}
@enderror
@push('scripts') @endpush @endsection