@extends('layouts.app') @section('title', 'Dashboard') @section('content') @php $invData = $activeInvestments->map(function($inv) { $total = max(1, $inv->start_date->diffInSeconds($inv->end_date)); $elapsed = min($total, $inv->start_date->diffInSeconds(now())); $progress = round(($elapsed / $total) * 100); $daysLeft = max(0, (int) now()->diffInDays($inv->end_date, false)); $hoursLeft = max(0, (int) now()->diffInHours($inv->end_date, false)); return [ 'name' => strtoupper($inv->plan->name), 'start' => $inv->start_date->format('d M'), 'end' => $inv->end_date->format('d M'), 'profit_pct' => $inv->plan->profit_percent, 'amount' => number_format($inv->amount, 0, ',', '.'), 'profit' => number_format($inv->profit_amount, 0, ',', '.'), 'progress' => $progress, 'days_left' => $daysLeft, 'hours_left' => $hoursLeft, 'end_date_ts' => $inv->end_date->timestamp, 'done' => now()->gte($inv->end_date), ]; }); $txData = $recentTransactions->map(function($tx) { $isIn = in_array($tx->type, ['deposit','profit']); $colorMap = ['deposit'=>'#10b981','profit'=>'#10b981','withdraw'=>'#ef4444','invest'=>'#f59e0b']; $iconMap = ['deposit'=>'bi-box-arrow-in-down','profit'=>'bi-graph-up-arrow','withdraw'=>'bi-box-arrow-up','invest'=>'bi-currency-exchange']; $statusColor = $tx->status === 'approved' ? '#10b981' : ($tx->status === 'pending' ? '#f59e0b' : '#ef4444'); $statusIcon = $tx->status === 'approved' ? 'bi-check-circle-fill' : ($tx->status === 'pending' ? 'bi-hourglass-split' : 'bi-x-circle-fill'); return [ 'type' => ucfirst($tx->type), 'date' => $tx->created_at->format('d M Y, H:i'), 'amount' => number_format($tx->amount, 0, ',', '.'), 'is_in' => $isIn, 'color' => $colorMap[$tx->type] ?? '#00ffe5', 'icon' => $iconMap[$tx->type] ?? 'bi-currency-exchange', 'status' => strtoupper($tx->status), 'status_color' => $statusColor, 'status_icon' => $statusIcon, 'reference' => $tx->reference ?? '-', 'description' => $tx->description ?? '-', ]; }); @endphp
BTC/USDT
$67,545.18 +4.89%
24H Change
+4.89%
24H High
$68,120
24H Low
$64,800
Potential Profit
+85.00%
Portfolio
{{ $currencySymbol }} {{ number_format($wallet->balance, 0, ',', '.') }}
Available
{{ $currencySymbol }} {{ number_format($wallet->locked_balance, 0, ',', '.') }}
Locked
{{ $currencySymbol }} {{ number_format($wallet->total_profit, 0, ',', '.') }}
Profit
Active Invest
+ NEW
@if($activeInvestments->isEmpty())

No active trades yet

Open Position
@else @php $invChunks = $invData->chunk(4); $invTotalPg = $invChunks->count(); @endphp @foreach($invChunks as $pgIdx => $chunk)
@foreach($chunk as $inv)
{{ $inv['name'] }}
{{ $inv['start'] }} → {{ $inv['end'] }}
+{{ $inv['profit_pct'] }}%
@if($inv['done']) {{ __('SELESAI') }} @else @endif
Invest
{{ $currencySymbol }} {{ $inv['amount'] }}
Profit
+{{ $currencySymbol }} {{ $inv['profit'] }}
Progress {{ $inv['progress'] }}%
{{ $inv['start'] }} {{ $inv['end'] }}
@endforeach
@endforeach @if($invTotalPg > 1)
@for($i = 0; $i < $invTotalPg; $i++) @endfor
@endif @endif
Recent Transactions
All →
@if($recentTransactions->isEmpty())

No transactions yet

@else @php $txChunks = $txData->chunk(4); $txTotalPg = $txChunks->count(); @endphp @foreach($txChunks as $pgIdx => $chunk)
@foreach($chunk as $tx)
{{ $tx['type'] }}
{{ $tx['date'] }}
{{ $tx['is_in'] ? '+' : '-' }}{{ $currencySymbol }} {{ $tx['amount'] }}
{{ $tx['status'] }}
@endforeach
@endforeach @if($txTotalPg > 1)
@for($i = 0; $i < $txTotalPg; $i++) @endfor
@endif @endif
Market Overview
@foreach([ ['BTC','Bitcoin','BINANCE:BTCUSDT'], ['ETH','Ethereum','BINANCE:ETHUSDT'], ['BNB','BNB Chain','BINANCE:BNBUSDT'], ['SOL','Solana','BINANCE:SOLUSDT'], ] as [$sym, $name, $tvSym])
{{ $sym }}/USDT
{{ $name }}
@endforeach
@endsection