@extends('crm.layouts.master') @section('title', $lead->fname . ' Portfolio') @section('page-css') @endsection @section('main-content')
@if(session('status')) @endif {{-- Equity summary --}}
Total Cash
{{ number_format($portfolio['totalCash'], 2) }}
Position Value
{{ number_format($portfolio['totalPositionValue'], 2) }}
Total Equity
{{ number_format($portfolio['totalEquity'], 2) }}
KYC Status
@php $ks = $lead->kyc_status; @endphp {{ ucwords(str_replace('_',' ',$ks)) }}
{{-- Wallets + Main Currency Selector --}}
@foreach($portfolio['wallets'] as $currency => $wallet)
{{ $currency }} @if(($lead->main_currency ?? 'USD') === $currency) Main @endif
{{ number_format($wallet->balance, 2) }}
@endforeach
{{-- Set Main Currency --}}
Main Display Currency (Portal)
@csrf @method('PATCH')
This currency appears as the primary balance in the client's portal dashboard.
{{-- Positions --}}
Open Positions
@if($portfolio['positions']->isEmpty())

No open positions.

@else
@foreach($portfolio['positions'] as $row) @php $symId = $row['position']->symbol_id; $history = $priceHistories[$symId] ?? collect(); $pnlPct = ($row['position']->avg_price > 0 && $row['latest_price'] > 0) ? (($row['latest_price'] - $row['position']->avg_price) / $row['position']->avg_price) * 100 : 0; @endphp @endforeach
Symbol Quantity Avg Price Latest Price Current Value Unrealised P&L
{{ $row['symbol']->name ?? '—' }}
{{ $row['symbol']->tv_symbol ?? '' }} ▼ chart
{{ rtrim(rtrim(number_format($row['position']->quantity, 8), '0'), '.') }} {{ number_format($row['position']->avg_price, 2) }} {{ $row['latest_price'] > 0 ? number_format($row['latest_price'], 2) : '—' }} {{ $row['current_value'] > 0 ? number_format($row['current_value'], 2) : '—' }} {{ $row['latest_price'] > 0 ? ($row['unrealised_pnl'] >= 0 ? '+' : '') . number_format($row['unrealised_pnl'], 2) : '—' }} @if($row['latest_price'] > 0) ({{ ($pnlPct >= 0 ? '+' : '') . number_format($pnlPct, 2) }}%) @endif
@endif
{{-- Deposits --}}
Deposits
@foreach($deposits as $dep) @endforeach
#AmountCurRefStatusDateAction
{{ $dep->id }} {{ number_format($dep->amount, 2) }} {{ $dep->currency }} {{ $dep->reference ?? '—' }} {{ ucfirst($dep->status) }} {{ $dep->created_at->format('Y-m-d') }} @if($dep->status === 'pending')
@csrf
@csrf
@else — @endif
{{-- Trade history --}}
Trade History
@foreach($trades as $trade) @endforeach
#SymbolSideQtyPriceTotalDate
{{ $trade->id }} {{ $trade->symbol->name ?? '—' }} {{ strtoupper($trade->side) }} {{ rtrim(rtrim(number_format($trade->quantity, 8),'0'),'.') }} {{ number_format($trade->price, 2) }} {{ number_format($trade->total_cost, 2) }} {{ $trade->traded_at->format('Y-m-d') }}
{{-- Execute Trade Modal --}} {{-- Add Deposit Modal --}} @endsection @section('page-js') @endsection