@extends('nexus.layouts.app') @section('page-title', 'Users') @section('sys-mode', 'USER ANALYTICS') @section('head') @endsection @section('content') @php $ratio = $winLossRatio ?? ['wins' => 0, 'losses' => 0, 'win_rate' => 0]; $part = $participation ?? []; $dateStart = $dates['start'] ?? now()->startOfMonth()->toDateString(); $dateEnd = $dates['end'] ?? now()->toDateString(); $isToday = $dateStart === now()->toDateString() && $dateEnd === now()->toDateString(); if ($isToday) { $periodLabel = 'TODAY'; $periodSuffix = 'Today'; } elseif ($dateStart === now()->subDay()->toDateString() && $dateEnd === now()->subDay()->toDateString()) { $periodLabel = 'YESTERDAY'; $periodSuffix = 'Yesterday'; } elseif ($dateStart === $dateEnd) { $periodLabel = strtoupper(\Carbon\Carbon::parse($dateStart)->format('M j')); $periodSuffix = \Carbon\Carbon::parse($dateStart)->format('M j'); } else { $periodLabel = strtoupper(\Carbon\Carbon::parse($dateStart)->format('M Y')); $periodSuffix = \Carbon\Carbon::parse($dateStart)->format('M Y'); } $currentMonth = request()->input('month', now()->format('Y-m')); $activeRange = request()->input('range', ''); $currentSort = request()->input('sort', 'wins'); $currentDir = request()->input('dir', 'desc'); $currentSearch = request()->input('search', ''); $currentLimit = (int) request()->input('limit', 20); $currentPage = (int) request()->input('page', 1); $currentFilter = $currentFilter ?? request()->input('filter', 'all_bidders'); $filterLabels = [ 'all_bidders' => 'All Bidders', 'active_traders' => 'Active Traders', 'unique_bidders' => 'Unique Bidders', 'new_traders' => 'New Traders', 'ictp_bidders' => 'ICTP Bidders', 'first_bid_wins' => 'First Bid Wins', 'first_sell_wins' => 'First Sell Wins', 'loss_streak' => 'In Loss Streak', 'approaching_cap' => 'Approaching Cap', 'logged_in' => 'Logged In', ]; @endphp {{-- PAGE HEADER --}} {{-- WIN / LOSS STRIP (date-aware) --}}
Total Wins {{ $periodLabel }}
{{ number_format($ratio['wins'] ?? 0) }}
Total Losses {{ $periodLabel }}
{{ number_format($ratio['losses'] ?? 0) }}
Users In Loss Streak
{{ count($lossAccumulation ?? []) }}
Approaching Cap
{{ count($approachingCap ?? []) }}
{{-- PARTICIPATION STATS (6 new cells) --}}
Registered Users
{{ number_format($part['registered_users'] ?? 0) }}
Total
Active Traders
{{ number_format($part['active_traders'] ?? 0) }}
Ever bid
Unique Bidders
{{ number_format($part['unique_bidders'] ?? 0) }}
{{ $periodSuffix }}
New Traders
{{ number_format($part['new_traders'] ?? 0) }}
First bid {{ strtolower($periodSuffix) }}
First Bid Wins
{{ number_format($part['first_bid_wins'] ?? 0) }}
Guarantee used
First Sell Wins
{{ number_format($part['first_sell_wins'] ?? 0) }}
Guarantee used
ICTP Bidders
{{ number_format($part['ictp_bidders'] ?? 0) }}
{{ $periodSuffix }}
ICTP Bids
{{ number_format($part['ictp_bid_count'] ?? 0) }}
{{ $periodSuffix }}
{{-- CHARTS ROW 1: Daily Active Bidders + Win Rate Distribution --}}
Daily Active Bidders • {{ $periodSuffix }}
Win Rate Distribution • Manual traders
{{-- CHARTS ROW 2: Capital + Profit Distribution (existing) --}}
Capital Distribution
Profit Distribution
{{-- TOP BIDDERS LEADERBOARD (AJAX interactive table) --}}
Top Bidders Leaderboard {{ $periodSuffix }} • Manual traders only
{{-- Active filter pill bar --}}
Filter {{ $filterLabels[$currentFilter] ?? 'All Bidders' }}
{{-- Table controls --}}
Filter
Showing per page
{{-- Table --}}
@if (!empty($topBidders) && count($topBidders) > 0) @foreach ($topBidders as $idx => $b) @php $pp = $b['profit_percent'] ?? 0; $rowNum = (($currentPage - 1) * $currentLimit) + $idx + 1; @endphp @endforeach @else @endif
# User Wins Losses Win Rate Profit Volume Profit % Bids ICTP Country Last Login
{{ str_pad($rowNum, 2, '0', STR_PAD_LEFT) }} {{ $b['username'] ?? 'User #' . ($b['user_id'] ?? '?') }} {{ $b['wins'] ?? 0 }} {{ $b['losses'] ?? 0 }} {{ $b['win_rate'] ?? 0 }}% ${{ number_format($b['total_profit'] ?? 0, 2) }} ${{ number_format($b['total_volume'] ?? 0, 2) }} {{ number_format($pp, 1) }}% {{ $b['total_bids'] ?? 0 }} {{ $b['ictp_bids'] ?? 0 }} {{ $b['last_login_country_name'] ?? '-' }} {{ $b['last_login_relative'] ?? 'never' }}
No bidder data for this period
{{-- Pagination --}}
Page {{ $currentPage }} of {{ $topBiddersPages ?? 1 }}{{ number_format($topBiddersTotal ?? 0) }} users
{{-- AJAX loading overlay --}}
Loading
{{-- LOSS ACCUMULATION --}} @if (!empty($lossAccumulation) && count($lossAccumulation) > 0)
Loss Accumulation Users with consecutive losses > 0
@foreach ($lossAccumulation as $user) @endforeach
UserConsecutive LossesTotal WinsTotal Losses
{{ $user['username'] ?? 'User #' . ($user['user_id'] ?? '?') }} {{ $user['consecutive_losses'] ?? 0 }} {{ $user['total_wins'] ?? 0 }} {{ $user['total_losses'] ?? 0 }}
@if (count($lossAccumulation) > 15)
Page 1 of {{ ceil(count($lossAccumulation) / 15) }} • {{ count($lossAccumulation) }} users
@endif @endif {{-- APPROACHING CAP --}} @if (!empty($approachingCap) && count($approachingCap) > 0)
Approaching Monthly Cap {{ count($approachingCap) }} users above 70%
@foreach ($approachingCap as $user)
{{ ($user['percent'] ?? 0) >= 95 ? 'CRIT' : 'WARN' }} {{ $user['username'] ?? 'User #' . ($user['user_id'] ?? '?') }} • {{ number_format($user['percent'] ?? 0, 1) }}% of cap • ${{ number_format($user['profit'] ?? 0, 2) }} / ${{ number_format($user['cap'] ?? 0, 2) }}
@endforeach @endif @endsection @section('scripts') @endsection