@extends('layouts.app') @section('title', __('dashboard.Email Campaigns')) @section('page_heading', __('dashboard.Email Campaigns')) @section('content') @php $col = $campaigns->getCollection(); $statusMap = [ 'draft' => ['#f8fafc','#64748b','مسودة'], 'scheduled' => ['#eff6ff','#2563eb','مجدولة'], 'sending' => ['#fffbeb','#d97706','جاري الإرسال'], 'completed' => ['#f0fdf4','#16a34a','مكتملة'], 'failed' => ['#fef2f2','#dc2626','فشلت'], ]; @endphp {{-- KPIs --}}
@foreach([ ['fa-solid fa-envelope','#eff6ff','#2563eb', $campaigns->total(), __('dashboard.total_campaigns')], ['fa-solid fa-pen-to-square', '#f8fafc','#64748b', $col->where('status','draft')->count(), 'مسودة'], ['fa-solid fa-paper-plane', '#f0fdf4','#16a34a', $col->where('status','completed')->count(),'مكتملة'], ['fa-solid fa-circle-check', '#fffbeb','#d97706', number_format($col->sum('successful_sends')),__('dashboard.successful_sends')], ] as [$icon,$bg,$color,$val,$lbl])
{{ $val }}
{{ $lbl }}
@endforeach
{{-- Shell --}}
{{ __('dashboard.Email Campaigns') }} {{ $campaigns->total() }}
بيانات العملاء @can('view email templates') القوالب @endcan @can('create email campaigns') {{ __('dashboard.Add New Campaign') }} @endcan
@if($campaigns->isEmpty())
@include('layouts.partials.index-empty-state', ['icon'=>'fa-solid fa-bullhorn','title'=>__('dashboard.No campaigns found'),'message'=>''])
@else
@foreach([__('dashboard.Campaign Name'),__('dashboard.Template'),__('dashboard.Status'),__('dashboard.Recipients'),__('dashboard.Sent At')] as $h) @endforeach @foreach($campaigns as $c) @php [$bg,$color,$label] = $statusMap[$c->status] ?? ['#f8fafc','#64748b',$c->status]; @endphp @endforeach
{{ $h }}{{ __('dashboard.Actions') }}
{{ $c->name }}
{{ $c->creator->name ?? '—' }}
{{ $c->template->name }} {{ $label }}
{{ $c->total_recipients }}
✓ {{ $c->successful_sends }} ✗ {{ $c->failed_sends }}
{{ $c->sent_at ? $c->sent_at->format('Y-m-d H:i') : '—' }} @canany(['send email campaigns','delete email campaigns'])
@can('send email campaigns') @if($c->status === 'draft')
@csrf
@endif @endcan @can('delete email campaigns')
@csrf @method('DELETE')
@endcan
@endcanany
{{ $campaigns->links() }}
@endif
@endsection