@extends('frontend.layouts.user.index') @section('title', __('All Ranks')) @section('content') @php $user = auth()->user(); $currencySymbol = siteCurrency('symbol'); $earnedRankIds = collect((array) ($user?->old_ranks ?? [])) ->push($user?->rank_id) ->filter() ->map(fn ($rankId): int => (int) $rankId) ->unique() ->values(); $currentRank = $userRanks->firstWhere('id', $user?->rank_id) ?? $userRanks->first(fn ($rank) => $earnedRankIds->contains((int) $rank->id)); $nextRank = $userRanks->first(fn ($rank) => ! $earnedRankIds->contains((int) $rank->id)); $walletValues = $userRanks->map(fn ($rank) => data_get($rank->features, 'wallet_create', 0)); $maxWallets = $walletValues->contains('unlimited') ? __('Unlimited') : ($walletValues->max() ?? 0); $maxReferral = $userRanks->max('features.referral_level') ?? 0; $maxReward = $currencySymbol . number_format((float) ($userRanks->max('reward') ?? 0),siteDecimalPlaces()); $topVolume = $currencySymbol . number_format((float) ($userRanks->max('transaction_amount') ?? 0),siteDecimalPlaces()); $totalRanks = $userRanks->count(); $unlockedCount = $userRanks ->filter(fn ($rank) => $earnedRankIds->contains((int) $rank->id)) ->count(); $completionPercent = $totalRanks > 0 ? min(100, (int) round(($unlockedCount / $totalRanks) * 100)) : 0; @endphp
@if($userRanks->isNotEmpty())
{{ __('Membership Progress') }}
{{ $currentRank ? __(':name Member', ['name' => $currentRank->name]) : __('No rank yet') }}

{{ __(':unlocked of :total ranks unlocked. Next target: :next with rewards up to :reward, :wallets wallets, and :referrals referral levels.', [ 'unlocked' => $unlockedCount, 'total' => $totalRanks, 'next' => $nextRank ? $nextRank->name : __('Top tier'), 'reward' => $maxReward, 'wallets' => $maxWallets, 'referrals' => $maxReferral, ]) }}

{{ __('Unlocked') }} {{ $completionPercent }}%
{{ __('Current') }}: {{ $currentRank ? $currentRank->name : __('No rank yet') }} {{ __('Next') }}: {{ $nextRank ? $nextRank->name : __('Top tier') }}
{{ __('Ranks') }} {{ $totalRanks }}
{{ __('Unlocked') }} {{ $unlockedCount }}
{{ __('Reward') }} {{ $maxReward }}
{{ __('Volume') }} {{ $topVolume }}
@foreach($userRanks as $rank) @php $isUnlocked = $earnedRankIds->contains((int) $rank->id); $isCurrent = (int) $rank->id === (int) ($user?->rank_id ?? 0); @endphp
$isUnlocked, 'is-current' => $isCurrent, ]) @if($isCurrent) aria-current="step" @endif title="{{ $rank->name }}"> @if($isUnlocked) @else @endif {{ $rank->name }}
@endforeach
@foreach($userRanks as $rank) @php $isUnlocked = $earnedRankIds->contains((int) $rank->id); $isCurrent = (int) $rank->id === (int) ($user?->rank_id ?? 0); $walletLimit = data_get($rank->features, 'wallet_create', 0); $walletLabel = $walletLimit === 'unlimited' ? __('Unlimited') : number_format((float) $walletLimit); $referralLevel = data_get($rank->features, 'referral_level', 0); $accentClass = 'rank-tier-card--accent-' . (($loop->index % 4) + 1); @endphp
$isUnlocked, 'is-current' => $isCurrent, ])>
{{ $rank->name }} $isCurrent, 'fa-check' => $isUnlocked && ! $isCurrent, 'fa-lock' => ! $isUnlocked])> {{ $isCurrent ? __('Current') : ($isUnlocked ? __('Unlocked') : __('Locked')) }}
{{ __(':name Member', ['name' => $rank->name]) }}

{{ $rank->description }}

{{ $currencySymbol . number_format((float) $rank->reward,siteDecimalPlaces()) }} {{ __(':count wallets', ['count' => $walletLabel]) }} {{ __(':count levels', ['count' => number_format((float) $referralLevel)]) }}
@endforeach
@else
@endif
@endsection @push('styles') @endpush