@extends('frontend.layouts.user.index') @section('title', __('Wallet Earn Plans')) @push('styles') @endpush @section('content')
{{ __('My Stakes') }}
@if($plans->isEmpty()) @else
@foreach($plans as $i => $plan) @php $dec = (int) setting('site_decimal', 2); $eligibleWallets = $wallets->filter(fn ($w) => $plan->supportsCurrency((int) $w->currency_id)); $isFeatured = $plan->is_featured; $badgeLabel = $plan->planBadgeLabel(); $currencyLabel = $plan->currency_id ? $plan->currency->code : __('All Wallets'); $rateDisplay = $plan->profit_type === \App\Enums\WalletEarnProfitType::Percentage ? number_format((float) $plan->profit_rate, 2) . '%' : number_format((float) $plan->profit_rate, $dec) . ($plan->currency_id ? ' ' . $plan->currency->code : ''); $durationHours = match($plan->duration_unit) { 'hours' => $plan->duration_value, 'months' => $plan->duration_value * 24 * 30, default => $plan->duration_value * 24, }; $planData = [ 'id' => $plan->id, 'name' => $plan->name, 'rate' => (float) $plan->profit_rate, 'rate_display' => $rateDisplay, 'profit_type' => $plan->profit_type->value, 'rate_label' => $plan->profit_type->label(), 'min' => (float) $plan->minimum_amount, 'max' => $plan->maximum_amount ? (float) $plan->maximum_amount : null, 'currency_id' => $plan->currency_id, 'currency_code' => $plan->currency_id ? $plan->currency->code : null, 'duration_value' => $plan->duration_value, 'duration_unit' => $plan->duration_unit, 'duration_label' => $plan->durationLabel(), 'payout' => $plan->payout_frequency->label(), 'payout_value' => $plan->payout_frequency->value, 'auto_approve' => $plan->auto_approve, ]; @endphp
{{-- Badge --}} @if($badgeLabel)
{{ $badgeLabel }}
@endif {{-- Top padding area --}}
{{-- Header: icon + name + tagline --}}
@if($plan->icon) {{ $plan->name }} @else @endif
{{ $plan->name }}
{{ $plan->description ?: __('Earn scheduled rewards while your principal stays locked.') }}
{{-- Reward Rate --}}
{{ number_format((float) $plan->profit_rate, 2) }} @if($plan->profit_type === \App\Enums\WalletEarnProfitType::Percentage) % @endif {{ $plan->profit_type->label() }}
{{-- Pills --}}
{{ $currencyLabel }} {{ $plan->durationLabel() }} {{ $plan->payout_frequency->label() }}
{{-- Divider --}}
{{-- Body: details + bullets --}}
{{ $plan->amountRangeLabel() }} @if($plan->currency_id) {{ $plan->currency->code }} @endif
{{ $plan->payout_frequency->label() }} {{ __('payout') }}
{{ $plan->return_principal ? __('Returned') : __('Not returned') }} {{ __('principal') }}
{{ $plan->auto_approve ? __('Auto') : __('Manual') }} {{ __('approval') }}
{{ $plan->currency_id ? $plan->currency->code . ' ' . __('only') : __('All currencies') }}
{{ $plan->auto_approve ? __('Auto-approved') : __('Manual review') }}
{{ $plan->return_principal ? __('Principal returned') : __('Principal locked') }}
{{-- CTA --}}
@if($eligibleWallets->isEmpty()) @else @endif
@endforeach
@endif
{{-- Stake Modal --}} @endsection @push('scripts') @php $walletsJson = $wallets->map(function ($w) { return [ 'id' => $w->id, 'label' => $w->currency->code . ' — ' . number_format((float) $w->balance, (int) setting('site_decimal', 2)), 'currency_id' => $w->currency_id, 'currency' => $w->currency->code, 'balance' => (float) $w->balance, ]; })->values(); @endphp @endpush