@extends('nexus.layouts.app') @section('page-title', 'Overview') @section('sys-mode', 'OVERVIEW') @section('head') @endsection @section('content') @php $isOpen = $sessionMetrics['is_open'] ?? false; $activeSession = $sessionMetrics['active_session'] ?? null; $engineStatus = \App\Nexus\Engine\NexusConfig::get('nexus_status', 'inactive'); // Live session state for the controller grid (always today, even on historical views) $liveIsOpen = $sessionMetrics['live_is_open'] ?? $isOpen; $liveActiveSession = $sessionMetrics['live_active_session'] ?? $activeSession; $sessionsLive = $sessionMetrics['sessions_live'] ?? ($sessionMetrics['sessions_today'] ?? []); // Index live sessions by session_number for the controller grid $sessionsByNum = []; foreach ($sessionsLive as $s) { $num = is_array($s) ? ($s['session_number'] ?? null) : ($s->session_number ?? null); if ($num !== null) $sessionsByNum[$num] = $s; } $sessionLabels = ['ASIA-PACIFIC', 'EUROPE', 'AMERICAS']; $sessionTimes = ['01:00 -- 02:00 UTC', '09:00 -- 10:00 UTC', '17:00 -- 18:00 UTC']; // Date range context for labels $dateStart = $dates['start'] ?? now()->startOfMonth()->toDateString(); $dateEnd = $dates['end'] ?? now()->toDateString(); $isToday = $dateStart === now()->toDateString() && $dateEnd === now()->toDateString(); $isYesterday = $dateStart === now()->subDay()->toDateString() && $dateEnd === now()->subDay()->toDateString(); $isSingleDay = $dateStart === $dateEnd; $isCurrentMonth = \Carbon\Carbon::parse($dateStart)->month === now()->month && \Carbon\Carbon::parse($dateStart)->year === now()->year && \Carbon\Carbon::parse($dateStart)->day === 1; // Build period label for stat strips if ($isToday) { $periodLabel = 'TODAY'; $periodSuffix = 'Today'; } elseif ($isYesterday) { $periodLabel = 'YESTERDAY'; $periodSuffix = 'Yesterday'; } elseif ($isSingleDay) { $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'); } // Current month for selector highlight $currentMonth = request()->input('month', now()->format('Y-m')); $activeRange = request()->input('range', ''); @endphp {{-- PAGE HEADER --}} {{-- SESSION CONTROLLER --}}
Session Controller 3 daily • 1hr windows
@for ($i = 1; $i <= 3; $i++) @php $sess=$sessionsByNum[$i] ?? null; $sStatus=$sess ? (is_array($sess) ? ($sess['status'] ?? 'pending' ) : ($sess->status ?? 'pending')) : 'pending'; $sActive = $sStatus === 'active'; $sDone = in_array($sStatus, ['completed', 'processing']); @endphp
SESSION {{ $i }}
{{ $sessionLabels[$i - 1] }}
{{ $sessionTimes[$i - 1] }}
@if ($sActive && $liveActiveSession) @php $endTime = now()->addSeconds($liveActiveSession['seconds_remaining'] ?? 0)->toIso8601String(); @endphp
--:--
Remaining
@elseif ($sDone) COMPLETED @else PENDING @endif
@endfor
{{-- KEY METRICS (date-aware labels) --}}
Pending Sells
@php $pendingManual = $sessionMetrics['pending_sell_count'] ?? 0; $pendingAi = $sessionMetrics['pending_ai_sell_count'] ?? 0; @endphp
{{ number_format($pendingManual + $pendingAi) }}
Manual: {{ number_format($pendingManual) }} / Bot: {{ number_format($pendingAi) }}
Bids {{ $periodLabel }}
{{ number_format($sessionMetrics['total_bids'] ?? 0) }}
Volume {{ $periodLabel }}
${{ number_format($sessionMetrics['total_volume'] ?? 0, 2) }}
Win Rate {{ $periodLabel }}
@php $wr = $sessionMetrics['win_rate'] ?? 0; @endphp
{{ number_format($wr, 1) }}%
{{-- CHARTS --}} @php $hasActivity = false; $ds = $chartData['datasets'] ?? []; foreach ($ds as $dataset) { foreach ($dataset['data'] ?? [] as $val) { if ($val > 0) { $hasActivity = true; break 2; } } } $hasResults = ($resultSummary['won'] ?? 0) > 0 || ($resultSummary['lost'] ?? 0) > 0; $chartGranularity = $chartData['granularity'] ?? 'hourly'; @endphp
Trading Activity • {{ $chartGranularity === 'daily' ? $periodSuffix : ($isToday ? '24hr' : $periodSuffix) }}
@if (!$hasActivity)
Engine inactive -- no trading data
@endif
Session Results • {{ $periodSuffix }}
@php $rWon = $resultSummary['won'] ?? 0; $rLost = $resultSummary['lost'] ?? 0; $rPending = $resultSummary['pending'] ?? 0; $rTotal = $rWon + $rLost + $rPending; @endphp @if ($hasResults)
{{ number_format($rTotal) }}
TRADES
@else
{{ $rPending }} pending • No results yet
@endif
{{-- SESSION HISTORY --}}
Session History
{{ $periodSuffix }} EXPORT CSV
@if (!empty($sessionHistory) && count($sessionHistory) > 0)
@foreach ($sessionHistory as $sh) @php $shCompleted = $sh['status'] === 'completed'; $shActive = $sh['status'] === 'active'; $wrt = $sh['win_rate_target'] ?? 0; $wra = $sh['win_rate_actual'] ?? 0; @endphp {{-- Expandable detail row (loaded via AJAX) --}} @if ($shCompleted) @endif @endforeach
Date Session Status Bids Evaluated Approved Rejected Win Rate
@if ($shCompleted) @endif {{ \Carbon\Carbon::parse($sh['session_date'])->format('M d') }} S{{ $sh['session_number'] }} {{ strtoupper($sh['status']) }} {{ $shCompleted ? number_format($sh['total_bids']) : '--' }} {{ $shCompleted ? number_format($sh['evaluated']) : '--' }} {{ $shCompleted ? number_format($sh['approved']) : '--' }} {{ $shCompleted ? number_format($sh['rejected']) : '--' }} @if ($shCompleted) {{ number_format($wrt, 0) }}%{{ number_format($wra, 1) }}% @else -- @endif
@if (count($sessionHistory) > 10)
Page 1 of {{ ceil(count($sessionHistory) / 10) }} • {{ count($sessionHistory) }} sessions
@endif @else
No session data for this period
@endif {{-- BOT GOVERNANCE GLANCE --}} @php $bg = $botGlance ?? []; $bgBots = $bg['total_bots'] ?? 0; $bgCapital = $bg['total_capital'] ?? 0; $bgProfit = $bg['total_profit'] ?? 0; $bgOnTrack = $bg['on_track'] ?? 0; $bgHot = $bg['hot'] ?? 0; $bgCold = $bg['cold'] ?? 0; $bgPlans = $bg['plan_counts'] ?? []; @endphp
Bot Governance AI bot profit oversight
@if ($bgBots > 0)
Active Bots {{ $bgBots }}
@foreach ($bgPlans as $planName => $count) {{ $planName }}: {{ $count }}
@endforeach
Capital ${{ number_format($bgCapital, 0) }}
Profit ${{ number_format($bgProfit, 0) }}
Track Status {{ $bgOnTrack }} / {{ $bgHot }} / {{ $bgCold }} On Track / Hot / Cold View Full Report
@else
No active bots with governance configured
@endif {{-- ECONOMY HEALTH --}} @php $eHealth = $economyPanel['economy_health'] ?? 'unknown'; $eLiq = $economyPanel['liquidity_index'] ?? 0; $eCap = $economyPanel['users_at_cap'] ?? 0; $eWin = $economyPanel['win_rate_avg'] ?? 0; $eVol = $economyPanel['total_volume'] ?? 0; $eHealthColor = match($eHealth) { 'healthy' => 'text-green', 'overheated' => 'text-red', 'stagnant' => 'text-yellow', default => 'text-dim' }; @endphp
Economy Health {{ strtoupper($eHealth) }}
Liquidity Index {{ number_format($eLiq * 100, 1) }}%
Users At Cap {{ $eCap }}
Avg Win Rate {{ number_format($eWin, 1) }}%
Volume ${{ number_format($eVol, 0) }}
{{-- CAP WARNINGS --}} @if (!empty($capWarnings) && count($capWarnings) > 0)
Profit Cap Warnings {{ count($capWarnings) }} user(s)
@foreach ($capWarnings as $w) @php $wPct = $w['cap_percent'] ?? 0; @endphp
{{ $wPct >= 95 ? 'CRIT' : 'WARN' }} {{ $w['username'] ?? 'User #' . ($w['user_id'] ?? '?') }} • {{ number_format($wPct, 1) }}% of cap • ${{ number_format($w['profit'] ?? 0, 2) }} / ${{ number_format($w['cap'] ?? 0, 2) }}
@endforeach @endif {{-- TOP BIDDERS --}}
Top Bidders {{ $periodSuffix }} • by wins • Manual traders only
@if (!empty($topBidders) && count($topBidders) > 0)
@foreach ($topBidders as $idx => $b) @php $pp = $b['profit_percent'] ?? 0; $ppColor = $pp >= 9 ? 'red' : ($pp >= 7 ? 'yellow' : 'green'); @endphp @endforeach
# User Wins Losses Profit Volume Cap %
{{ str_pad($idx + 1, 2, '0', STR_PAD_LEFT) }} {{ $b['username'] ?? 'User #' . ($b['user_id'] ?? '?') }} {{ $b['wins'] ?? 0 }} {{ $b['losses'] ?? 0 }} ${{ number_format($b['total_profit'] ?? 0, 2) }} ${{ number_format($b['total_volume'] ?? 0, 2) }}
{{ number_format($pp, 1) }}%
@else
No bidding data for this period
@endif @endsection @section('scripts') @endsection