{{-- ARCHIVO: resources/views/admin/dashboard/index.blade.php --}} {{-- VERSIÓN: 1.0 - COMPLETA 100% FUNCIONAL --}} {{-- DESCRIPCIÓN: Dashboard principal para administrador de condominio --}} {{-- COMPATIBILIDAD: Laravel 11.47 --}} {{-- FECHA: 2024-12-09 --}} @extends('layouts.admin') @section('title', $pageTitle) @section('page-icon', $pageIcon) @section('breadcrumb') @parent @endsection @push('styles') @endpush @section('content') @if(isset($error))
{{ $error }}
@else
{{-- Welcome Header --}}

Bienvenido, {{ auth()->user()->name }}

Estás administrando {{ $condominio->nombre }} @if($condominio->bloques_count > 0) | {{ $condominio->bloques_count }} {{ $condominio->bloques_count == 1 ? 'bloque' : 'bloques' }} @endif

{{ now()->translatedFormat('l, d \de F \de Y') }} {{ now()->format('H:i') }}
{{-- Quick Actions --}}
{{-- Statistics Overview --}}
{{-- Users Stats --}}
{{ $stats['total_usuarios'] ?? 0 }}
Usuarios Totales
{{ $stats['propietarios'] ?? 0 }} prop. | {{ $stats['inquilinos'] ?? 0 }} inqui.
{{-- Units Stats --}}
{{ $stats['total_unidades'] ?? 0 }}
Unidades Totales
@php $ocupacion = $stats['total_unidades'] > 0 ? ($stats['unidades_ocupadas'] / $stats['total_unidades']) * 100 : 0; @endphp
{{ round($ocupacion, 1) }}% ocupación
{{-- Financial Stats --}}
{{ $condominio->moneda }} {{ number_format($stats['ingresos_mes'] ?? 0, 2) }}
Ingresos del Mes
{{ $stats['pagos_pendientes'] ?? 0 }} pendientes | {{ $stats['pagos_atrasados'] ?? 0 }} atrasados
{{-- Reservations Stats --}}
{{ $stats['reservas_mes'] ?? 0 }}
Reservas del Mes
{{ $stats['areas_comunes'] ?? 0 }} áreas | {{ $stats['areas_alquilables'] ?? 0 }} alquilables
{{-- Main Content Row --}}
{{-- Left Column: Blocks and Recent Activity --}}
{{-- Blocks Overview --}}
Bloques/Edificios
@if($bloques->count() > 0)
@foreach($bloques as $bloque)
{{ $bloque->nombre }}

{{ $bloque->codigo }} @if($bloque->direccion)
{{ Str::limit($bloque->direccion, 40) }} @endif

{{ $bloque->estado_display ?? ucfirst($bloque->estado) }}
{{ $bloque->unidades_count ?? 0 }}
Unidades
{{ $bloque->unidades_ocupadas_count ?? 0 }}
Ocupadas
Ocupación: {{ $bloque->ocupacion_porcentaje ?? 0 }}%
{{ $bloque->pisos }} pisos Ver
@endforeach
@else
No hay bloques registrados

Comienza creando bloques para organizar las unidades.

Crear Primer Bloque
@endif
@if($bloques->count() > 0) @endif
{{-- Recent Activity --}}
Actividad Reciente
Ver todo
@forelse($actividadReciente as $activity)
{{ $activity['title'] }}

{{ $activity['description'] }}

{{ $activity['timestamp']->diffForHumans() }}
@empty

No hay actividad reciente

@endforelse
{{-- Right Column: Pending Actions and Notifications --}}
{{-- Pending Payments --}}
Pagos Pendientes {{ $pagosPendientes->count() }}
Ver todos
@forelse($pagosPendientes as $pago)
{{ $pago->user->name ?? 'N/A' }}

{{ $pago->unidad->codigo ?? 'N/A' }} @if($pago->unidad->bloque) ({{ $pago->unidad->bloque->nombre }}) @endif

{{ $pago->estado_display }}
{{ $pago->moneda }} {{ number_format($pago->monto, 2) }}
Vence: {{ $pago->fecha_vencimiento->format('d/m') }}
@empty

No hay pagos pendientes

@endforelse
{{-- Upcoming Reservations --}}
Próximas Reservas
Calendario
@forelse($reservasRecientes as $reserva)
{{ $reserva->areaComun->nombre ?? 'N/A' }}

{{ $reserva->user->name ?? 'N/A' }}

{{ $reserva->estado_display ?? ucfirst($reserva->estado) }}
{{ $reserva->fecha_reserva->format('d/m') }}
{{ $reserva->hora_inicio->format('H:i') }} - {{ $reserva->hora_fin->format('H:i') }}
@empty

No hay reservas próximas

@endforelse
{{-- Debtors --}} @if($morosos->count() > 0)
Morosos
@foreach($morosos as $moroso)
{{ $moroso->user->name ?? 'N/A' }}
{{ $moroso->user->role_display ?? 'Usuario' }}
{{ $condominio->moneda }} {{ number_format($moroso->total_deuda, 2) }}
@endforeach
@endif {{-- Popular Common Areas --}} @if($areasPopulares->count() > 0)
Áreas Más Solicitadas
@foreach($areasPopulares as $area)
{{ $area->nombre }} {{ $area->reservas_count }} reservas
@php $maxReservas = $areasPopulares->max('reservas_count'); $percentage = $maxReservas > 0 ? ($area->reservas_count / $maxReservas) * 100 : 0; @endphp
@endforeach
@endif
@endif @endsection @push('scripts') @endpush