@extends('layouts.portal') @section('title', 'View Will - ' . $client->full_name) @section('page_title', 'Will Document Preview') @section('page_subtitle', 'Last Will and Testament') @section('sidebar') @include('agent.partials.sidebar', ['active' => 'wills']) @endsection @push('styles') @endpush @section('content')

Will Document #{{ $will->id }}

{{ ucfirst(str_replace('_', ' ', $will->status)) }}
{{ $client->full_name }} {{ $will->created_at->format('M d, Y') }}
SAMPLE

LAST WILL AND TESTAMENT

Will Reference No: {{ $will->id }}

Date: {{ date('d F Y') }}

I, {{ strtoupper($client->full_name ?? '_________________________') }}, (NRIC/Passport No: {{ $client->ic_number ?? '_________________________' }}), of {{ $client->nationality ?? 'Malaysian' }} nationality, presently residing at {{ $client->address ?? '_________________________' }}, being of sound mind, memory and understanding, do hereby make, publish and declare this to be my LAST WILL AND TESTAMENT, hereby expressly revoking all previous wills, codicils and testamentary dispositions made by me at any time heretofore.

FIRST: REVOCATION

I hereby revoke, annul and cancel all wills, codicils and other testamentary dispositions heretofore made by me, and declare this to be my Last Will and Testament.

@php $allBeneficiaries = []; if (!empty($will->asset_allocations)) { $assetAllocations = is_array($will->asset_allocations) ? $will->asset_allocations : json_decode($will->asset_allocations, true); if (is_array($assetAllocations)) { foreach ($assetAllocations as $asset) { if (!empty($asset['beneficiaries']) && is_array($asset['beneficiaries'])) { foreach ($asset['beneficiaries'] as $beneficiary) { $key = $beneficiary['full_name'] . '|' . ($beneficiary['ic_number'] ?? 'N/A'); if (!isset($allBeneficiaries[$key])) { $allBeneficiaries[$key] = $beneficiary; } } } } } } @endphp @if(!empty($allBeneficiaries))

SECOND: BENEFICIARIES AND DISTRIBUTION

I give, devise and bequeath my estate to my beneficiaries in the manner following:

@foreach($allBeneficiaries as $beneficiary) @endforeach
No.Full NameRelationshipNRIC/Passport
{{ $loop->iteration }} {{ strtoupper($beneficiary['full_name'] ?? 'N/A') }} {{ ucfirst($beneficiary['relationship'] ?? 'N/A') }} {{ $beneficiary['ic_number'] ?? 'N/A' }}
@endif @php $assets = []; $totalAssetValue = 0; if (!empty($will->asset_allocations)) { $assetAllocations = is_array($will->asset_allocations) ? $will->asset_allocations : json_decode($will->asset_allocations, true); $assets = is_array($assetAllocations) ? $assetAllocations : []; foreach ($assets as $a) { if (is_array($a) && isset($a['value'])) { $totalAssetValue += (float) $a['value']; } } } @endphp @if(!empty($assets))

THIRD: SPECIFIC BEQUESTS OF ASSETS

I declare that I am the sole and absolute owner of the following assets, which I hereby give, devise and bequeath as follows:

@foreach($assets as $index => $asset)

{{ $index + 1 }}. I give and bequeath my {{ ucfirst(str_replace('_', ' ', $asset['main_category'] ?? 'Asset')) }} @if(!empty($asset['sub_category'])) ({{ $asset['sub_category'] }}) @endif @if(!empty($asset['description'])) - {{ $asset['description'] }} @endif @if(!empty($asset['address'])) located at {{ $asset['address'] }} @endif @if(!empty($asset['value'])) valued at RM {{ number_format($asset['value'], 2) }} @endif with a monthly income of RM {{ number_format($asset['monthly_income'] ?? 0, 2) }}.

@if(!empty($asset['ownership_type']) && strtolower($asset['ownership_type']) === 'joint')

This asset is jointly owned @if(!empty($asset['ownership_percentage'])) (my share: {{ $asset['ownership_percentage'] }}%) @endif @if(!empty($asset['co_owners'])) with {{ $asset['co_owners'] }} @endif.

@endif @if(isset($asset['beneficiaries']) && !empty($asset['beneficiaries']))

This asset shall be distributed to the following beneficiaries:

@foreach($asset['beneficiaries'] as $beneficiary)

{{ strtoupper($beneficiary['full_name'] ?? 'N/A') }} (NRIC: {{ $beneficiary['ic_number'] ?? 'N/A' }}), {{ ucfirst($beneficiary['relationship'] ?? 'N/A') }}, entitled to {{ $beneficiary['percentage'] ?? 0 }}% share thereof. @if(!empty($beneficiary['email'])) Contact: {{ $beneficiary['email'] }} @endif @if(!empty($beneficiary['phone'])) {{ $beneficiary['phone'] }} @endif @if(!empty($beneficiary['address'])) Address: {{ $beneficiary['address'] }} @endif

@endforeach @endif
@endforeach

The total aggregate value of all assets bequeathed herein is estimated at RM {{ number_format($totalAssetValue, 2) }}.

@else

THIRD: SPECIFIC BEQUESTS OF ASSETS

[No assets specified]

@endif

FOURTH: LIABILITIES

@if($willLiabilities && $willLiabilities->count() > 0)

I declare that I have the following liabilities which shall be paid from my estate prior to distribution:

@foreach($willLiabilities as $liability)
@php // Handle both WillLiability and Liability models $creditor = !empty($liability->creditor) ? $liability->creditor : ($liability->clientLiability->creditor ?? 'N/A'); $accountNumber = !empty($liability->account_number) ? $liability->account_number : ($liability->clientLiability->account_number ?? 'N/A'); $type = $liability->type ?? ($liability->liability_type ?? 'N/A'); $amount = $liability->amount ?? 0; $monthlyPayment = !empty($liability->monthly_payment) ? $liability->monthly_payment : ($liability->clientLiability->monthly_payment ?? 0); $interestRate = !empty($liability->interest_rate) ? $liability->interest_rate : ($liability->clientLiability->interest_rate ?? null); $status = !empty($liability->status) ? $liability->status : ($liability->clientLiability->status ?? 'Active'); $description = $liability->description; $familyMembers = $liability->family_members ?? null; $coBorrower = !empty($liability->co_borrower) ? $liability->co_borrower : ($liability->clientLiability->co_borrower ?? null); @endphp

{{ $loop->iteration }}. I hereby declare that I have a liability with {{ $creditor }} (Account Number: {{ $accountNumber }}). This is a {{ $type }} with an outstanding amount of RM {{ number_format($amount, 2) }}. @if(!empty($interestRate)) The interest rate is {{ $interestRate }}%. @endif The current status of this liability is {{ ucfirst($status) }}.

@if(!empty($description))

Description: {{ $description }}

@endif @if(!empty($familyMembers) && is_array($familyMembers))

Responsibility Sharing: @php $familyMembersList = $client->familyMembers ?? collect(); $fmData = is_array($familyMembers) ? $familyMembers : json_decode($familyMembers, true) ?? []; @endphp @foreach($fmData as $memberId => $memberInfo) @php if (is_array($memberInfo) && isset($memberInfo['id'])) { $memberId = $memberInfo['id']; $percentage = $memberInfo['percentage'] ?? 0; } else { $percentage = 0; } $member = $familyMembersList->where('id', $memberId)->first(); @endphp @if($member)
• {{ $member->full_name ?? $member->name }}: {{ $percentage }}% responsible @endif @endforeach

@elseif(!empty($coBorrower))

Responsible Person: {{ $coBorrower }} (Co-Borrower)

@endif
@endforeach

TOTAL LIABILITIES: RM {{ number_format($willLiabilities->sum('amount') ?? 0, 2) }}

@else

I declare that I have no liabilities outstanding that require payment from my estate.

@endif
@php $hasData = false; $existingWillData = []; $willDate = 'N/A'; $willLocation = 'N/A'; $willExecutor = 'N/A'; $willNotes = 'N/A'; if (isset($instructions['existing_will'])) { $existingWillData = $instructions['existing_will']; $hasData = !empty($existingWillData); // Map the actual field names from the form $willDate = $existingWillData['existing_will_date'] ?? 'N/A'; $willLocation = $existingWillData['existing_will_location'] ?? 'N/A'; $willExecutor = $existingWillData['existing_will_executor'] ?? 'N/A'; $willNotes = $existingWillData['existing_will_notes'] ?? 'N/A'; } @endphp @if($hasData && !empty($existingWillData))

FIFTH: EXISTING WILL INFORMATION

I hereby declare the following information regarding my existing will:

@if($willDate !== 'N/A') @endif @if($willLocation !== 'N/A') @endif @if($willExecutor !== 'N/A') @endif @if($willNotes !== 'N/A') @endif
Will Date:{{ $willDate }}
Will Location/Address:{{ $willLocation }}
Existing Executor:{{ $willExecutor }}
Notes:{{ $willNotes }}
@endif @php $allowanceList = []; if(isset($instructions['allowances']) && is_array($instructions['allowances'])) { foreach($instructions['allowances'] as $allowance) { $allowanceList[] = $allowance; } } @endphp @if(count($allowanceList) > 0)

SIXTH: MONTHLY ALLOWANCES

I hereby direct my Executor to provide the following monthly allowances:

@foreach($allowanceList as $allowance) @endforeach
No.BeneficiaryAmount (RM)DurationConditions
{{ $loop->iteration }} {{ $allowance['beneficiary'] ?? 'Unknown' }} {{ number_format($allowance['amount'] ?? 0, 2) }} {{ $allowance['duration'] ?? 'N/A' }} {{ $allowance['conditions'] ?? 'N/A' }}
@endif @php $guardianList = []; if(isset($instructions['guardians']) && is_array($instructions['guardians'])) { foreach($instructions['guardians'] as $guardian) { $guardianList[] = $guardian; } } @endphp @if(count($guardianList) > 0)

SEVENTH: APPOINTMENT OF GUARDIANS AND CARETAKERS

I hereby appoint the following as Guardian(s) and Caretaker(s) for minor beneficiaries and direct my Executor to pay them monthly fees as follows:

@foreach($guardianList as $guardian) @endforeach
No.Guardian NameMonthly Fee (RM)Beneficiaries Under Care
{{ $loop->iteration }} {{ strtoupper($guardian['name'] ?? 'Unknown') }} {{ number_format($guardian['amount'] ?? 0, 2) }} {{ !empty($guardian['beneficiaries']) ? implode(', ', (array)$guardian['beneficiaries']) : 'N/A' }}
@endif @php $giftList = []; // From will relationship (database WillGift table) if(isset($will->gifts) && is_object($will->gifts) && method_exists($will->gifts, 'count') && $will->gifts->count() > 0) { foreach($will->gifts as $gift) { $giftList[] = [ 'description' => $gift->description ?? 'Gift', 'recipient' => $gift->recipient_name ?? 'Unknown', 'value' => $gift->value ?? 0 ]; } } // From instructions (fallback or additional gifts) if(isset($instructions['gifts']) && is_array($instructions['gifts']) && count($instructions['gifts']) > 0) { foreach($instructions['gifts'] as $gift) { $giftList[] = $gift; } } @endphp @if(count($giftList) > 0)

EIGHTH: SPECIFIC GIFTS

I hereby give and bequeath the following specific gifts:

@foreach($giftList as $gift) @endforeach
No.DescriptionRecipientValue (RM)
{{ $loop->iteration }} {{ $gift['description'] ?? 'N/A' }} {{ $gift['recipient'] ?? 'N/A' }} {{ number_format($gift['value'] ?? 0, 2) }}
@endif @php $donationList = []; // From will relationship (database WillDonation table) if(isset($will->donations) && is_object($will->donations) && method_exists($will->donations, 'count') && $will->donations->count() > 0) { foreach($will->donations as $donation) { $donationList[] = [ 'organization' => $donation->organization_name ?? 'Organization', 'percentage' => $donation->percentage ?? 0, 'purpose' => $donation->purpose ?? 'General' ]; } } // From instructions (fallback or additional donations) if(isset($instructions['donations']) && is_array($instructions['donations']) && count($instructions['donations']) > 0) { foreach($instructions['donations'] as $donation) { $donationList[] = $donation; } } @endphp @if(count($donationList) > 0)

NINTH: CHARITABLE DONATIONS

I hereby give and bequeath the following charitable donations:

@foreach($donationList as $donation) @endforeach
No.OrganizationPercentagePurpose
{{ $loop->iteration }} {{ $donation['organization'] ?? 'N/A' }} {{ $donation['percentage'] ?? 0 }}% {{ $donation['purpose'] ?? 'General' }}
@endif @php $trusteeList = []; if(isset($instructions['trustees']) && is_array($instructions['trustees'])) { foreach($instructions['trustees'] as $trustee) { $trusteeList[] = $trustee; } } @endphp

TENTH: APPOINTMENT OF TRUSTEES

@if(count($trusteeList) > 0)

I hereby appoint the following as Trustee(s) of this my Will:

@foreach($trusteeList as $index => $trustee)

{{ $index + 1 }}. {{ strtoupper($trustee['full_name'] ?? 'N/A') }} (NRIC: {{ $trustee['ic_number'] ?? 'N/A' }}), {{ ucfirst($trustee['relationship'] ?? 'N/A') }}. @if(!empty($trustee['address'])) Address: {{ $trustee['address'] }} @endif @if(!empty($trustee['email'])) Email: {{ $trustee['email'] }} @endif @if(!empty($trustee['phone'])) Phone: {{ $trustee['phone'] }} @endif

@endforeach @else

[No trustees appointed]

@endif

ELEVENTH: RESIDUAL ESTATE

All the rest, residue and remainder of my estate, both real and personal, of whatsoever nature and wheresoever situated, which I may own or be entitled to at the time of my death, and which is not otherwise effectively disposed of by this my Will, I give, devise and bequeath unto my beneficiaries as specified herein.

TWELFTH: FUNERAL ARRANGEMENTS

I direct that my funeral and burial arrangements be made in a manner befitting my station in life, and that all reasonable expenses thereof be paid from my estate as a first charge thereon.

THIRTEENTH: DISPUTE RESOLUTION

In the event of any dispute arising from the interpretation or administration of this my Will, I direct that the laws of Malaysia shall govern, and the Courts of Malaysia shall have exclusive jurisdiction.

FOURTEENTH: EXECUTOR APPOINTMENT

@php $executors = []; if(isset($instructions['executors']) && is_array($instructions['executors'])) { foreach($instructions['executors'] as $executor) { $executors[] = $executor; } } @endphp @if(count($executors) > 0)

I hereby nominate, constitute and appoint the following to be the Executor(s) of this my Will:

@foreach($executors as $index => $executor)

{{ $index + 1 }}. {{ strtoupper($executor['full_name'] ?? 'N/A') }} (NRIC: {{ $executor['ic_number'] ?? 'N/A' }}), {{ ucfirst($executor['relationship'] ?? 'N/A') }}. @if(!empty($executor['address'])) Address: {{ $executor['address'] }} @endif @if(!empty($executor['email'])) Email: {{ $executor['email'] }} @endif @if(!empty($executor['phone'])) Phone: {{ $executor['phone'] }} @endif

@endforeach @else

[No specific executors appointed]

@endif

IN WITNESS WHEREOF I hereunto set my hand this _____ day of __________ 20_____.

{{ strtoupper($client->full_name ?? 'TESTATOR') }}

@php $witnesses = []; // First priority: database WillWitness relationship if($will->witnesses && $will->witnesses->count() > 0) { foreach($will->witnesses as $witness) { $witnesses[] = [ 'full_name' => $witness->full_name ?? 'Unknown', 'ic_number' => $witness->ic_number ?? $witness->ic ?? 'N/A', 'address' => $witness->address ?? 'N/A', 'phone' => $witness->phone ?? 'N/A' ]; } } // Second priority: from instructions JSON elseif(isset($instructions['witnesses']) && is_array($instructions['witnesses'])) { $witnesses = $instructions['witnesses']; } @endphp @if(count($witnesses) > 0)

SIGNED, PUBLISHED and DECLARED by the above-named Testator as and for their Last Will and Testament in the presence of us:

@foreach($witnesses as $witness) @endforeach
No.Full NameSignatureNRIC/PassportAddressDate & Time
{{ $loop->iteration }} {{ strtoupper($witness['full_name'] ?? 'WITNESS ' . $loop->iteration) }}
{{ $witness['ic_number'] ?? $witness['ic'] ?? '_________________' }} {{ $witness['address'] ?? '_________________________' }} {{ $witness['date'] ?? date('d-m-Y') }} {{ $witness['time'] ?? date('h:i A') }}
@else

SIGNED, PUBLISHED and DECLARED by the above-named Testator as and for their Last Will and Testament in the presence of us:

No.Full NameSignatureNRIC/PassportAddressDate & Time
1WITNESS 1
__________________________________________dd-mm-yyyy hh:mm AM/PM
2WITNESS 2
__________________________________________dd-mm-yyyy hh:mm AM/PM
@endif

ATTESTED BY (Lawyer/Administrator)

Signature: _______________________

Name: _______________________

Date: _______________________

@endsection