@php use App\Support\SymbolPresentation; @endphp @extends('portal.layouts.master') @section('title', 'Trade History') @section('page-title', 'Trade History') @section('extra-css') /* ── Stat cards ── */ .hs-cards { display: grid; grid-template-columns: repeat(5, 1fr); gap: .75rem; margin-bottom: 1rem; } @media (max-width: 1200px) { .hs-cards { grid-template-columns: repeat(3, 1fr); } } @media (max-width: 700px) { .hs-cards { grid-template-columns: repeat(2, 1fr); } } @media (max-width: 480px) { .hs-cards { grid-template-columns: 1fr; } } .hs-card { background: var(--bg-card); border: 1px solid var(--border); border-radius: 10px; padding: .85rem 1rem .6rem; display: flex; flex-direction: column; min-height: 108px; position: relative; overflow: hidden; } .hs-card::before { content: ''; position: absolute; inset: 0; background: var(--hc-grad, transparent); opacity: .18; pointer-events: none; border-radius: 10px; } .hs-card--blue { --hc-grad: linear-gradient(135deg,#3b82f6,transparent 65%); } .hs-card--green { --hc-grad: linear-gradient(135deg,#0ecb81,transparent 65%); } .hs-card--red { --hc-grad: linear-gradient(135deg,#f6465d,transparent 65%); } .hs-card--purple { --hc-grad: linear-gradient(135deg,#8b5cf6,transparent 65%); } .hs-card--amber { --hc-grad: linear-gradient(135deg,#f59e0b,transparent 65%); } .hs-card .hc-label { font-size: .6rem; font-weight: 700; letter-spacing: .07em; text-transform: uppercase; color: var(--text-secondary); margin-bottom: .25rem; } .hs-card .hc-value { font-size: 1.65rem; font-weight: 800; line-height: 1; letter-spacing: -.02em; color: var(--text-primary); margin-bottom: auto; } .hs-card--green .hc-value { color: #0ecb81; } .hs-card--red .hc-value { color: #f6465d; } .hs-card--amber .hc-value { color: #f59e0b; } .hs-card--purple .hc-value { color: #a78bfa; } .hc-chart { margin-top: .5rem; height: 38px; overflow: hidden; } .hc-chart svg { width: 100%; height: 100%; display: block; } /* donut gauge */ .hc-gauge { display: flex; align-items: center; justify-content: flex-end; margin-top: .3rem; } .hc-gauge svg { width: 52px; height: 52px; } .hc-gauge-track { fill: none; stroke: rgba(245,158,11,.2); stroke-width: 6; } .hc-gauge-fill { fill: none; stroke: #f59e0b; stroke-width: 6; stroke-linecap: round; transform: rotate(-90deg); transform-origin: 50% 50%; } .hc-gauge-num { font-size: .85rem; font-weight: 800; fill: #f59e0b; } /* ── Filters ── */ .hs-filters { display: flex; gap: .65rem; align-items: center; flex-wrap: wrap; margin-bottom: 1rem; } .hs-filters .form-select, .hs-filters .form-control { background: var(--bg-card) !important; border-color: var(--border) !important; color: var(--text-primary) !important; font-size: .82rem; padding: .4rem .7rem; border-radius: 7px; min-width: 0; } .hs-filters .form-select { max-width: 160px; } .hs-filters .form-control { max-width: 150px; } .hs-filters .form-control::placeholder { color: var(--text-muted); } /* ── Table ── */ .hs-table-header { padding: .8rem 1rem; font-size: .72rem; font-weight: 700; letter-spacing: .07em; text-transform: uppercase; color: var(--text-secondary); border-bottom: 1px solid var(--border); } .symbol-cell { display: flex; align-items: center; gap: .55rem; } .symbol-mini-icon { width: 28px; height: 28px; border-radius: 50%; background: var(--bg-tertiary); display: flex; align-items: center; justify-content: center; font-size: .82rem; overflow: hidden; flex-shrink: 0; } .symbol-mini-icon img { width: 16px; height: 16px; object-fit: contain; border-radius: 50%; } .badge-filled { display: inline-block; padding: .18rem .55rem; border-radius: 4px; font-size: .65rem; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; background: rgba(14,203,129,.15); color: #0ecb81; border: 1px solid rgba(14,203,129,.25); } .badge-buy { display: inline-block; padding: .22rem .6rem; border-radius: 5px; font-size: .7rem; font-weight: 700; background: rgba(14,203,129,.15); color: #0ecb81; border: 1px solid rgba(14,203,129,.25); } .badge-sell { display: inline-block; padding: .22rem .6rem; border-radius: 5px; font-size: .7rem; font-weight: 700; background: rgba(246,70,93,.15); color: #f6465d; border: 1px solid rgba(246,70,93,.25); } @endsection @section('content') @php $totalTrades = $trades->total(); $gaugeR = 20; $gaugeCircum = 2 * M_PI * $gaugeR; $gaugeDash = $openPositions > 0 ? $gaugeCircum * 0.72 : 0; @endphp {{-- Stat cards --}}
{{-- 1. Total Trades --}}
Total Trades
{{ $totalTrades }}
{{-- 2. Total Buys --}}
Total Buys
{{ $buyCount }}
{{-- 3. Total Sells --}}
Total Sells
{{ $sellCount }}
@if($sellCount > 0) @else {{-- flat line when no sells --}} @endif
{{-- 4. Total Volume --}}
Total Volume
${{ number_format($totalVolume, 2) }}
@php $vbars = [6,10,8,14,10,18,14,20,16,24,18,28,20,26,22,30,24,28,26,32]; @endphp @foreach($vbars as $vi => $vh) @endforeach
{{-- 5. Open Positions --}}
Open Positions
{{ $openPositions }}
{{ $openPositions }}
{{-- Filters --}}
@if(request()->hasAny(['symbol_id','side','from','to'])) Clear @endif
{{-- Trades table --}}
Recent History
@if($trades->isEmpty())
No trades found.
@else
@foreach($trades as $trade) @php [$icn, $icColor] = SymbolPresentation::baseIconPair($trade->symbol); $icIsImg = str_starts_with($icn, 'img:'); $pair = SymbolPresentation::pairLabel($trade->symbol); @endphp @endforeach
Time Type Instrument Action Price Volume Status P&L
{{ $trade->traded_at->format('M j, Y H:i:s') }} {{ strtoupper($trade->side) }}
@if($icIsImg) {{ strtoupper(substr($trade->symbol->name??'?',0,2)) }} @elseif($icn) @else {{ strtoupper(substr($trade->symbol->name??'?',0,2)) }} @endif
{{ $pair }}
Market {{ number_format($trade->price, $trade->symbol->decimal_places ?? 2) }} ${{ number_format($trade->total_cost, 2) }} Filled —
@if($trades->hasPages())
{{ $trades->withQueryString()->links('pagination::bootstrap-5') }}
@endif @endif
@endsection