@php $invStatus = $investment->status instanceof \BackedEnum ? $investment->status->value : (string) $investment->status; $plan = $investment->plan; $statusColors = ['active' => 'emerald', 'completed' => 'blue', 'cancelled' => 'red', 'expired' => 'gray']; $statusColor = $statusColors[$invStatus] ?? 'gray'; $totalReturn = (float) ($investment->expected_return ?? 0); $accrued = (float) ($investment->accrued_return ?? 0); $invested = (float) ($investment->amount ?? 0); $returnPct = $invested > 0 ? round(($accrued / $invested) * 100, 2) : 0; $progressToGoal = $totalReturn > 0 ? min(100, round(($accrued / $totalReturn) * 100)) : 0; @endphp {{-- ─── Back + Page header ──────────────────────────────────────────────────── --}}

{{ $plan->name ?? 'Investment' }}

{{ $invStatus }}

Started {{ $investment->starts_at->format('M d, Y') }} · ID #{{ $investment->id }}

@if($invStatus === 'active')
@csrf
@endif
{{-- ─── Stat cards ──────────────────────────────────────────────────────────── --}}

Invested

${{ number_format($invested, 2) }}

Principal amount

ROI Earned

+${{ number_format($accrued, 2) }}

{{ $returnPct }}% of invested

Expected Return

${{ number_format($totalReturn, 2) }}

At maturity

{{ $invStatus === 'active' ? 'Days Remaining' : 'Duration' }}

@if($invStatus === 'active' && $daysLeft !== null) {{ $daysLeft }} days @else {{ $investment->duration ?? '—' }} @endif

{{ $investment->expires_at ? 'Ends ' . \Carbon\Carbon::parse($investment->expires_at)->format('M d, Y') : 'No expiry set' }}

{{-- ─── Progress + Plan details ─────────────────────────────────────────────── --}}
{{-- Progress card --}}
{{-- Time progress --}} @if($investment->starts_at && $investment->expires_at)
Start: {{ $investment->starts_at->format('M d, Y') }} {{ $progress }}% elapsed End: {{ \Carbon\Carbon::parse($investment->expires_at)->format('M d, Y') }}
{{-- Next payout --}} @if($invStatus === 'active' && $investment->next_growth)

Next ROI payout on {{ \Carbon\Carbon::parse($investment->next_growth)->format('M d, Y \a\t H:i') }}

@endif
@endif {{-- ROI goal progress --}}

Accrued

+${{ number_format($accrued, 2) }}

Target

${{ number_format($totalReturn, 2) }}

{{ $progressToGoal }}% of expected return reached

{{-- Plan details sidebar --}}
@if($plan)
Plan
{{ $plan->name }}
Return Rate
{{ $plan->return }}{{ $plan->return_type?->value === 'percentage' ? '%' : '$' }}
Payout
{{ str_replace('_', ' ', $plan->payout_interval?->value ?? 'At maturity') }}
Duration
{{ $plan->duration }}
Min Amount
${{ number_format($plan->min_amount, 2) }}
Max Amount
${{ number_format($plan->max_amount, 2) }}
@if($plan->rating)
Rating
@for($i = 1; $i <= 5; $i++) @endfor
@endif @if($plan->pros)

Highlights

    @foreach(array_filter(explode("\n", $plan->pros)) as $pro)
  • {{ trim($pro) }}
  • @endforeach
@endif
@else

Plan details unavailable.

@endif
{{-- ─── ROI Transaction History ─────────────────────────────────────────────── --}} @if($transactions->isEmpty()) @else
@foreach($transactions as $tx) @php $txType = $tx->type instanceof \BackedEnum ? $tx->type->value : (string) $tx->type; $txStatus = $tx->status instanceof \BackedEnum ? $tx->status->value : (string) $tx->status; $isCredit = in_array($txType, ['roi', 'bonus', 'capital_return']); $typeColors = ['roi' => 'emerald', 'plan_purchase' => 'blue', 'plan_cancellation' => 'red', 'capital_return' => 'violet']; $statusColors = ['completed' => 'emerald', 'pending' => 'amber', 'failed' => 'red']; @endphp @endforeach
Type Amount Date Status
{{ str_replace('_', ' ', ucfirst($txType)) }} {{ $isCredit ? '+' : '-' }}${{ number_format($tx->amount, 2) }} {{ $tx->created_at->format('M d, Y') }} {{ $tx->created_at->format('H:i') }} {{ $txStatus }}

Total ROI: +${{ number_format($roiPayouts->sum('amount'), 2) }}

{{ $transactions->withQueryString()->links() }}
@endif