{{-- Campaign execution audience snapshot. Renders the IMMUTABLE record of who a campaign resolved to at dispatch — distinct from the live preview count elsewhere on this page, which moves with the data. Four mutually exclusive states: 1. permission withheld → nothing disclosed, stated plainly 2. executed → the full snapshot 3. legacy (pre-snapshot) → historical audience, read-only 4. not executed yet → professional empty state Aggregation comes from NotificationCenterDispatcher::snapshotSummary() (tested); this partial only presents it. No raw JSON, morph class, internal field key or column name is ever printed — audience types are translated and skip reasons are mapped to human labels. Variables: $notification, $snapshotSummary, $skippedRecipients, $canSeeAudienceDetail, $audienceHeader, $usesLegacyAudience --}} @php $hasSnapshot = is_array($snapshotSummary) && ($snapshotSummary['total'] ?? 0) > 0; $header = is_array($audienceHeader) ? $audienceHeader : null; // Morph class → translated audience label. Never print the class itself. $typeLabel = function (string $morphClass): string { $type = \App\Services\Campaigns\CampaignAudienceResolver::audienceTypeFor($morphClass); return $type !== null ? __('admin.campaign_groups.audience.' . $type) : __('admin.notification_center.snapshot.other_recipients'); }; // Skip reasons are stored as stable machine keys; map to sentences, and // fall back to a generic label rather than leaking an unknown key. $skipLabel = function (string $reason): string { $key = 'admin.notification_center.snapshot.skip.' . $reason; return __($key) === $key ? __('admin.notification_center.snapshot.skip.unknown') : __($key); }; @endphp @push('styles') @endpush
{{ __('admin.notification_center.snapshot.explainer') }}
{{ __('admin.notification_center.snapshot.preview_vs_actual', [ 'preview' => number_format((int) $notification->audience_count), 'actual' => number_format((int) $header['total']), ]) }}
@endif {{-- Selected Campaign Groups, as recorded AT EXECUTION. Read from the header, not the live relation, so a group renamed or archived afterwards still shows what was actually used. --}} @if (! empty($header['groups']))| {{ __('admin.notification_center.snapshot.skip_reason') }} | {{ __('admin.notification_center.snapshot.count') }} |
|---|---|
| {{ $skipLabel((string) $reason) }} | {{ number_format($count) }} |
| {{ __('admin.notification_center.recipients_table.recipient') }} | {{ __('admin.notification_center.recipients_table.audience') }} | {{ __('admin.notification_center.snapshot.skip_reason') }} | {{ __('admin.notification_center.snapshot.affected_channels') }} | {{ __('admin.notification_center.snapshot.destination') }} |
|---|---|---|---|---|
| {{ $detail['name'] }} | {{ __($audienceTranslation) === $audienceTranslation ? __('admin.notification_center.snapshot.other_recipients') : __($audienceTranslation) }} | {{ $skipLabel((string) $snapshot->skip_reason) }} | @forelse ($affectedChannels as $channel) {{ __('admin.notification_center.channels.' . $channel) }} @empty — @endforelse |
@forelse ($destinations as $channel => $destination)
{{ $channel }}: {{ $destination }}
@empty
—
@endforelse
|
{{ __('admin.notification_center.snapshot.skipped_capped') }}
@endif@isset($header['resolved_at']) {{ __('admin.notification_center.snapshot.resolved_at', [ 'time' => \Illuminate\Support\Carbon::parse($header['resolved_at'])->format('Y-m-d H:i'), ]) }} · @endisset {{ __('admin.notification_center.snapshot.execution_ref') }} NC-{{ $notification->id }}@isset($header['resolved_at'])/{{ \Illuminate\Support\Carbon::parse($header['resolved_at'])->format('YmdHis') }}@endisset
{{-- ── 3. Legacy campaign, executed before snapshots existed ──── --}} @elseif ($usesLegacyAudience){{ __('admin.notification_center.snapshot.legacy_explainer') }}
{{ __('admin.notification_center.snapshot.not_executed_hint') }}