@extends('nexus.layouts.app') @section('page-title', 'Bot Governance') @section('sys-mode', 'BOT GOVERNANCE') @section('head') @endsection @section('content') @php $totals = $botOverview['totals'] ?? []; $plans = $botOverview['plans'] ?? []; $alerts = $botAlerts ?? []; $stl = $settlement ?? []; $charts = $chartData ?? []; $engineStatus = \App\Nexus\Engine\NexusConfig::get('nexus_status', 'inactive'); $isActive = $engineStatus === 'active'; $isCurrent = ($stl['is_current'] ?? true); $dateStart = $dates['start'] ?? now()->startOfMonth()->toDateString(); $dateEnd = $dates['end'] ?? now()->toDateString(); $isCurrentMonth = \Carbon\Carbon::parse($dateStart)->month === now()->month && \Carbon\Carbon::parse($dateStart)->year === now()->year && \Carbon\Carbon::parse($dateStart)->day === 1; $periodLabel = \Carbon\Carbon::parse($dateStart)->format('F Y'); $currentMonth = request()->input('month', now()->format('Y-m')); @endphp {{-- PAGE HEADER --}} @if (!$isActive)
! NEXUS is inactive. Governance data is calculated but not applied. Trade ranges and success rates below reflect what governance WOULD do.
@endif {{-- ALERTS (current month only) --}} @if ($isCurrent && count($alerts) > 0)
Alerts {{ count($alerts) }} item(s) require attention
@foreach ($alerts as $alert)
{{ $alert['level'] === 'critical' ? 'CRIT' : ($alert['level'] === 'warning' ? 'WARN' : 'INFO') }} {{ $alert['message'] }}
@endforeach @endif {{-- STAT STRIP --}}
{{ $isCurrent ? 'Active Bots' : 'Bots (Period)' }}
{{ $totals['bots'] ?? 0 }}
Capital {{ $isCurrent ? 'Under Management' : '(Period)' }}
${{ number_format($totals['capital'] ?? 0, 2) }}
Total Profit
${{ number_format($totals['profit'] ?? 0, 2) }}
Track Status
{{ $totals['on_track'] ?? 0 }} / {{ $totals['hot'] ?? 0 }} / {{ $totals['cold'] ?? 0 }} @if (($totals['settled'] ?? 0) > 0) / {{ $totals['settled'] }} @endif
On Track / Hot / Cold{{ ($totals['settled'] ?? 0) > 0 ? ' / Settled' : '' }}
{{-- CHARTS ROW --}}
Capital Distribution
@php $totalCap = $charts['total_capital'] ?? 0; @endphp @if ($totalCap > 0)
${{ $totalCap >= 1000000 ? number_format($totalCap / 1000000, 1) . 'M' : number_format($totalCap / 1000, 0) . 'K' }}
TOTAL
@endif
Profit vs Target by plan
Track Status
{{ $totals['bots'] ?? 0 }}
BOTS
{{-- SETTLEMENT PIPELINE --}}
Settlement {{ $isCurrent ? 'Pipeline' : 'Results' }}
@if ($isCurrent) {{ $stl['expiring_count'] ?? 0 }} expiring this week @if (($stl['expiring_at_risk'] ?? 0) > 0) • {{ $stl['expiring_at_risk'] }} at risk @endif • @endif {{ $stl['settled_count'] ?? 0 }} settled{{ $isCurrent ? ' this month' : '' }} @if (($stl['settled_count'] ?? 0) > 0) • {{ $stl['settlement_accuracy'] ?? 0 }}% in range @endif
{{-- Expiring soon (current only) --}} @if ($isCurrent) @php $expiring = $stl['expiring_soon'] ?? []; @endphp @if (count($expiring) > 0)
@foreach ($expiring as $ex) @endforeach
BotUserPlan CapitalProfit % Target %Days LeftRisk
#{{ $ex['bot_id'] }} {{ $ex['username'] }} {{ $ex['plan'] }} ${{ number_format($ex['capital'], 2) }} {{ number_format($ex['profit_pct'], 2) }}% {{ number_format($ex['target_pct'], 2) }}% {{ $ex['days_left'] }}d @if ($ex['at_risk']) AT RISK @elseif ($ex['has_f_pfit']) F_PFIT @else ON TRACK @endif
@else
No bots expiring within 7 days
@endif @endif {{-- Settled bots --}} @php $settled = $stl['settled'] ?? []; @endphp @if (count($settled) > 0) @if ($isCurrent)
Settled This Month {{ $stl['in_range_count'] ?? 0 }}/{{ $stl['settled_count'] ?? 0 }} in range ({{ $stl['settlement_accuracy'] ?? 0 }}%)
@endif
{{-- Settled table controls --}}
Showing of {{ count($settled) }}
@foreach ($settled as $st) @endforeach
BotUserPlan CapitalProfit % Target RangeResult
#{{ $st['bot_id'] }} {{ $st['username'] }} {{ $st['plan'] }} ${{ number_format($st['capital'], 2) }} {{ number_format($st['profit_pct'], 2) }}% {{ $st['target_min'] }}% - {{ $st['target_max'] }}% @if ($st['in_range']) IN RANGE @elseif ($st['used_f_pfit']) F_PFIT @else OUT OF RANGE @endif
{{-- Settled pagination --}}
@elseif (!$isCurrent)
No bots settled during this period
@endif {{-- PER-PLAN SECTIONS WITH AJAX TABLES --}} @foreach ($plans as $plan) @php $planId = $plan['plan_id'] ?? 0; $botCount = $plan['bot_count'] ?? 0; $planCapital = $plan['total_capital'] ?? 0; $planProfit = $plan['total_profit'] ?? 0; $avgProfitPct = $plan['avg_profit_pct'] ?? 0; $monthlyMin = $plan['nexus_monthly_min'] ?? 0; $monthlyMax = $plan['nexus_monthly_max'] ?? 0; $onTrack = $plan['on_track'] ?? 0; $hot = $plan['hot'] ?? 0; $cold = $plan['cold'] ?? 0; @endphp
{{ $plan['plan_name'] ?? 'Unknown Plan' }}
{{ $botCount }} bots • ${{ number_format($planCapital, 0) }} capital • Target: {{ $monthlyMin }}% - {{ $monthlyMax }}% monthly EXPORT CSV
Avg Profit {{ number_format($avgProfitPct, 2) }}%
On Track {{ $onTrack }}
Hot {{ $hot }}
Cold {{ $cold }}
Total Profit ${{ number_format($planProfit, 2) }}
{{-- AJAX Table Container --}}
{{-- Controls row --}}
Loading...
{{-- Table --}}
Bot User Capital Profit Profit % Target vs Target Status Drift Days Left Base Success
Loading
{{-- Pagination --}}
@endforeach @if (empty($plans))
No bot data for this period
@endif @endsection @section('scripts') @endsection