@foreach ($customers as $index => $customer) @php $creditLimit = (float) ($customer->credit_limit ?? 0); $creditUsed = (float) ($customer->credit_used ?? 0); $creditAvailable = $customer->getAvailableCredit(); $creditPercent = $creditLimit > 0 ? min(100, round(($creditUsed / $creditLimit) * 100, 1)) : 0; @endphp {{ $customers->firstItem() + $index }}
{{ $customer->customer_code }}
{{ $customer->customer_name }}
{{ $customer->ntn ?? '—' }} {{ $customer->owner_cnic ?? '—' }}
{{ $customer->address ?? '—' }}
{{ $customer->sub_locality ? $customer->sub_locality . ',' : '' }} {{ $customer->city ?? '—' }}
{{ $customer->it_status ? 'Yes' : 'No' }}
{{ $customer->channel_type }} · Category {{ $customer->customer_category }}
Phone: {{ $customer->phone ?? '—' }}
{{ number_format($creditUsed, 0) }} / {{ number_format($creditLimit, 0) }} {{ $creditPercent }}%
Available: {{ number_format($creditAvailable, 0) }}
AR: {{ number_format((float) $customer->receivable_balance, 0) }} · AP: {{ number_format((float) $customer->payable_balance, 0) }}
{{ $customer->is_active ? 'Active' : 'Inactive' }}
@can('customer-edit') @endcan
@endforeach