{{ $customer->name }}

Credit Account Details

@if($customer->credit_status === 'suspended')
@csrf
@else
@csrf
@endif
@if(session('success')) @endif @if(session('error')) @endif

Credit Overview

Credit Limit

{{ currency($customer->credit_limit) }}

Outstanding Balance

{{ currency($customer->outstanding_balance) }}

Available Credit

{{ currency($customer->credit_limit - $customer->outstanding_balance) }}

Credit Status

@php $statusColors = [ 'good' => 'bg-success-100 text-success-800 dark:bg-success-900 dark:text-success-300', 'warning' => 'bg-warning-100 text-warning-800 dark:bg-warning-900 dark:text-warning-300', 'suspended' => 'bg-danger-100 text-danger-800 dark:bg-danger-900 dark:text-danger-300', ]; @endphp {{ ucfirst($customer->credit_status) }}
Credit Utilization @php $percentage = $customer->credit_limit > 0 ? ($customer->outstanding_balance / $customer->credit_limit) * 100 : 0; @endphp {{ number_format($percentage, 1) }}%
@php $color = $percentage >= 100 ? 'bg-danger-600' : ($percentage >= 90 ? 'bg-warning-500' : 'bg-success-500'); @endphp

Customer Information

Name

{{ $customer->name }}

Phone

{{ $customer->phone }}

@if($customer->email)

Email

{{ $customer->email }}

@endif

Customer Type

{{ ucfirst($customer->type) }}

Credit Settings

Days allowed for payment

@php $creditOrders = $customer->orders() ->where('payment_method', 'credit') ->orderBy('created_at', 'desc') ->limit(10) ->get(); @endphp @if($creditOrders->count() > 0)

Recent Credit Orders

Orders paid on credit
@foreach($creditOrders as $order) @endforeach
Order # Date Amount Status Age
{{ $order->order_number }} {{ $order->created_at->format('M d, Y') }} {{ currency($order->total) }} @php $paymentStatusColors = [ 'paid' => 'bg-success-100 text-success-800 dark:bg-success-900 dark:text-success-300', 'partial' => 'bg-warning-100 text-warning-800 dark:bg-warning-900 dark:text-warning-300', 'unpaid' => 'bg-danger-100 text-danger-800 dark:bg-danger-900 dark:text-danger-300', ]; @endphp {{ ucfirst($order->payment_status) }} @php $daysOld = $order->created_at->diffInDays(now()); $overdue = $daysOld > ($customer->payment_terms_days ?? 30); @endphp {{ $daysOld }} days {{ $overdue ? '(overdue)' : '' }}
@endif

Payment History

@forelse($payments as $payment) @empty @endforelse
Date Type Order # Amount Payment Method Notes Recorded By
{{ $payment->created_at->format('M d, Y g:i A') }} @if($payment->type === 'payment') Payment @elseif($payment->type === 'charge') Charge @else Adjustment @endif @if($payment->order) {{ $payment->order->order_number }} @else - @endif {{ $payment->type === 'payment' ? '-' : '+' }}{{ currency($payment->amount) }} {{ $payment->payment_method ?? '-' }} {{ $payment->notes ?? '-' }} {{ $payment->recordedBy->name ?? 'System' }}

No payment history

@if($payments->hasPages())
{{ $payments->links() }}
@endif