@extends('nexus.layouts.app') @section('page-title', 'Markets') @section('sys-mode', 'MARKET ANALYTICS') @section('head') @endsection @section('content') @php $dateStart = $dates['start'] ?? now()->startOfMonth()->toDateString(); $dateEnd = $dates['end'] ?? now()->toDateString(); $isToday = $dateStart === now()->toDateString() && $dateEnd === now()->toDateString(); if ($isToday) { $periodSuffix = 'Today'; } elseif ($dateStart === now()->subDay()->toDateString() && $dateEnd === now()->subDay()->toDateString()) { $periodSuffix = 'Yesterday'; } elseif ($dateStart === $dateEnd) { $periodSuffix = \Carbon\Carbon::parse($dateStart)->format('M j'); } else { $periodSuffix = \Carbon\Carbon::parse($dateStart)->format('M Y'); } $currentMonth = request()->input('month', now()->format('Y-m')); $activeRange = request()->input('range', ''); // Count inactive markets (zero evaluations) $inactiveCount = 0; $activeMarketRows = []; $inactiveMarketRows = []; foreach (($marketWinRates ?? []) as $m) { if (($m['total_sells'] ?? 0) === 0) { $inactiveCount++; $inactiveMarketRows[] = $m; } else { $activeMarketRows[] = $m; } } @endphp {{-- PAGE HEADER --}} {{-- ECONOMY INDICATORS --}}
Economy Indicators
@php $indicators = $economyIndicators ?? []; @endphp @if (count($indicators) > 0)
@foreach ($indicators as $key => $indicator) @php $iValue = $indicator['value'] ?? 0; $iLabel = $indicator['label'] ?? 'Unknown'; $iColor = $indicator['color'] ?? 'grey'; $iPct = min($iValue * 100, 100); $displayName = ucwords(str_replace('_', ' ', $key)); @endphp
{{ $displayName }}
{{ number_format($iValue * 100, 1) }}%
{{ $iLabel }}
@endforeach
@else
No economy data yet
@endif {{-- DYNAMIC PRICING HISTORY --}}
Dynamic Pricing History (7 Days)
{{-- MARKET WIN RATES --}}
Market Win Rates
{{ $periodSuffix }} @if ($inactiveCount > 0) @endif EXPORT CSV
@if (count($activeMarketRows) > 0 || count($inactiveMarketRows) > 0)
@php $rowIdx = 0; @endphp @foreach ($activeMarketRows as $market) @php $rowIdx++; $mRate = $market['win_rate'] ?? 0; $mTotal = $market['total_sells'] ?? 0; @endphp @endforeach @foreach ($inactiveMarketRows as $market) @php $rowIdx++; @endphp @endforeach
#MarketEvaluatedWonLostWin Rate
{{ str_pad($rowIdx, 2, '0', STR_PAD_LEFT) }} {{ $market['market_name'] ?? 'Unknown' }} {{ $mTotal }} {{ $market['wins'] ?? 0 }} {{ $market['losses'] ?? 0 }} {{ $mRate }}%
@else
No win rate data for this period
@endif {{-- CATEGORY ACTIVITY --}}
Category Activity
{{ $periodSuffix }} EXPORT CSV
@if (!empty($categoryActivity) && count($categoryActivity) > 0)
@foreach ($categoryActivity as $cat) @endforeach
CategoryBidsSellsTotal
{{ $cat['category'] ?? 'Unknown' }} {{ number_format($cat['bids'] ?? 0) }} {{ number_format($cat['sells'] ?? 0) }} {{ number_format(($cat['bids'] ?? 0) + ($cat['sells'] ?? 0)) }}
@else
No category data for this period
@endif @endsection @section('scripts') @endsection