@extends('backEnd.layouts.master') @section('title', 'CRM Profile — ' . ($customer->customer_name ?: $customer->customer_phone)) @push('styles') @include('backEnd.crm.partials.crm-theme-colors') @endpush @section('content')
@if(!empty($churn['is_churn_risk']))
{{ $winBackSettings['label'] ?? ($churn['alert_label'] ?? 'Win-Back Alert') }}
{{ $churn['message'] }}
Send Offer Now
@endif
@php $backRoute = match($customer->pipeline) { 'reminder' => route('admin.crm.reminder'), 'cancelled_queue' => route('admin.crm.cancelled'), default => route('admin.crm.active'), }; @endphp

{{ $customer->customer_name ?: 'Customer' }}

{{ $customer->customer_phone }} · {{ ucfirst(str_replace('_', ' ', $customer->pipeline)) }}
{{ $stats['total'] }}
Total Orders
{{ $stats['delivered'] }}
Delivered
{{ $stats['active'] }}
Active Orders
{{ $customer->follow_up_date?->format('d M Y') ?? '—' }}
Next Contact
Customer Info

Phone: {{ $customer->customer_phone }}

Address: {{ $customer->customer_address ?: '—' }}

CRM Entered: {{ $customer->entered_at?->format('d M Y, h:i A') ?? '—' }}

Auto Reminder: {{ $customer->reminder_at?->format('d M Y') ?? '—' }}

Status: {{ $customer->contact_status_label }}

Birthday @if(!empty($birthday['is_today'])) Today! 🎉 @elseif(!empty($birthday['days_until']) && $birthday['days_until'] <= 7) {{ $birthday['days_until'] }} days left @endif
@if($birthday['has_birthday'])

{{ $birthday['label'] }}@if($birthday['age']) ({{ $birthday['age'] }} yrs)@endif

@if($birthday['wa_message']) Birthday Message @endif @else

Birthday set করলে auto alert পাবেন।

@endif
@csrf @php $months = [1=>'Jan',2=>'Feb',3=>'Mar',4=>'Apr',5=>'May',6=>'Jun',7=>'Jul',8=>'Aug',9=>'Sep',10=>'Oct',11=>'Nov',12=>'Dec']; @endphp
Update Contact
@csrf
@if($customer->note)
Notes
{{ $customer->note }}
@endif
Products Summary
@forelse($products as $p) @empty @endforelse
ProductTimesQtyLast
{{ Str::limit($p['name'], 30) }} {{ $p['times'] }} {{ $p['qty'] }} {{ $p['last_date']?->format('d M Y') }}
No products yet
Purchase Trend @if($trend['direction'] === 'up') ↑ Growing @elseif($trend['direction'] === 'down') ↓ Declining @else → Stable @endif

{{ $trend['summary'] }}

@foreach($trend['series'] as $point) @php $h = $trend['max_amount'] > 0 ? max(4, ($point['amount'] / $trend['max_amount']) * 120) : 4; @endphp
{{ \Illuminate\Support\Str::before($point['label'], ' ') }}
@endforeach
12 month spend: ৳{{ number_format($trend['total_spend']) }} @if($trend['change_pct'] != 0) {{ $trend['change_pct'] > 0 ? '+' : '' }}{{ $trend['change_pct'] }}% recent vs prior @endif
Order History ({{ $orders->count() }})
@forelse($orders as $order) @php $statusClass = match((int)$order->order_status) { 4 => 'crm-order-delivered', 5, 6 => 'crm-order-cancelled', default => '', }; @endphp
#{{ $order->invoice_id }} {{ \App\Models\Order::statusLabel((int)$order->order_status) }}
{{ $order->created_at->format('d M Y, h:i A') }}
@foreach($order->items as $item)
@if($item->product_thumbnail ?? $item->product?->thumbnail) @endif
{{ $item->product_name ?? $item->product?->name }}
Qty: {{ $item->qty ?? $item->quantity ?? 1 }} · ৳{{ number_format($item->unit_price ?? 0) }}
@endforeach
Total: ৳{{ number_format($order->amount) }}
@empty
No orders found for this customer.
@endforelse
@endsection