@php $rows = $rows ?? collect(); $totals = $totals ?? [ 'total' => 0, 'active' => 0, 'inactive' => 0, 'total_triggers' => 0, 'rules_fired_24h' => 0, 'top_performers' => collect(), ]; $devices = $devices ?? collect(); $currentSearch = $currentSearch ?? ''; $currentDevice = $currentDevice ?? 'all'; $currentStatus = $currentStatus ?? 'all'; $currentType = $currentType ?? 'all'; $currentView = in_array($currentView ?? 'list', ['list', 'grid'], true) ? $currentView : 'list'; $currentPage = method_exists($rows, 'currentPage') ? $rows->currentPage() : 1; $shownCount = method_exists($rows, 'count') ? $rows->count() : 0; $filteredTotal = method_exists($rows, 'total') ? $rows->total() : $shownCount; $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
{{ __('More / Auto Reply') }}
{{ __('Auto') }} {{ __('Reply') }}
{{ $totals['active'] }} active rules New auto reply
{{ __('Active') }} {{ $totals['inactive'] }} paused
{{ $totals['active'] }} / {{ $totals['total'] }} total
{{ __('Total triggered') }} {{ __('all-time') }}
{{ number_format($totals['total_triggers']) }} {{ __('replies sent') }}
{{ __('Fired (24h)') }} {{ $totals['active'] > 0 ? round(($totals['rules_fired_24h'] / max($totals['active'], 1)) * 100) : 0 }}% of active
{{ number_format($totals['rules_fired_24h']) }} {{ __('rules touched') }}
{{ __('Devices') }} {{ __('connected') }}
{{ $devices->count() }} {{ $devices->count() === 1 ? 'sender' : 'senders' }}
{{ __('Top performers') }}

{{ __('Most-triggered rules this week') }}

{{ __('Open analytics') }}
@if ($totals['top_performers']->isEmpty())
{{ __('Nothing fired yet. Once your rules start matching incoming messages, the top performers will appear here.') }}
@else @php $maxTrig = max(1, (int) $totals['top_performers']->max('trigger_count')); @endphp
@foreach ($totals['top_performers'] as $i => $p) @php $pct = max(2, round(($p->trigger_count / $maxTrig) * 100)); @endphp {{ str_pad($i + 1, 2, '0', STR_PAD_LEFT) }}
{{ $p->keyword }}
{{ number_format($p->trigger_count) }}
@endforeach
@endif
{{ __('Tip') }}
{{ __('Stack 3 keywords per rule') }}

{{ __('Customers spell things differently. Group variants in one rule with fuzzy match at 75-80% to catch typos without false positives.') }}

Build a rule
{{-- Bulk-action bar — appears when at least one [data-bulk-row] checkbox is ticked. Wires to /auto-reply/bulk (activate / pause / delete). The endpoint already existed but had no UI before this. --}}
@include('user.auto-reply._rows', [ 'rows' => $rows, 'tilePalette' => $tilePalette, ])
{{ __('Keyword / match') }} {{ __('Device') }} {{ __('Reply type') }} {{ __('Triggered') }} {{ __('Status') }} {{ __('Actions') }}
@include('user.auto-reply._grid', ['rows' => $rows, 'tilePalette' => $tilePalette])
@include('user.partials.pagination', [ 'paginator' => $rows, 'dataAttr' => 'data-ar-page', 'label' => 'auto replies', ])