@php $f = $filters ?? []; $rangeKey = $f['range']['key'] ?? '7d'; $dirCur = $f['dir'] ?? 'all'; $typeCur = $f['type'] ?? 'all'; $deviceCur = $f['deviceId'] ?? null; $qCur = $f['q'] ?? ''; $bucketCur = $f['bucket'] ?? 'daily'; // Avg-response card state — green if we measured a value, neutral if not. $hasReplyTime = ($stats['avgReplyHuman'] ?? '—') !== '—'; @endphp {{-- Sub-header strip --}}
{{ __('More / Message History') }}
{{ __('Message') }} {{ __('history') }}
{{-- preserve other filter params on submit --}} @if ($deviceCur) @endif Export CSV
{{-- KPI strip --}}
{{ __('Total messages') }} {{ ($stats['deltaPct'] ?? 0) >= 0 ? '+' : '' }}{{ $stats['deltaPct'] ?? 0 }}% vs last period
{{ number_format($stats['total'] ?? 0) }} {{ $rangeKey }}
{{ __('Sent') }} {{ $stats['sentPct'] ?? 0 }}%
{{ number_format($stats['sent'] ?? 0) }} {{ __('outgoing') }}
{{ __('Received') }} {{ $stats['receivedPct'] ?? 0 }}%
{{ number_format($stats['received'] ?? 0) }} {{ __('incoming') }}
{{ __('Failed') }} {{ $stats['failPct'] ?? 0 }}%
{{ number_format($stats['failed'] ?? 0) }} {{ __('retry queue') }}
{{ __('Avg response') }} {{ $hasReplyTime ? 'healthy' : 'n/a' }}
{{ $stats['avgReplyHuman'] ?? '—' }} {{ __('to first reply') }}
{{-- Volume chart + direction donut --}}
{{ __('Volume') }}

{{ __('Messages over time') }}

@foreach (['daily', 'hourly', 'weekly'] as $b) @endforeach
{{ __('Direction split') }}

{{ __('Sent vs received') }}

Sent{{ number_format($direction['sent'] ?? 0) }}
Received{{ number_format($direction['received'] ?? 0) }}
Failed{{ number_format($direction['failed'] ?? 0) }}
{{-- Filter bar + table + side detail --}}
@foreach (['all' => 'All', 'out' => 'Sent', 'in' => 'Received', 'fail' => 'Failed'] as $k => $label) @endforeach
@include('user.message-history._rows', ['rows' => $rows])
{{ __('When') }} {{ __('Dir') }} {{ __('Contact') }} {{ __('Message') }} {{ __('Type') }} {{ __('Status') }} {{ __('Open') }}
{{ __('Showing') }} {{ $shownFrom }}–{{ $shownTo }} of {{ number_format($total) }}
@php $base = request()->only(['range','dir','type','device_id','q','bucket']); @endphp @if ($page > 1) Prev @else @endif @php $pagesToShow = []; for ($i = max(1, $page - 2); $i <= min($pageCount, $page + 2); $i++) { $pagesToShow[] = $i; } if (!in_array(1, $pagesToShow, true)) { array_unshift($pagesToShow, 1); } if (!in_array($pageCount, $pagesToShow, true)) { $pagesToShow[] = $pageCount; } @endphp @foreach ($pagesToShow as $p) @if ($p === $page) @else {{ $p }} @endif @endforeach @if ($page < $pageCount) Next @else @endif
{{-- Detail panel --}}
{{-- Bottom: top conversations + types breakdown --}}
{{ __('Top conversations') }}

Most active threads ({{ $rangeKey }})

{{ __('Open inbox') }}
@if (empty($topConvos))
{{ __('No active threads in this range yet.') }}
@else @endif
{{ __('By message type') }}

{{ __('Mix this period') }}

{{-- Charts + interactions handled by resources/js/charts/user-message-history-index.js (auto-loaded by app.js via page="user-message-history-index" on the layout). Do NOT add another