@extends('layouts.clivax') @section('content')

Customer Lifetime Value Report

Back to Reports Customers
Total Customers

{{ $stats['total_customers'] }}

Total Revenue

${{ number_format($stats['total_revenue'], 2) }}

Avg. Lifetime Value

${{ number_format($stats['average_lifetime_value'], 2) }}

Top Customer
{{ $stats['top_customer']->name ?? 'N/A' }}
${{ number_format($stats['top_customer']->total_revenue ?? 0, 2) }}
Customer Value Segments
Platinum
$5,000+

{{ $customers->where('total_revenue', '>=', 5000)->count() }}

Gold
$1,000+

{{ $customers->whereBetween('total_revenue', [1000, 4999])->count() }}

Silver
$500+

{{ $customers->whereBetween('total_revenue', [500, 999])->count() }}

Bronze
$100+

{{ $customers->whereBetween('total_revenue', [100, 499])->count() }}

New
$1+

{{ $customers->whereBetween('total_revenue', [1, 99])->count() }}

Prospect
$0

{{ $customers->where('total_revenue', 0)->count() }}

@foreach($customers as $customer) @php $segment = 'Prospect'; $segmentClass = 'secondary'; if ($customer->total_revenue >= 5000) { $segment = 'Platinum'; $segmentClass = 'primary'; } elseif ($customer->total_revenue >= 1000) { $segment = 'Gold'; $segmentClass = 'warning'; } elseif ($customer->total_revenue >= 500) { $segment = 'Silver'; $segmentClass = 'secondary'; } elseif ($customer->total_revenue >= 100) { $segment = 'Bronze'; $segmentClass = 'bronze'; } elseif ($customer->total_revenue >= 1) { $segment = 'New'; $segmentClass = 'success'; } @endphp @endforeach
Customer Customer Type Lifetime Value Shipments Avg. Order Value Customer Since Last Activity Value Segment
{{ strtoupper(substr($customer->name, 0, 1)) }}
{{ $customer->name }} @if($customer->company_name)
{{ $customer->company_name }} @endif
{{ ucfirst($customer->customer_type) }} ${{ number_format($customer->total_revenue, 2) }} {{ $customer->total_shipments }} ${{ number_format($customer->average_shipment_value, 2) }} {{ $customer->first_shipment_date ? $customer->first_shipment_date->format('M d, Y') : $customer->created_at->format('M d, Y') }} {{ $customer->last_shipment_date ? $customer->last_shipment_date->format('M d, Y') : 'No shipments' }} {{ $segment }}
Revenue Distribution by Segment
Customer Distribution by Segment
@endsection @push('scripts') @endpush