@extends('layouts.customer') @section('title', 'Email Templates') @section('page-title', 'Email Templates') @section('content')

Email Templates

Create and manage your email templates

@customercan('templates.permissions.can_create_templates') Create Template @endcustomercan
@php $viewMode = request()->query('view', 'list'); if (!in_array($viewMode, ['list', 'grid'], true)) { $viewMode = 'list'; } @endphp
@if($templates->count() > 0) @if($viewMode === 'grid')
@foreach($templates as $template)
@php $thumbnail = $template->thumbnail; $thumbnailUrl = null; $thumbnailExists = false; if (is_string($thumbnail) && $thumbnail !== '') { if (preg_match('/^https?:\/\//i', $thumbnail)) { $thumbnailUrl = $thumbnail; $thumbnailExists = true; } else { $relative = ltrim($thumbnail, '/'); if (str_starts_with($relative, 'public/')) { $relative = substr($relative, 7); } $publicRelative = str_starts_with($relative, 'storage/') ? $relative : ('storage/' . $relative); $thumbnailExists = file_exists(public_path($publicRelative)); if ($thumbnailExists) { $thumbnailUrl = asset($publicRelative); } } } @endphp @if($thumbnailUrl && $thumbnailExists) {{ $template->name }} @elseif(!empty($template->html_content)) @else
@endif

{{ $template->name }}

@if(is_array($template->settings) && (($template->settings['origin'] ?? null) === 'ai')) AI @endif
@if($template->description)

{{ $template->description }}

@endif
{{ ucfirst($template->type) }} Used {{ $template->usage_count }} times
View @customercan('templates.permissions.can_edit_templates') @php $builder = is_array($template->grapesjs_data) ? ($template->grapesjs_data['builder'] ?? null) : null; $editRoute = ($builder === 'unlayer') ? 'customer.templates.unlayer.edit' : 'customer.templates.edit'; @endphp Edit @endcustomercan
@endforeach
@else
@foreach($templates as $template) @php $settings = is_array($template->settings) ? $template->settings : []; $isAi = ($settings['origin'] ?? null) === 'ai'; $builder = is_array($template->grapesjs_data) ? ($template->grapesjs_data['builder'] ?? null) : null; $editRoute = ($builder === 'unlayer') ? 'customer.templates.unlayer.edit' : 'customer.templates.edit'; $visibility = 'Private'; if ($template->is_public) { $visibility = 'Public'; } if ($template->is_system || $template->customer_id === null) { $visibility = 'System'; } @endphp @endforeach
Name Type Visibility Used Actions
{{ $template->name }}
{{ ucfirst($template->type) }} @if($isAi) AI @endif
@if($template->description)
{{ $template->description }}
@endif
{{ ucfirst($template->type) }} {{ $visibility }} {{ (int) $template->usage_count }}
View @customercan('templates.permissions.can_edit_templates') Edit @endcustomercan @customercan('templates.permissions.can_create_templates')
@csrf
@endcustomercan @customercan('templates.permissions.can_delete_templates')
@csrf @method('DELETE')
@endcustomercan
@endif
{{ $templates->links() }}
@else

No templates

Get started by creating a new template.

@customercan('templates.permissions.can_create_templates') Create Template @endcustomercan
@endif
@endsection