@extends('layouts.app') @section('content') @php $header = $dashboard['header'] ?? []; $kpis = $dashboard['kpis'] ?? []; $monthly = $dashboard['monthly_attendance'] ?? ['labels' => [], 'values' => [], 'insight' => '']; $invoices = $dashboard['snack_invoices'] ?? ['rows' => [], 'last_30_days_total' => 0]; $attendanceTimeline = $dashboard['attendance_timeline'] ?? ['rows' => [], 'week_status' => '']; $weeklyCompliance = $dashboard['weekly_compliance'] ?? ['labels' => [], 'values' => [], 'average' => 0, 'insight' => '']; $avatar = !empty($header['avatar']) ? route('user_fit.users.image', ['filename' => $header['avatar']]) : asset('images/no-user-imagen.jpg'); $hasMonthlyAttendanceData = collect($monthly['values'] ?? [])->sum() > 0; @endphp
Avatar

{{ $header['client_name'] ?? 'Cliente' }}

Plan activo: {{ $header['plan_label'] ?? '-' }} {{ $header['membership_name'] ?? '-' }} Ciclo actual: {{ $header['cycle_label'] ?? '-' }}
Progreso semanal
{{ $header['week_attendances'] ?? 0 }} de {{ $header['week_target'] ?? 0 }} asistencias
Asistencias totales
{{ number_format((int) ($kpis['total_attendances'] ?? 0), 0, ',', '.') }}
acumuladas en el plan actual
Cumplimiento
{{ number_format((float) ($kpis['compliance_percent'] ?? 0), 2, ',', '.') }}%
asistencias realizadas vs planificadas
Deuda total
Bs. {{ number_format((float) ($kpis['debt_total'] ?? 0), 2, ',', '.') }}
saldo pendiente actual de membresia
@if(!empty($kpis['debt_expiration_date']))
Vence: {{ $kpis['debt_expiration_date'] }}
@endif
Gasto en snacks
Bs. {{ number_format((float) ($kpis['snacks_spend'] ?? 0), 2, ',', '.') }}
acumulado
@if (!empty($invoices['rows']) && count($invoices['rows']) > 0)
Facturas de snacks (ultimas compras)
@foreach(($invoices['rows'] ?? []) as $row) @endforeach
Fecha Producto Cantidad Subtotal Total Deuda
{{ $row['date'] }} {{ $row['product_name'] }} {{ $row['quantity'] }} Bs. {{ number_format((float) $row['total'], 2, ',', '.') }} Bs. {{ number_format((float) ($row['sale_total'] ?? 0), 2, ',', '.') }} Bs. {{ number_format((float) ($row['sale_debt'] ?? 0), 2, ',', '.') }}
Total facturado snacks (ultimos 30 dias): Bs. {{ number_format((float) ($invoices['last_30_days_total'] ?? 0), 2, ',', '.') }}
@endif
Asistencias detalladas (ultimas 8 sesiones)
@forelse(($attendanceTimeline['rows'] ?? []) as $row) @empty @endforelse
Fecha Dia planificado Asistio Nota
{{ $row['date'] }} {{ $row['planned'] ? 'Si' : 'No' }} {!! $row['attended'] ? 'Si' : 'No' !!} {{ $row['note'] }}
Sin asistencias registradas.
{{ $attendanceTimeline['week_status'] ?? '' }}
Cumplimiento por semana

{{ $weeklyCompliance['insight'] ?? '' }}

@if($hasMonthlyAttendanceData)
Asistencias mensuales

{{ $monthly['insight'] ?? '' }}

@endif
@endsection @push('styles') @endpush @push('scripts') @php $chartPayload = [ 'monthlyLabels' => $monthly['labels'] ?? [], 'monthlyValues' => $monthly['values'] ?? [], 'weekLabels' => $weeklyCompliance['labels'] ?? [], 'weekValues' => $weeklyCompliance['values'] ?? [], ]; @endphp @endpush