@extends('layouts.app') @section('title', $customer->name) @section('content')
Invoices & Receipts @haspermission('customers.edit') Edit @endhaspermission @haspermission('customers.delete')
@csrf @method('DELETE')
@endhaspermission
{{-- ── Profile Card ── --}}
@if($customer->photo) {{ $customer->name }} @else
{{ $customer->initial }}
@endif
{{ $customer->name }}
@if($customer->father_name)

s/o {{ $customer->father_name }}

@endif {{ $customer->type_label }} {{ $customer->is_active ? 'Active' : 'Inactive' }}

{{ $customer->mobile }}

@if($customer->email)

{{ $customer->email }}

@endif
{{-- ── Documents Card ── --}}
Documents {{ count($customer->documents ?? []) }}
@if($customer->documents && count($customer->documents)) @foreach($customer->documents as $index => $doc)
@php $ext = pathinfo($doc, PATHINFO_EXTENSION); @endphp {{ basename($doc) }}
@haspermission('customers.edit')
@csrf @method('DELETE')
@endhaspermission
@endforeach @else

No documents uploaded.

@endif @haspermission('customers.edit')
@csrf
PDF/JPG/PNG, max 5 MB each
@endhaspermission
{{-- ── Right Column ── --}}
{{-- ── Details Card ── --}}
Customer Details
NID {{ $customer->nid ?? '—' }}
Date of Birth {{ $customer->date_of_birth ? $customer->date_of_birth->format('d M Y') : '—' }}
Mother's Name {{ $customer->mother_name ?? '—' }}
Occupation {{ $customer->occupation ?? '—' }}
City {{ $customer->city ?? '—' }}
Registration Date {{ $customer->effective_registration_date->format('d M Y') }}
Address {{ $customer->address ?? '—' }}
@if($customer->nominee_name)

Nominee
Name {{ $customer->nominee_name }}
NID {{ $customer->nominee_nid ?? '—' }}
Mobile {{ $customer->nominee_mobile ?? '—' }}
Relation {{ $customer->nominee_relation ?? '—' }}
@endif
{{-- ── Linked Flats (Bookings & Sales) ── --}}
Linked Flats
@php $linkedBookings = $customer->bookings ?? collect(); $linkedSales = $customer->sales ?? collect(); $hasLinks = $linkedBookings->count() || $linkedSales->count(); @endphp @if($hasLinks)
@foreach($linkedBookings as $booking) @endforeach @foreach($linkedSales as $sale) @endforeach
Type Flat Project Building Status Date
Booking {{ $booking->flat->flat_number ?? '—' }} {{ $booking->flat->project->project_name ?? '—' }} {{ $booking->flat->building->building_name ?? '—' }} {{ ucfirst($booking->status ?? 'booked') }} {{ $booking->created_at->format('d M Y') }}
Sale {{ $sale->flat->flat_number ?? '—' }} {{ $sale->flat->project->project_name ?? '—' }} {{ $sale->flat->building->building_name ?? '—' }} {{ ucfirst($sale->status ?? 'active') }} {{ $sale->created_at->format('d M Y') }}
@else

No flats linked yet.

@endif
{{-- ── Ledger Summary ── --}}
Ledger Summary

৳ {{ number_format($ledger['total_payable'], 2) }}

Total Payable

৳ {{ number_format($ledger['total_paid'], 2) }}

Total Paid

৳ {{ number_format($ledger['outstanding'], 2) }}

Outstanding Balance

@if($ledger['total_payable'] == 0)
Ledger details will populate after sales & installments are set up.
@endif
{{-- ── Installment Schedule (placeholder) ── --}}
Installment Schedule @if(($customer->installments ?? collect())->count()) {{ $customer->installments->count() }} installments @endif
@if(($customer->installments ?? collect())->count())
@foreach($customer->installments as $inst) @endforeach
# Due Date Amount Due Paid Status
{{ $inst->installment_number ?? $loop->iteration }} {{ $inst->due_date->format('d M Y') }} ৳ {{ number_format((float) $inst->amount_due, 2) }} ৳ {{ number_format((float) $inst->amount_paid, 2) }} @php $statusClass = match ($inst->status ?? 'pending') { 'paid' => 'badge-active', 'partial' => 'bg-warning text-dark', 'overdue' => 'badge-inactive', 'voided' => 'bg-dark', default => 'bg-secondary', }; @endphp {{ ucfirst($inst->status ?? 'pending') }}
@else

No installments yet.

@endif
@endsection