At-Risk Customers

{{ $this->getViewData()['total'] ?? 0 }} total
@php $data = $this->getViewData(); $customers = $data['customers'] ?? []; $pagination = [ 'total' => $data['total'] ?? 0, 'per_page' => $data['per_page'] ?? 10, 'current_page' => $data['current_page'] ?? 1, 'total_pages' => $data['total_pages'] ?? 1, 'from' => $data['from'] ?? 0, 'to' => $data['to'] ?? 0, ]; @endphp @if(empty($customers))

No at-risk customers found.

@else @foreach($customers as $index => $customer) @php $riskScoreRaw = $customer['risk_score_raw'] ?? (int) str_replace('%', '', $customer['risk_score']); @endphp @endforeach
Customer Plan Risk Level Last Payment Risk Score Actions
{{ strtoupper(substr($customer['customer'], 0, 1)) }}
{{ $customer['customer'] }}
ID: {{ $customer['id'] }}
@php $planClass = match(strtolower($customer['plan'])) { 'enterprise' => 'plan-enterprise', 'premium' => 'plan-premium', 'basic' => 'plan-basic', default => 'plan-default', }; @endphp {{ $customer['plan'] }} @php $riskLevelClass = match(strtolower($customer['risk_level'])) { 'high' => 'risk-high', 'medium' => 'risk-medium', default => 'risk-low', }; @endphp @if($customer['risk_level'] === 'High') @elseif($customer['risk_level'] === 'Medium') @else @endif {{ $customer['risk_level'] }} @if($customer['last_payment'] === 'Never')
Never
@else
{{ \Carbon\Carbon::parse($customer['last_payment'])->format('Y-m-d') }}
@endif
@php $riskScoreClass = match(true) { $riskScoreRaw >= 80 => 'score-critical', $riskScoreRaw >= 60 => 'score-high', $riskScoreRaw >= 40 => 'score-medium', default => 'score-low', }; @endphp
{{ $customer['risk_score'] }}
@endif
@if(!empty($customers) && $pagination['total_pages'] > 1)
Showing {{ $pagination['from'] }} to {{ $pagination['to'] }} of {{ $pagination['total'] }} customers
@php $startPage = max(1, $pagination['current_page'] - 2); $endPage = min($pagination['total_pages'], $pagination['current_page'] + 2); @endphp @if($startPage > 1) @if($startPage > 2) ... @endif @endif @for($page = $startPage; $page <= $endPage; $page++) @endfor @if($endPage < $pagination['total_pages']) @if($endPage < $pagination['total_pages'] - 1) ... @endif @endif
@endif