@extends('layout') @section('page_title', 'Customer Details') @section('content')

Customer Profile

Edit Customer Back to List

Customer Information

@if($customer->image_path) {{ $customer->name }} @else
{{ substr($customer->name, 0, 1) }}
@endif

{{ $customer->name }}

Phone
{{ $customer->phone }}
Email
{{ $customer->email ?? '—' }}
CNIC
{{ $customer->cnic ?? '—' }}
Address
{{ $customer->address ?? '—' }}
@if($customer->cnic_front_path || $customer->cnic_back_path)

Identity Documents

@if($customer->cnic_front_path)
Front
CNIC Front
@endif @if($customer->cnic_back_path)
Back
CNIC Back
@endif
@endif

Summary

Total Agreements
{{ $customer->agreements_count }}
Active Instalments
{{ $customer->agreements->where('status', 'active')->count() }}
Total Payments
{{ $customer->payments_count }}
Pending Payments
{{ $customer->payments->where('status', 'pending')->count() }}
Witness Provided
@if($customer->witness_name) Yes @else No @endif
@if($customer->witness_name || $customer->witness_phone || $customer->witness_cnic || $customer->witness_address || $customer->witness_image_path)

Witness Information

@if($customer->witness_image_path) Witness Image @endif
Name
{{ $customer->witness_name ?? '—' }}
Phone
{{ $customer->witness_phone ?? '—' }}
CNIC
{{ $customer->witness_cnic ?? '—' }}
Address
{{ $customer->witness_address ?? '—' }}
@endif

Payment History

@if($customer->payments->isEmpty())

No payment history available.

@else
@foreach($customer->payments->sortByDesc('due_date') as $payment) @endforeach
Payment ID Agreement ID Product Amount Due Date Status Paid Date
{{ $payment->id }} #{{ $payment->agreement->id }} {{ optional($payment->agreement->product)->name ?? '—' }} {{ $currency }}{{ number_format($payment->amount, 2) }} {{ $payment->due_date->format('M d, Y') }} @if($payment->status === 'paid') Paid @else Pending @endif @if($payment->paid_at) {{ $payment->paid_at->format('M d, Y') }} @else — @endif
@endif

Instalments

@if($customer->agreements->isEmpty())

No instalments found for this customer.

@else
@foreach($customer->agreements as $a) @endforeach
ID Product Total Amount Down Payment Instalments Status Actions
{{ $a->id }} {{ optional($a->product)->name ?? '—' }} {{ $currency }}{{ number_format($a->total_amount, 2) }} {{ $currency }}{{ number_format($a->down_payment, 2) }} {{ $a->instalments_count }} × {{ $currency }}{{ number_format($a->instalment_amount, 2) }} @if($a->status === 'completed') Completed @elseif($a->status === 'active') Active @else Draft @endif View
@endif
@endsection