@extends('layouts.portal') @section('title', 'Estate Case Details') @section('page_title', 'Estate Administration') @section('page_subtitle', 'Case: ' . $case->case_number) @php use Illuminate\Support\Facades\Storage; @endphp @section('sidebar') @php $__estateSidebar = match(session('active_role', auth()->user()->role)) { 'staff' => 'staff.partials.sidebar', 'lawyer' => 'lawyer.partials.sidebar', default => 'admin.partials.sidebar' }; @endphp @include($__estateSidebar, ['active' => 'estate']) @endsection @push('styles') @endpush @section('content')

Estate Case Details

{{ $case->case_number }}

@php $statuses = \App\Models\EstateCase::getStatuses(); $statusText = $statuses[$case->status] ?? ucwords(str_replace('_', ' ', $case->status ?? 'Unknown')); @endphp {{ $statusText }}
Deceased Person
@if($case && $case->client)
{{ $case->client->full_name }}
IC: {{ $case->client->ic_number }}
@else
Client Not Found
Case ID: {{ $case->id ?? 'NULL' }} | Client ID: {{ $case->client_id ?? 'Not set' }}
@endif
Date of Death
{{ ($case && $case->date_of_death) ? $case->date_of_death->format('d M Y') : 'Not recorded' }}
Death Certificate #
{{ $case->death_certificate_number ?? 'Not recorded' }}
Assigned Staff
{{ $case->assignedStaff?->name ?? 'Unassigned' }}
{{ $case->assignedStaff?->email ?? '-' }}
@if($case->notes)

Notes

{{ $case->notes }}

@endif

Update Case Status

@csrf

Current: @php $statuses = \App\Models\EstateCase::getStatuses(); echo $statuses[$case->status] ?? ucwords(str_replace('_', ' ', $case->status ?? 'Unknown')); @endphp

Death Certificate Verification

Certificate Path
{{ $case->death_certificate_path ? 'Uploaded' : 'Not uploaded' }}
Verified At
{{ $case->death_certificate_verified_at?->format('d M Y H:i') ?? 'Not verified' }}
Verified By
{{ $case->deathCertificateVerifier->name ?? '-' }}
Certified Copy?
{{ $case->death_certificate_is_certified_copy ? 'Yes' : 'No' }}
@if(!$case->death_certificate_verified_at)
@csrf
@endif

Will Activation

{{ $case->will ? 'Will #' . $case->will->id . ' - status: ' . $case->will->status : 'No will linked to this case.' }}

@if($case->status === 'will_activated' || in_array($case->status, ['certificate_verification']) === false) @if($case->will && $case->will->status !== 'activated' && $case->death_certificate_verified_at)
@csrf
@endif @endif

Executors

@forelse($case->executors as $executor)

{{ $executor->name }} @if($executor->backup_executor) (Backup) @endif

{{ $executor->email }} · {{ $executor->relationship_text }}

{{ ucfirst($executor->acceptance_status) }}
@if($executor->declined_reason)

Decline reason: {{ $executor->declined_reason }}

@endif
@empty

No executors on file yet. Executors are pulled from the will once notified.

@endforelse @if($case->status === 'will_activated' || $case->executors_notified_at)
@csrf
@endif

Beneficiary Notification

{{ $case->beneficiaries_notified_at ? 'Beneficiaries notified on ' . $case->beneficiaries_notified_at->format('d M Y H:i') : 'Beneficiaries have not been notified yet.' }}

@csrf

Lawyer/Admin Review

@forelse($case->reviews as $review)

{{ ucfirst(str_replace('_', ' ', $review->decision)) }} by {{ $review->reviewer->name ?? 'N/A' }} on {{ $review->created_at->format('d M Y') }}

@if($review->notes)

{{ $review->notes }}

@endif
@empty

No review recorded yet.

@endforelse @if($case->status !== 'lawyer_admin_review')
@csrf
@else
@csrf
@endif
@if($case->probate_required)

Probate

Applied Date
{{ $case->probate_applied_date?->format('d M Y') ?? '-' }}
Granted Date
{{ $case->probate_granted_date?->format('d M Y') ?? '-' }}
Reference
{{ $case->probate_reference ?? '-' }}
Court
{{ $case->probate_court ?? '-' }}
@if(!$case->probate_applied_date)
@csrf
@elseif(!$case->probate_granted_date)
@csrf
@endif
@endif

Asset & Liability Verification

@forelse($case->itemVerifications as $item)
{{ ucfirst($item->item_type) }}: {{ $item->item_snapshot['label'] ?? '-' }} {{ ucfirst(str_replace('_', ' ', $item->status)) }}

Declared: RM {{ number_format($item->declared_value, 2) }} · Actual: RM {{ number_format($item->actual_value ?? 0, 2) }}

@empty

No items verified yet.

@endforelse
@csrf

Estate Distribution

@forelse($case->distributions as $dist)

{{ $dist->beneficiary_name }}

RM {{ number_format($dist->calculated_amount, 2) }} {{ $dist->is_minor ? '(Minor - via guardian)' : '' }}

{{ ucfirst($dist->status) }}
@if($dist->status === 'pending')
@csrf
@endif
@empty

Distributions have not been calculated yet.

@endforelse @if(in_array($case->status, ['debts_settling', 'distributing']))
@csrf
@endif @if($case->distributions->count() && $case->distributions->whereNotIn('status', ['paid', 'acknowledged'])->isEmpty() && $case->status !== 'completed')
@csrf
@endif
@endsection