@extends('layouts.trading')

@section('content')
<div class="trade-card">
    <h2 class="mb-4 text-xl font-bold text-white">Open Positions</h2>
    @forelse ($data['open_positions'] as $position)
        <div class="mb-3 rounded-xl border border-trade-border bg-trade-panel p-4">
            <div class="flex justify-between">
                <div>
                    <div class="font-semibold text-white">{{ $position->tradingsymbol }}</div>
                    <div class="text-sm text-slate-400">Qty: {{ $position->net_quantity }} @ ₹{{ number_format($position->net_avg_price, 2) }}</div>
                </div>
                <div class="{{ $position->unrealized_pnl >= 0 ? 'pnl-positive' : 'pnl-negative' }} font-bold">
                    {{ $position->unrealized_pnl >= 0 ? '+' : '' }}₹{{ number_format($position->unrealized_pnl, 2) }}
                </div>
            </div>
        </div>
    @empty
        <p class="text-slate-500">No open positions.</p>
    @endforelse
</div>
@endsection
