{{-- resources/views/dashboard/wallet/index.blade.php --}} @extends('layouts.user') @section('title', 'Wallet') @section('content') @php $txByAsset = []; foreach ($recentTransactions as $tx) { $txByAsset[strtoupper((string) $tx->asset)][] = $tx; } $donutLabels = array_keys($balances); $donutSeries = array_values(array_map(fn($v) => (float) $v, $balancesUsd ?? [])); $totalAssets = count($balances); $totalBalance = array_sum($donutSeries); $assetIconBase = 'https://cdn.jsdelivr.net/gh/spothq/cryptocurrency-icons@master/32/color/'; @endphp {{-- ── Page Header ── --}}

Wallet

Deposit Withdraw
{{-- ── Portfolio Ring ── --}}
Portfolio
${{ number_format($totalBalance, 2) }}
{{ $totalAssets }} Active Asset{{ $totalAssets !== 1 ? 's' : '' }}
{{-- ── Stats Bar ── --}}
Supported Assets
{{ $cryptocurrencies->count() }}
Active Balances
{{ $totalAssets }}
Deposits
{{ $recentTransactions->where('type', 'deposit')->count() }}
Withdrawals
{{ $recentTransactions->where('type', 'withdrawal')->count() }}
{{-- ── Asset List ── --}}

All Assets

Deposit Withdraw
Asset Balance Trend Transactions
@foreach ($cryptocurrencies as $crypto) @php $assetKey = strtoupper((string) ($crypto->asset ?? ($crypto->symbol ?? $crypto->name))); $bal = $balances[$assetKey] ?? 0; $hasBal = (float) $bal > 0; $assetTxs = $txByAsset[$assetKey] ?? []; $txCount = count($assetTxs); $balUsd = (float) ($balancesUsd[$assetKey] ?? 0); $sparkId = 'spark_' . Str::slug($assetKey); $drawerId = 'drawer_' . Str::slug($assetKey); $assetIconUrl = $assetIconBase . strtolower($assetKey) . '.png'; @endphp
{{ $assetKey }} {{ strtoupper(substr($assetKey, 0, 3)) }}
{{ $crypto->name ?? $assetKey }}
{{ $assetKey }}
@if ($hasBal) {{ number_format((float) $bal, 6) }}
${{ number_format($balUsd, 2) }}
@else 0.00
$0.00
@endif
@if ($txCount > 0) {{ $txCount }} tx @else @endif

{{ $crypto->name ?? $assetKey }} ({{ $assetKey }}) — Transactions

@forelse($assetTxs as $tx) @php $isCredit = $tx->direction === 'credit'; @endphp
{{ $tx->reference }}
{{ ucfirst($tx->type) }} · {{ ucfirst($tx->direction) }} {{ ucfirst($tx->status) }} {{ $tx->created_at?->format('M d, Y H:i') }}
{{ $isCredit ? '+' : '-' }}{{ number_format((float) $tx->amount, 8) }}
{{ $assetKey }}
@empty
No transactions for {{ $assetKey }} yet.
@endforelse
@endforeach
@endsection @push('scripts') @endpush