@extends('layouts.app') @section('title', 'Customers') @push('styles') @endpush @section('content')
| Name | Phone | Total Orders | Total Spent | Tag | Assigned To | Last Contacted | Last Order | Action | |
|---|---|---|---|---|---|---|---|---|---|
| {{ $customer->name ?? '—' }} @if($customer->is_blocked) Blocked @endif | {{ $customer->email ?? '—' }} | {{ $customer->phone ?? '—' }} | {{ number_format($customer->total_orders ?? 0) }} | ₦{{ number_format($customer->total_spent ?? 0, 2) }} | {{ ucfirst($tag) }} @php $rs = (int) ($customer->risk_score ?? 0); $rBand = $rs >= 70 ? 'high' : ($rs >= 40 ? 'medium' : 'low'); $rColor = $rBand === 'high' ? 'var(--danger)' : ($rBand === 'medium' ? 'var(--warning)' : 'var(--success)'); @endphp @if($rs > 0) {{ $rs }} @endif | {{-- Assignee chip + inline reassign (owner/manager only) --}} @if($customer->assigned_to && $customer->assignedStaff) {{ optional($customer->assignedStaff->user)->name ?? 'Staff #'.$customer->assigned_to }} @else Unassigned @endif @php // Owner and staff-with-customers.manage get the inline reassign. $canReassign = (! $currentStaff) || ($currentStaff && $currentStaff->can_do('customers.manage')); @endphp @if($canReassign) @endif |
@php
$statusKey = $customer->contact_status ?: 'pending';
$statusInfo = ($contactStatusOptions ?? [])[$statusKey] ?? null;
$followUpDue = $customer->next_follow_up_at && $customer->next_follow_up_at->lte(now());
@endphp
@if($customer->last_contacted_at)
{{ $customer->last_contacted_at->diffForHumans() }}
@if($customer->last_contact_channel)
via {{ ucfirst($customer->last_contact_channel) }}
@if($customer->lastContactedByStaff && optional($customer->lastContactedByStaff->user)->name)
· {{ \Illuminate\Support\Str::words(optional($customer->lastContactedByStaff->user)->name, 1, '') }}
@endif
@endif
@else
Never
@endif
@if($statusInfo && $statusKey !== 'pending')
{{ $statusInfo['label'] }}
@endif
@if($followUpDue)
Follow-up due
@endif
|
{{ $customer->last_order_at ? $customer->last_order_at->diffForHumans() : 'Never' }} | View |
Customers are created automatically when orders are placed. Once you have orders, customer profiles will appear here.