@extends('layouts.app') @php // Pre-compute safe arrays for JS (avoids Blade parse issues with array_fill in @push) $jsMonthlySales = $monthlySales ?? array_fill(0, 12, 0); $jsMonthlyOrders = $monthlyOrders ?? array_fill(0, 12, 0); $jsMonthlyReservations = $monthlyReservations ?? array_fill(0, 12, 0); $jsRadarLabels = $radarLabels ?? ['Entradas', 'Platos', 'Bebidas', 'Postres', 'Especiales']; $jsRadarData = $radarData ?? [0, 0, 0, 0, 0]; $jsGoalPercent = $goalPercent ?? 60; @endphp @push('scripts') @endpush @section('content')
{{-- ============================================================ FILA 1: 4 Paneles KPI + Ventas Mes + Meta ============================================================ --}}
{{-- KPI 1: Ventas de Hoy --}}
Ventas de Hoy
{{ $currency ?? 'S/' }} {{ number_format($totalSalesToday ?? 0, 2, '.', ',') }}
{{ $ordersCountToday ?? 0 }} órdenes completadas
HOY
{{-- KPI 2: Mesas en Servicio --}}
Mesas en Servicio
{{ $activeTables ?? 0 }}
Ocupadas ahora mismo
LIVE
{{-- KPI 3: Ventas del Mes --}}
Ventas del Mes
{{ $currency ?? 'S/' }} {{ number_format($totalSalesMonth ?? 0, 0, '.', ',') }}
Meta: {{ $currency ?? 'S/' }} {{ number_format($monthlyGoal ?? 5000, 0, '.', ',') }}
MES
{{-- KPI 4: Stock Bajo --}}
Alertas de Stock
{{ $lowStockProducts ?? 0 }}
@if(($lowStockProducts ?? 0) > 0) Productos por reponer @else Inventario en buen estado @endif
VER
{{-- ============================================================ FILA 1B: Meta mensual + Progreso ============================================================ --}}
Progreso de Meta Mensual Logrado: {{ $currency ?? 'S/' }} {{ number_format($totalSalesMonth ?? 0, 2, '.', ',') }} de {{ $currency ?? 'S/' }} {{ number_format($monthlyGoal ?? 5000, 2, '.', ',') }}
{{ $goalPercent ?? 0 }}%
Ver Reportes
{{-- ============================================================ FILA 2: Actividad Anual | Ingreso Actual ============================================================ --}}
{{-- Gráfico Actividad Anual --}}
Actividad del Año
—
{{-- Donut: Ingreso Actual --}}
Ingreso Actual
—
{{-- Donut --}}
{{ $goalPercent ?? 60 }}%
de meta
{{-- Stat --}}
Meta mensual: S/ {{ number_format($monthlyGoal ?? 5000, 0,'.',',') }}
Logrado: S/ {{ number_format($totalSalesMonth ?? 0, 0,'.',',') }}
{{-- Buttons --}}

Progreso mensual basado en las ventas registradas en el sistema.

{{-- ============================================================ FILA 3: Estado de Salones + Más Vendidos ============================================================ --}}
Estado de Salones
● Disponible ● Ocupada
@if(isset($areas) && count($areas) > 0)
@foreach($areas as $index => $area)
@foreach($area->tables as $table) @php $isBusy = $table->orders->count() > 0; @endphp @endforeach
@endforeach
@else
No hay áreas configuradas.
@endif
🏆 Más Vendidos
@forelse($topProducts ?? [] as $product)
@if($product->image) @else
@endif #{{ $loop->iteration }}
{{ $product->name }}
{{ $product->total_qty }} unidades
@empty
Sin datos de ventas aún.
@endforelse
{{-- Dashboard-specific styles --}} @includeIf('products.create_modal') @endsection