@php $rows = $rows ?? collect(); $typePill = $typePill ?? function ($r) { if ($r->reply_type === 'flow') { $flowName = trim((string) optional($r->flow)->flow_name); return [ 'cls' => 'bg-[#D9E5F2] text-[#13478A]', 'label' => $flowName !== '' ? 'Flow / ' . $flowName : 'Flow', ]; } return match ($r->message_type ?: 'text') { 'image' => ['cls' => 'bg-wa-deep/10 text-wa-deep', 'label' => 'Custom / Image'], 'video' => ['cls' => 'bg-wa-deep/10 text-wa-deep', 'label' => 'Custom / Video'], 'document' => ['cls' => 'bg-accent-amber/20 text-[#7B5A14]', 'label' => 'Custom / Document'], 'template' => ['cls' => 'bg-[#F3E9FF] text-[#5B3D8A]', 'label' => 'Custom / Template'], default => ['cls' => 'bg-wa-deep/10 text-wa-deep', 'label' => 'Custom / Text'], }; }; $tilePalette = $tilePalette ?? [ ['cls' => 'bg-wa-mint text-wa-deep'], ['cls' => 'bg-[#D9E5F2] text-[#13478A]'], ['cls' => 'bg-accent-amber/20 text-[#7B5A14]'], ['cls' => 'bg-[#F3E9FF] text-[#5B3D8A]'], ['cls' => 'bg-accent-coral/15 text-[#A1431F]'], ['cls' => 'bg-[#E8F5E9] text-wa-deep'], ]; @endphp
@forelse ($rows as $i => $row) @php $tile = $tilePalette[$i % count($tilePalette)]; $kw = $row->keyword ?: '-'; $tag = mb_strtoupper(mb_substr($kw, 0, 2)); $tp = $typePill($row); $matchSub = match ($row->matching_method) { 'fuzzy' => 'fuzzy / ' . ($row->fuzzy_similarity ?: 80) . '%', 'contains' => 'contains', default => 'exact', }; $deviceName = trim((string) optional($row->device)->device_name); $devicePhone = trim((string) optional($row->device)->phone_number); $content = trim((string) optional($row->selectedContents->first())->content); @endphp
{{ $tag }}

{{ $kw }}

{{ $matchSub }}
{{ $tp['label'] }} {{ number_format((int) $row->trigger_count) }} {{ __('triggers') }}
{{ __('Device') }}
{{ $devicePhone !== '' ? $devicePhone : '-' }}
@if ($deviceName !== '')
{{ $deviceName }}
@endif
{{ __('Updated') }}
{{ optional($row->updated_at)->diffForHumans() ?: '-' }}
@if ($content !== '')

{{ $content }}

@endif
@empty @include('user.partials.empty-state', [ 'class' => 'lg:col-span-2 2xl:col-span-3', 'message' => 'No auto-reply rules match the current filters. Try clearing filters or create a new auto reply.', 'resetButtonAttrs' => 'data-ar-reset', 'actionHref' => url('/auto-reply/create'), 'actionLabel' => 'Create auto reply', ]) @endforelse