{{ __('Dashboard') }}

{{-- ============================================================ ROW 1: Project stats (4 columns) ============================================================ --}}
{{-- Proyectos activos --}}

Proyectos activos

{{ $stats['active_projects'] }} / {{ $stats['total_projects'] }}

{{-- Avance global --}}

Avance global

{{ $stats['global_progress'] }}%

{{-- Fases con retraso --}}

Fases con retraso

{{ $stats['delayed_phases'] }}

@if($stats['delayed_phases'] > 0)

Requiere atención

@else

Sin retrasos

@endif
{{-- Elementos totales --}}

Elementos totales

{{ $stats['total_features'] }}

{{ $stats['total_phases'] }} fases

{{-- ============================================================ ROW 2: Issues & Inspections (4 columns) ============================================================ --}}
{{-- Issues abiertos --}}

Issues abiertos

{{ $stats['open_issues'] }}

@if($stats['critical_issues'] > 0)

{{ $stats['critical_issues'] }} críticos

@else

0 críticos

@endif
{{-- Inspecciones pendientes --}}

Insp. pendientes

{{ $stats['pending_inspections'] }}

Por realizar

{{-- Inspecciones completadas --}}

Insp. completadas

{{ $stats['completed_inspections'] }}

Aprobadas

{{-- Inspecciones rechazadas --}}

Insp. rechazadas

{{ $stats['rejected_inspections'] }}

Requieren revisión

{{-- ============================================================ MAIN CONTENT: Two-column layout ============================================================ --}}
{{-- LEFT COLUMN (2/3): Recent projects --}}

Proyectos recientes

Ver todos
@if($recentProjects->isEmpty())

No hay proyectos disponibles

@else
@foreach($recentProjects as $project) @php $avg = $project->phases->avg('progress_percent') ?? 0; $statusConfig = match($project->status) { 'in_progress' => ['badge' => 'badge-primary', 'bar' => 'bg-blue-500', 'label' => 'En progreso'], 'completed' => ['badge' => 'badge-success', 'bar' => 'bg-green-500', 'label' => 'Completado'], 'paused' => ['badge' => 'badge-warning', 'bar' => 'bg-yellow-500', 'label' => 'Pausado'], 'planning' => ['badge' => 'badge-ghost', 'bar' => 'bg-gray-400', 'label' => 'Planificación'], default => ['badge' => 'badge-ghost', 'bar' => 'bg-gray-400', 'label' => ucfirst(str_replace('_', ' ', $project->status))], }; @endphp

{{ $project->name }}

{{ $statusConfig['label'] }}
{{ $project->phases_count }} {{ $project->phases_count === 1 ? 'fase' : 'fases' }}
Progreso {{ round($avg) }}%
@endforeach
@endif
{{-- RIGHT COLUMN (1/3): Issues + Inspections --}}
{{-- Issues recientes --}}

Issues recientes

@if(isset($recentIssues) && $recentIssues->isNotEmpty())
@foreach($recentIssues as $issue) @php $priorityConfig = match($issue->priority ?? 'medium') { 'critical' => ['badge' => 'badge-error', 'label' => 'Crítico'], 'high' => ['badge' => 'badge-warning', 'label' => 'Alto'], 'medium' => ['badge' => 'badge-info', 'label' => 'Medio'], 'low' => ['badge' => 'badge-ghost', 'label' => 'Bajo'], default => ['badge' => 'badge-ghost', 'label' => ucfirst($issue->priority ?? '')], }; @endphp
{{ $priorityConfig['label'] }}

{{ $issue->title }}

@if($issue->feature) {{ $issue->feature->name }} @elseif($issue->project) {{ $issue->project->name }} @endif

@if($issue->reporter)

{{ $issue->reporter->name }}

@endif
@endforeach
@else

Sin issues abiertos

@endif
{{-- Inspecciones recientes --}}

Inspecciones recientes

@if($recentInspections->isNotEmpty())
@foreach($recentInspections as $inspection) @php $inspStatusConfig = match($inspection->status ?? 'pending') { 'completed' => ['badge' => 'badge-success', 'label' => 'Completada'], 'pending' => ['badge' => 'badge-warning', 'label' => 'Pendiente'], 'rejected' => ['badge' => 'badge-error', 'label' => 'Rechazada'], 'in_progress' => ['badge' => 'badge-info', 'label' => 'En curso'], default => ['badge' => 'badge-ghost', 'label' => ucfirst($inspection->status ?? '')], }; @endphp

{{ $inspection->template?->name ?? 'Inspección' }}

{{ $inspStatusConfig['label'] }}
@if($inspection->feature)

{{ $inspection->feature->name }}

@elseif($inspection->project)

{{ $inspection->project->name }}

@endif

{{ $inspection->created_at->diffForHumans() }}

@endforeach
@else

Sin inspecciones recientes

@endif
{{-- end right column --}}
{{-- end main content --}}