@extends('layouts.app') @section('title', __('dashboard.sidebar_marketing')) @section('page_heading', __('dashboard.sidebar_marketing')) @section('content') @php $customerCount = $customers->total(); $reservationValue = $customers->getCollection()->sum('customer_reservations_sum_final_total'); $purchaseValue = $customers->getCollection()->sum('customer_purchases_sum_final_total'); $eventCount = $customers->getCollection()->sum(fn($c) => $c->customer_reservations->count()); @endphp {{-- KPIs --}}
@foreach([ ['fa-solid fa-users','#eff6ff','#2563eb', number_format($customerCount),__('dashboard.total_customers_stat')], ['fa-solid fa-calendar-check','#f0fdf4','#16a34a', number_format($eventCount),'مواعيد الأحداث'], ['fa-solid fa-star','#fffbeb','#d97706', number_format($reservationValue,0),'قيمة الحجوزات'], ['fa-solid fa-bag-shopping','#faf5ff','#7c3aed', number_format($purchaseValue,0),'قيمة المشتريات'], ] as [$icon,$bg,$color,$val,$lbl])
{{ $val }}
{{ $lbl }}
@endforeach
{{-- Shell --}}
{{ __('dashboard.customer_data_extraction') }} {{ number_format($customerCount) }} عميل
Excel @can('view email templates') القوالب @endcan @can('view email campaigns') الحملات @endcan
@if(request()->hasAny(['event_timing','event_month','product_category_id'])) @endif
@if($customers->isEmpty())
@include('layouts.partials.index-empty-state', ['icon'=>'fa-solid fa-bullhorn','title'=>__('dashboard.no_data_found'),'message'=>''])
@else
@foreach([__('dashboard.customer_name'),__('dashboard.contact_info'),__('dashboard.address'),'الحجوزات','المشتريات','مواعيد الأحداث'] as $h) @endforeach @foreach($customers as $customer) @endforeach
{{ $h }}
{{ $customer->name }}
#{{ $customer->id }}
@foreach(array_filter([$customer->phone, $customer->other_phone]) as $phone) @php $clean = '2'.preg_replace('/^0/','',$phone); @endphp
{{ $phone }}
@endforeach @if(!$customer->phone && !$customer->other_phone)@endif
{{ trim(($customer->governorate ? $customer->governorate.' - ' : '').($customer->address ?? '')) ?: '—' }}
{{ number_format($customer->customer_reservations_sum_final_total ?? 0, 0) }}
ج.م
{{ number_format($customer->customer_purchases_sum_final_total ?? 0, 0) }}
ج.م
@foreach($customer->customer_reservations as $r) {{ $r->event_date->format('Y-m-d') }} · {{ Str::limit($r->product->name ?? 'N/A', 12) }} @endforeach
@if($customers->hasPages())
{{ $customers->appends(request()->query())->links() }}
@endif @endif
@endsection