@php /** Shared card markup for /meta-ads — rendered both in the * full page and via the JSON `partial` mode the JS uses for * filter / search / sort updates without a full reload. */ $statusPillClasses = [ 'ACTIVE' => [ 'bg' => 'bg-wa-green/10', 'text' => 'text-wa-deep', 'border' => 'border-wa-green/30', 'dot' => 'bg-wa-green', ], 'PAUSED' => [ 'bg' => 'bg-[#EFE5F5]', 'text' => 'text-[#5B3D8A]', 'border' => 'border-[#D9C7E8]', 'dot' => 'bg-[#5B3D8A]', ], 'SCHEDULED' => [ 'bg' => 'bg-[#13478A]/10', 'text' => 'text-[#13478A]', 'border' => 'border-[#13478A]/30', 'dot' => 'bg-[#13478A]', ], 'DRAFT' => [ 'bg' => 'bg-paper-50', 'text' => 'text-ink-700', 'border' => 'border-paper-200', 'dot' => 'bg-paper-300', ], 'FAILED' => [ 'bg' => 'bg-accent-coral/10', 'text' => 'text-[#A1431F]', 'border' => 'border-accent-coral/30', 'dot' => 'bg-accent-coral', ], ]; $objectiveLabels = [ 'MESSAGES' => 'Messages', 'LINK_CLICKS' => 'Link clicks', 'LEAD_GENERATION' => 'Lead gen', 'CONVERSIONS' => 'Conversions', 'BRAND_AWARENESS' => 'Brand awareness', 'REACH' => 'Reach', 'VIDEO_VIEWS' => 'Video views', ]; @endphp @forelse ($campaigns as $c) @php $pill = $statusPillClasses[$c->status] ?? $statusPillClasses['DRAFT']; $metrics = $c->metrics; $isPaused = $c->status === 'PAUSED'; $iconBg = $c->status === 'ACTIVE' ? 'bg-wa-bubble text-wa-deep' : 'bg-paper-100 text-ink-700'; @endphp
@if ($c->status === 'FAILED' && !empty($c->meta_last_error))
{{ __('Meta sync failed') }}
{{ mb_substr((string) $c->meta_last_error, 0, 180) }}
View details & retry
@endif
@if ($isPaused) @else @endif
{{ $c->name }}
@php $adCur = $c->ad_account?->currency ?? ($adAccount?->currency ?? \App\Models\SystemSetting::get('default_currency', 'USD')); @endphp
{{ $objectiveLabels[$c->optimization_goal] ?? $c->optimization_goal }} · Budget: {!! \App\Support\FormatSettings::display($c->daily_budget, $adCur) !!}/day
{{ ucfirst(strtolower($c->status)) }}
{{ __('Spend') }}
{!! \App\Support\FormatSettings::display($metrics['spend'], $adCur) !!}
{{ __('Impressions') }}
{{ number_format($metrics['impressions']) }}
{{ __('Clicks') }}
{{ number_format($metrics['clicks']) }}
{{ __('Reach') }}
{{ number_format($metrics['reach']) }}
{{ __('Conversions') }}
{{ number_format($metrics['conversions']) }}
{{ __('CTR') }}
{{ number_format($metrics['ctr'], 2) }}%
{{ __('CPC') }}
{!! \App\Support\FormatSettings::display($metrics['cpc'], $adCur) !!}
{{ __('Revenue') }}
{!! \App\Support\FormatSettings::display($metrics['revenue'], $adCur) !!}
Created: {{ $c->created_at?->format('Y-m-d') }} {{ $c->ad_set_count }} Ad Set(s) {{ $c->ad_count }} Ad(s) @if ($c->facebook_id) FB ID: {{ \Illuminate\Support\Str::limit($c->facebook_id, 12, '…') }} @endif @if ($c->ctwa_enabled) {{ __('Click-to-WhatsApp') }} @endif
@empty @include('user.partials.empty-state', [ 'message' => 'No Meta Ads campaigns match the current filters. Try clearing filters or create a new campaign.', 'resetHref' => url('/meta-ads'), 'actionHref' => route('user.meta-ads.create'), 'actionLabel' => 'Create campaign', ]) @endforelse