@php /** @var \Illuminate\Support\Collection $templates */ $catColors = [ 'travel' => 'bg-wa-bubble text-wa-deep', 'healthcare' => 'bg-[#DFF1ED] text-wa-deep', 'education' => 'bg-[#F4E9C9] text-[#7B5A14]', 'ecommerce' => 'bg-accent-coral/15 text-[#A1431F]', 'festival' => 'bg-[#EFE5F5] text-[#5B3D8A]', 'finance' => 'bg-[#13478A]/10 text-[#13478A]', 'utility' => 'bg-paper-50 text-ink-700', ]; $statusDot = [ 'approved' => 'bg-wa-green', 'public' => 'bg-wa-green', 'pending' => 'bg-accent-amber', 'rejected' => 'bg-accent-coral', ]; @endphp @forelse ($templates as $t) @php $cls = $catColors[$t->category] ?? 'bg-paper-50 text-ink-700'; $dot = $statusDot[$t->status] ?? 'bg-paper-300'; // First 5 paragraphs of the body. Body is encrypted text; // we just split on \n\n so the card preview matches what // the operator typed. $bodyHtml = collect(explode("\n\n", (string) $t->template_body)) ->take(5) ->map(fn($p) => '

' . nl2br(e($p)) . '

') ->implode(''); @endphp
{{ $t->template_name }} {{ ucfirst($t->category) }}
{{ $t->status_label }} · {{ ucfirst($t->template_type) }} @if ($t->meta_category) · {{ ucfirst($t->meta_category) }} @endif
@if (!empty($t->header))
{{ \Illuminate\Support\Str::limit($t->header, 100) }}
@endif
{!! $bodyHtml !!}
@if (!empty($t->footer)) @endif @php $btns = is_array($t->buttons) ? $t->buttons : []; @endphp @if (count($btns))
@foreach (array_slice($btns, 0, 3) as $b) {{ $b['text'] ?? 'Button' }} @endforeach @if (count($btns) > 3) +{{ count($btns) - 3 }} {{ __('more') }} @endif
@endif @if ($t->status === 'rejected' && $t->rejection_reason)
Rejected: {{ $t->rejection_reason }}
@endif
Edit template
@empty @include('user.partials.empty-state', [ 'class' => 'col-span-full', 'message' => 'No templates match the current filters. Try clearing filters or submit a new template for review.', 'resetHref' => url('/templates'), 'actionHref' => route('user.templates.create'), 'actionLabel' => 'Create template', ]) @endforelse