{{-- Header --}}

{{ $campaign->name }}

{{ ucfirst($campaign->status) }}

{{ $campaign->subject }}

@if($campaign->status === 'sending') {{ __('Sending in progress...') }} @endif
{{-- Tab Navigation --}}
@foreach(['overview' => __('Overview'), 'recipients' => __('Messages'), 'opens' => __('Opens'), 'clicks' => __('Clicks'), 'bounces' => __('Bounces')] as $tabKey => $tabLabel) @endforeach
{{-- Overview Tab --}} @if($activeTab === 'overview') {{-- Delivery Section --}}

{{ __('Delivery') }}

{{ number_format($stats['delivered']) }} emails were successfully delivered{{ $stats['bounced'] > 0 ? ', with ' . $stats['bounce_rate'] . '% bounced' : '' }}.

{{ __('Total recipients') }}

{{ number_format($stats['recipients']) }} 100%

{{ __('Delivered') }}

{{ number_format($stats['delivered']) }} {{ $stats['recipients'] > 0 ? round(($stats['delivered'] / $stats['recipients']) * 100, 1) : 0 }}%

{{ __('Rejected') }}

{{ number_format($stats['failed'] ?? 0) }} {{ $stats['recipients'] > 0 ? round((($stats['failed'] ?? 0) / $stats['recipients']) * 100, 1) : 0 }}%

{{ __('Bounced') }}

{{ number_format($stats['bounced']) }} {{ $stats['bounce_rate'] }}%
{{-- Engagement Chart + Stats --}}

{{ __('Engagement') }}

Your email was delivered to {{ number_format($stats['delivered']) }} recipients, opened by {{ $stats['open_rate'] }}% and clicked by {{ $stats['click_rate'] }}%.

{{-- Engagement Funnel Chart --}} @php $funnelMax = max($stats['delivered'], 1); $openPct = round(($stats['opened'] / $funnelMax) * 100); $clickPct = round(($stats['clicked'] / $funnelMax) * 100); $unsubPct = round(($stats['unsubscribed'] / $funnelMax) * 100); @endphp
{{-- Donut chart --}}
@php $openDeg = round(($stats['open_rate'] / 100) * 360); $clickDeg = round(($stats['click_rate'] / 100) * 360); @endphp
{{ $stats['open_rate'] }}% {{ __('opened') }}
{{-- Funnel bars --}}
{{ __('Delivered') }} {{ number_format($stats['delivered']) }}
{{ __('Opened') }} {{ number_format($stats['opened']) }} ({{ $stats['open_rate'] }}%)
{{ __('Clicked') }} {{ number_format($stats['clicked']) }} ({{ $stats['click_rate'] }}%)
{{ __('Unsubscribed') }} {{ number_format($stats['unsubscribed']) }} ({{ $stats['unsub_rate'] }}%)
{{-- Stat Cards --}}

{{ __('Opened') }}

{{ $stats['open_rate'] }}% {{ number_format($stats['opened']) }}

{{ __('Clicked') }}

{{ $stats['click_rate'] }}% {{ number_format($stats['clicked']) }}

{{ __('Unsubscribed') }}

{{ $stats['unsub_rate'] }}% {{ number_format($stats['unsubscribed']) }}

{{ __('Spam reports') }}

0% 0
{{-- Details Section --}}

{{ __('Details') }}

{{ __('An overview of this campaign\'s details, message and settings.') }}

{{ __('From') }}

{{ $campaign->emailAccount?->display_name ?? $campaign->emailAccount?->email ?? __('N/A') }}

{{ __('"Reply to" email') }}

{{ $campaign->emailAccount?->email ?? __('N/A') }}

{{ __('Send time') }}

{{ $campaign->sent_at?->format('M j, Y \a\t g:i A') ?? ($campaign->scheduled_at?->format('M j, Y \a\t g:i A') ?? __('Not sent yet')) }}

{{ __('Campaign type') }}

{{ ucfirst(str_replace('_', ' ', $campaign->type ?? 'regular')) }}

{{ __('Subject') }}

{{ $campaign->subject }}

@if($campaign->preview_text)

{{ __('Preview text') }}

{{ $campaign->preview_text }}

@endif

{{ __('Audience') }}

{{ ucfirst($campaign->audience_type ?? 'all') }} — {{ number_format($stats['recipients']) }} {{ __('recipients') }}

{{ __('Created by') }}

{{ $campaign->createdBy?->name ?? __('Unknown') }}

{{-- Link Performance --}} @if($links->isNotEmpty())

{{ __('Link Performance') }}

@foreach($links as $link) @endforeach
{{ __('URL') }} {{ __('Clicks') }}

{{ $link->original_url }}

{{ number_format($link->clicks_count) }}
@endif @endif {{-- Recipients Tab (Messages) --}} @if($activeTab === 'recipients')

{{ __('All Recipients') }}

@forelse($recipients as $recipient) @empty @endforelse
{{ __('Contact') }} {{ __('Email') }} {{ __('Status') }}

{{ $recipient->contact?->full_name ?? __('Unknown') }}

{{ $recipient->email ?? $recipient->contact?->email ?? '--' }}

@php $statusColors = [ 'pending' => 'bg-surface text-muted', 'sent' => 'bg-info/15 text-info', 'delivered' => 'bg-success/15 text-success', 'opened' => 'bg-emerald-100 text-emerald-700', 'clicked' => 'bg-teal-100 text-teal-700', 'bounced' => 'bg-danger/15 text-danger', 'unsubscribed' => 'bg-orange-100 text-orange-700', 'failed' => 'bg-danger/15 text-danger', ]; @endphp {{ ucfirst($recipient->status) }}
{{ __('No recipients found.') }}
@if($recipients->hasPages())
{{ $recipients->links() }}
@endif
@endif {{-- Opens Tab --}} @if($activeTab === 'opens')

{{ __('Who opened this campaign') }}

{{ number_format($stats['opened']) }} recipients opened your email ({{ $stats['open_rate'] }}% open rate)

@forelse($openedRecipients as $recipient) @empty @endforelse
{{ __('Contact') }} {{ __('Email') }} {{ __('Opened at') }}
{{ $recipient->contact?->full_name ?? __('Unknown') }} {{ $recipient->email ?? $recipient->contact?->email ?? '--' }} {{ $recipient->opened_at?->format('M j, Y \a\t g:i A') ?? '--' }}
{{ __('No opens recorded yet.') }}
@if($openedRecipients->hasPages())
{{ $openedRecipients->links() }}
@endif
@endif {{-- Clicks Tab --}} @if($activeTab === 'clicks')
{{-- Link performance --}}

{{ __('Link clicks') }}

{{ number_format($stats['clicked']) }} recipients clicked a link ({{ $stats['click_rate'] }}% click rate)

@forelse($links as $link) @empty @endforelse
{{ __('URL') }} {{ __('Clicks') }}

{{ $link->original_url }}

{{ number_format($link->clicks_count) }}
{{ __('No link clicks yet.') }}
{{-- Who clicked --}}

{{ __('Who clicked') }}

@forelse($clickedRecipients as $recipient) @empty @endforelse
{{ __('Contact') }} {{ __('Email') }} {{ __('Clicked at') }}
{{ $recipient->contact?->full_name ?? __('Unknown') }} {{ $recipient->email ?? $recipient->contact?->email ?? '--' }} {{ $recipient->clicked_at?->format('M j, Y \a\t g:i A') ?? '--' }}
{{ __('No clicks recorded yet.') }}
@if($clickedRecipients->hasPages())
{{ $clickedRecipients->links() }}
@endif
@endif {{-- Bounces Tab --}} @if($activeTab === 'bounces')

{{ __('Bounced & Failed') }}

{{ number_format($stats['bounced'] + ($stats['failed'] ?? 0)) }} emails bounced or failed to deliver

@forelse($bouncedRecipients as $recipient) @empty @endforelse
{{ __('Contact') }} {{ __('Email') }} {{ __('Status') }}
{{ $recipient->contact?->full_name ?? __('Unknown') }} {{ $recipient->email ?? $recipient->contact?->email ?? '--' }} {{ ucfirst($recipient->status) }}
{{ __('No bounces or failures.') }}
@if($bouncedRecipients->hasPages())
{{ $bouncedRecipients->links() }}
@endif
@endif