@extends('admin.layouts.app') @section('content')

MarketPlace - Dashboard

{{-- Row 1: Main Stat Cards --}}
{{-- Publicaciones Activas --}}

Publicaciones Activas

{{ number_format($activePublications) }} / {{ number_format($totalPublications) }}

{{ $pausedPublications }} pausadas {{ $closedPublications }} cerradas
{{-- Ordenes (30d) --}}

Ordenes (30 dias)

{{ number_format($ordersLast30) }}

${{ number_format($ordersTotalAmount, 2, ',', '.') }} facturado
{{-- Cobrado (30d) --}}

Cobrado (30 dias)

${{ number_format($paymentsApproved, 2, ',', '.') }}

{{ $paymentsLast30 }} pagos @if($paymentsFee > 0) | Fee: ${{ number_format($paymentsFee, 0, ',', '.') }} @endif
{{-- Preguntas Pendientes --}}

Preguntas Pendientes

{{ number_format($pendingQuestions) }}

de {{ number_format($totalQuestions) }} totales
{{-- Row 2: Margin Summary --}}

Margen Promedio

@php $marginColor = $avgMargin < 0 ? 'danger' : ($avgMargin < 15 ? 'warning' : 'success'); @endphp

{{ number_format($avgMargin, 1, ',', '.') }}%

Sobre publicaciones con costo cargado

Publicaciones con Perdida

{{ number_format($underpricedCount) }}

Margen negativo (precio < costo)

Margen Saludable (>15%)

{{ number_format($healthyMarginCount) }}

Publicaciones con buen margen
{{-- Row 3: Top Sellers + Margin Distribution --}}
{{-- Top 5 by Sales --}}
Top 5 Publicaciones por Ventas
Ver ranking
@forelse($topSellers as $index => $pub) @empty @endforelse
# Producto Vendidos Precio ML Margen
{{ $index + 1 }}
{{ $pub->titu_publ }}
{{ $pub->ml_id }}
{{ number_format($pub->cant_vend, 0, ',', '.') }} ${{ number_format($pub->prec_publ, 2, ',', '.') }} @if($pub->cost_snapshot > 0) @php $m = floatval($pub->computed_margin); $mColor = $m < 0 ? 'danger' : ($m < 15 ? 'warning' : 'success'); @endphp {{ number_format($m, 1, ',', '.') }}% @else @endif
Sin ventas registradas
{{-- Margin Distribution --}}
Distribucion de Margen
@php $marginTotal = $underpricedCount + $lowMarginCount + $healthyMarginCount; $pctNeg = $marginTotal > 0 ? round(($underpricedCount / $marginTotal) * 100, 1) : 0; $pctLow = $marginTotal > 0 ? round(($lowMarginCount / $marginTotal) * 100, 1) : 0; $pctHealthy = $marginTotal > 0 ? round(($healthyMarginCount / $marginTotal) * 100, 1) : 0; @endphp @if($marginTotal > 0) {{-- Negative margin --}}
Perdida (margen < 0%) {{ $underpricedCount }} ({{ $pctNeg }}%)
{{-- Low margin --}}
Bajo (0% - 15%) {{ $lowMarginCount }} ({{ $pctLow }}%)
{{-- Healthy margin --}}
Saludable (≥ 15%) {{ $healthyMarginCount }} ({{ $pctHealthy }}%)
{{ $marginTotal }} publicaciones con costo cargado de {{ $totalPublications }} totales
@else
Sin datos de costos. Use "Actualizar Costos" para cargar.
@endif
{{-- Row 4: Quick Actions --}}
Acciones Rapidas
{{-- Row 5: Recent Orders + Pending Questions --}}
{{-- Ultimas Ventas --}}
Ultimas Ventas
Ver todas
@forelse($recentOrders as $order) @empty @endforelse
#{{ $order->order_id }}
{{ $order->buyer_nik ?? 'N/A' }}
{{ $order->mla_nomb }} {{ $order->mla_apel }} ${{ number_format($order->o_tot_amou, 0, ',', '.') }} {{ $order->o_status ?? 'N/A' }}
No hay ventas registradas
{{-- Preguntas Sin Responder --}}
Preguntas Sin Responder
Ver todas
@forelse($recentQuestions as $question) @empty @endforelse
"{{ $question->pregunta }}"
{{ $question->nick_name ?? 'Anonimo' }} — {{ $question->titu_publ ?? '' }} — {{ $question->created_at ? $question->created_at->diffForHumans() : '' }}
No hay preguntas pendientes
@endsection @push('js') @endpush