@extends('layouts.app') @section('title', 'Campaign Report — '.$campaign->name) @section('content') @php $counts = collect([ 'pending' => $campaign->recipients->where('status', 'pending')->count(), 'sent' => $campaign->recipients->where('status', 'sent')->count(), 'failed' => $campaign->recipients->where('status', 'failed')->count(), 'bounced' => $campaign->recipients->where('status', 'bounced')->count(), ]); $total = $counts->sum(); $progress = $total > 0 ? round((($counts['sent'] + $counts['failed'] + $counts['bounced']) / $total) * 100, 1) : 0; @endphp

Campaign Report — {{ $campaign->name }}

Sender: {{ $campaign->sender?->name ?? '-' }} <{{ $campaign->sender?->email ?? '-' }}>  ·  Template: {{ $campaign->emailTemplate?->name ?? '-' }}
← Back to Reports
Sent Today
{{ number_format($todaySent) }}
Sent Yesterday
{{ number_format($yesterdaySent) }}
Remaining
{{ number_format($remaining) }}
Pending recipients
ETA
{{ $eta !== null ? $eta.' days' : '—' }}
At current daily rate

Delivery Summary

Pending
{{ number_format($counts['pending']) }}
Total Sent
{{ number_format($counts['sent']) }}
Failed
{{ number_format($counts['failed']) }}
Bounced
{{ number_format($counts['bounced']) }}
Overall progress {{ $progress }}%
@if ($targetCount > 0)
Campaign Target
{{ number_format($counts['sent']) }} / {{ number_format($targetCount) }}
{{ $progressPct ?? 0 }}% of target
@endif

Daily Sending (Last 7 Days)

@php $maxDaily = max(1, (int) $dailyBreakdown->max('sent')); $chartDays = collect(); for ($i = 6; $i >= 0; $i--) { $date = \Carbon\Carbon::now()->subDays($i)->toDateString(); $stat = $dailyBreakdown->first(fn ($d) => (string) $d->date === $date); $chartDays->push([ 'label' => \Carbon\Carbon::parse($date)->format('D'), 'date' => $date, 'sent' => (int) ($stat?->sent ?? 0), 'isToday' => $date === now()->toDateString(), ]); } @endphp
@foreach ($chartDays as $day)
{{ $day['sent'] > 0 ? number_format($day['sent']) : '' }}
{{ $day['label'] }}
@endforeach

Engagement

Subscribed
{{ number_format($subscribedInCampaign) }}
Unsubscribed
{{ number_format($unsubscribedInCampaign) }}
Spam Reports
{{ number_format($spamInCampaign) }}

Recipients ({{ number_format($total) }})

@forelse ($campaign->recipients as $recipient) @php $rclass = match ($recipient->status) { 'sent' => 'ok', 'failed', 'bounced' => 'danger', default => 'muted', }; $sub = $recipient->contact->confirmed_at !== null ? 'subscribed' : 'not confirmed'; @endphp @empty @endforelse
Email Status Subscription Sent At Error
{{ $recipient->contact->email }} {{ ucfirst($recipient->status) }} {{ $sub }} {{ $recipient->sent_at?->format('Y-m-d H:i:s') ?? '—' }} {{ $recipient->error_message ?? '—' }}
No recipients yet.
@endsection