@extends('crm.layouts.master') @section('title','Trades') @section('page-css') @endsection @section('main-content')
@if(session('success')) @endif @if(session('error')) @endif @if($errors->any()) @endif
@foreach($trades as $trade) @php $isReversed = method_exists($trade, 'trashed') && $trade->trashed(); @endphp @if($trade->side === 'buy') @elseif($trade->realized_pnl === null) @else @php $realizedPnl = (float) $trade->realized_pnl; $pnlClass = $realizedPnl > 0 ? 'text-success' : ($realizedPnl < 0 ? 'text-danger' : 'text-muted'); $pnlSign = $realizedPnl > 0 ? '+' : ($realizedPnl < 0 ? '-' : ''); @endphp @endif @endforeach
# Client Symbol Side Quantity Price Total P/L Currency Executed By Open Date Close Date Actions
{{ $trade->id }} {{ $trade->lead->fname ?? '' }} {{ $trade->lead->lname ?? '' }} {{ $trade->symbol->name ?? '—' }}
{{ $trade->symbol->tv_symbol ?? '' }}
{{ strtoupper($trade->side) }} @if($isReversed) Reversed @endif {{ rtrim(rtrim(number_format($trade->quantity, 8), '0'), '.') }} {{ number_format($trade->price, 2) }} {{ number_format($trade->total_cost, 2) }}—Unavailable {{ $pnlSign }}{{ $trade->currency }} {{ number_format(abs($realizedPnl), 2) }} {{ $trade->currency }} {{ $trade->executor->name ?? '—' }} @if($trade->position_opened_at) {{ $trade->position_opened_at->format('Y-m-d H:i') }} @elseif($trade->side === 'sell') Unavailable @else — @endif {{ $trade->side === 'sell' ? $trade->traded_at->format('Y-m-d H:i') : '—' }} @if(!$isReversed) @else Reversed trade retained @endif
{{-- Trade Ticket Modal --}} @endsection @section('page-js') {{-- Edit Trade Modal --}} @endsection