@extends('layouts.portal') @section('title', 'Client Details - ' . $client->name) @section('page_title', 'Client Tracking') @section('page_subtitle', 'Viewing: ' . $client->name) @section('sidebar') @include('admin.partials.sidebar', ['active' => 'client-tracking']) @endsection @section('content')

{{ $client->name }}

{{ ucfirst($client->status) }} {{ $client->account_type }}

{{ $client->email }}

{{ $client->phone }}

IC: {{ $client->ic_number }}

{{ $stats['total_wills'] }}
Wills
{{ $stats['completed_wills'] }} complete
{{ $stats['total_trusts'] }}
Trusts
{{ $stats['approved_trusts'] }} approved
{{ $stats['total_appointments'] }}
Appointments
{{ $stats['completed_appointments'] }} done
{{ $stats['total_estates'] }}
Estate Cases
@php $willProgress = 0; if ($stats['total_wills'] > 0) { $willProgress = ($stats['completed_wills'] / $stats['total_wills']) * 100; } @endphp

Overall Will Completion

{{ round($willProgress) }}%
{{ $stats['completed_wills'] }} of {{ $stats['total_wills'] }} wills stored {{ $stats['completed_appointments'] }} appointments completed
@if($client->wills->count() > 0)

Wills ({{ $client->wills->count() }})

@foreach($client->wills as $will)

Will #{{ $will->id }}

Type: {{ ucfirst($will->will_type ?? 'Standard') }}

Created: {{ $will->created_at->format('d M Y') }}

{{ ucfirst($will->status) }}
@endforeach
@endif @if($client->trusts->count() > 0)

Trusts ({{ $client->trusts->count() }})

@foreach($client->trusts as $trust)

{{ $trust->trust_name }}

Trustees: {{ $trust->trustees->count() }}

Created: {{ $trust->created_at->format('d M Y') }}

{{ str_replace('_', ' ', ucfirst($trust->status)) }}
@endforeach
@endif @if($client->appointments->count() > 0)

Appointments ({{ $client->appointments->count() }})

@foreach($client->appointments as $appointment)

{{ $appointment->description ?? 'Appointment' }}

{{ $appointment->appointment_date ? $appointment->appointment_date->format('d M Y, H:i') : 'Date not set' }}

@if($appointment->location)

{{ $appointment->location }}

@endif
{{ ucfirst($appointment->status) }}
@endforeach
@endif @if($client->estates->count() > 0)

Estate Cases ({{ $client->estates->count() }})

@foreach($client->estates as $estate)

Case #{{ $estate->case_number ?? $estate->id }}

Assigned: {{ $estate->assignedStaff?->name ?? 'Unassigned' }}

@if($estate->date_of_death)

DOD: {{ $estate->date_of_death->format('d M Y') }}

@endif
{{ str_replace('_', ' ', ucfirst($estate->status)) }}
@endforeach
@endif

Will Processing Timeline

@if($activities)
@foreach($activities as $index => $activity)
@if(!$loop->last)
@endif

{{ $activity['title'] }}

{{ $activity['description'] }}

{{ ucfirst($activity['status']) }}
@if(isset($activity['metadata']) && is_array($activity['metadata']))
@foreach($activity['metadata'] as $key => $value) @if($value)
{{ ucfirst(str_replace('_', ' ', $key)) }}: @if(is_array($value)) {{ implode(', ', $value) }} @else {{ $value }} @endif
@endif @endforeach
@endif

{{ $activity['date']->format('d M Y, H:i') }}

@endforeach
@else

No activity yet

@endif

Personal Info

Date of Birth

{{ $client->date_of_birth ? $client->date_of_birth->format('d M Y') : 'Not provided' }}

Marital Status

{{ ucfirst($client->marital_status ?? 'Not provided') }}

Occupation

{{ $client->occupation ?? 'Not provided' }}

Country

{{ $client->country ?? 'Not provided' }}

@if($client->referredBy)

Referred By

{{ $client->referredBy->name }}

@endif

Registered

{{ $client->created_at->format('d M Y') }}

@endsection