@extends('layouts.app') @section('title', 'Reports | DYSON LATAM') @section('content') @php $totalProjects = $projects->count(); $totalCertifications = $projects->sum(function ($project) { return $project->certifications->count(); }); $completedCertifications = $projects->sum(function ($project) { return $project->certifications->where('status', 'certified')->count(); }); $totalStages = $projects->sum(function ($project) { return $project->stages->count(); }); $completedStages = $projects->sum(function ($project) { return $project->stages->where('status', 'completed')->count(); }); $overallCertificationProgress = $totalCertifications > 0 ? round(($completedCertifications / $totalCertifications) * 100) : 0; $overallStageProgress = $totalStages > 0 ? round(($completedStages / $totalStages) * 100) : 0; $countries = $projects ->groupBy(function ($project) { return $project->country?->name ?? 'N/A'; }) ->sortKeys(); $categories = $projects ->groupBy(function ($project) { return $project->category?->name ?? 'N/A'; }) ->sortKeys(); $projectRows = $projects->map(function ($project) { $stages = $project->stages; $completedStages = $stages->where('status', 'completed')->count(); $totalStages = $stages->count(); $stageProgress = $totalStages > 0 ? round(($completedStages / $totalStages) * 100) : 0; $certifications = $project->certifications; $completedCertifications = $certifications->where('status', 'certified')->count(); $totalCertifications = $certifications->count(); $certificationProgress = $totalCertifications > 0 ? round(($completedCertifications / $totalCertifications) * 100) : 0; if ($stages->contains('status', 'blocked')) { $status = 'Blocked'; } elseif ($stages->contains('status', 'overdue')) { $status = 'Overdue'; } elseif ($totalStages > 0 && $completedStages === $totalStages) { $status = 'Completed'; } elseif ($stages->contains('status', 'in_progress')) { $status = 'In Progress'; } else { $status = 'Pending'; } return [ 'project' => $project, 'stage_progress' => $stageProgress, 'certification_progress' => $certificationProgress, 'status' => $status, ]; }); @endphp
DYSON LATAM / REPORTING

Reports

Project management and certification reporting

Total Projects
{{ $totalProjects }}
All registered NPD projects
Stages Progress
{{ $overallStageProgress }}%
{{ $completedStages }} / {{ $totalStages }} completed
Certifications
{{ $totalCertifications }}
{{ $completedCertifications }} certified
Certification Progress
{{ $overallCertificationProgress }}%
Across all projects

Projects by Country

Distribution of registered projects

@forelse ($countries as $country => $countryProjects)
{{ $country }}
{{ $countryProjects->count() }} project(s)
{{ $countryProjects->count() }}
@empty
No country data available.
@endforelse

Projects by Category

Distribution of projects by category

@forelse ($categories as $category => $categoryProjects)
{{ $category }}
{{ $categoryProjects->count() }} project(s)
{{ $categoryProjects->count() }}
@empty
No category data available.
@endforelse

Project Report

Current stage and certification progress by project

@forelse ($projectRows as $row) @php $project = $row['project']; $completedStages = $project->stages->where('status', 'completed')->count(); $totalStages = $project->stages->count(); $completedCertifications = $project->certifications ->where('status', 'certified') ->count(); $totalCertifications = $project->certifications->count(); @endphp @empty @endforelse
Project Country Category Status Stages Certifications Launch Date
{{ $project->name }}
@if ($project->model)
{{ $project->model }}
@endif
{{ $project->country?->name ?? 'N/A' }} {{ $project->category?->name ?? 'N/A' }} {{ $row['status'] }}
{{ $completedStages }} / {{ $totalStages }}
{{ $row['stage_progress'] }}%
{{ $completedCertifications }} / {{ $totalCertifications }}
{{ $row['certification_progress'] }}%
{{ $project->launch_date?->format('d M Y') ?? 'N/A' }}
No projects available.
@endsection