@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); // Provider badge — same palette as /broadcasts + /devices + /team-inbox // so a multi-engine workspace can recognise at a glance which engine // each rule belongs to. $rowProv = strtolower((string) ($row->provider ?? '')); $rowProvBadge = match ($rowProv) { 'baileys' => ['Unofficial API', 'bg-ink-900/5 text-ink-700 border border-ink-200'], 'waba' => ['WABA', 'bg-wa-mint/40 text-wa-deep border border-wa-deep/20'], 'twilio' => ['Twilio', 'bg-[#F22F46]/10 text-[#A12534] border border-[#F22F46]/25'], default => null, }; $lastFired = $row->last_triggered_at?->diffForHumans(null, true); @endphp
{{ $tag }}
{{ $kw }}
@if ($rowProvBadge) {{ $rowProvBadge[0] }} @endif
{{ $matchSub }}
{{ $devicePhone !== '' ? $devicePhone : '-' }}
@if ($deviceName !== '')
{{ $deviceName }}
@endif {{ $tp['label'] }}
{{ number_format((int) $row->trigger_count) }} {{ __('all-time') }}
@if ($lastFired)
{{ __('last') }} {{ $lastFired }} {{ __('ago') }}
@endif @empty @include('user.partials.empty-state', [ '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