chore: cleanup dead code + format with Pint

- Remove unused FeaturesController (empty stubs, no routes)
- Remove ConvertSpatialFile CLI command (unused; service used in LayerManager)
- Remove MigrateGeojsonToFeatures CLI command (one-shot migration, not referenced)
- Remove .claude/worktrees/ (11 old agent worktrees from June)
- Apply Laravel Pint formatting across 219 files (style only, no functional changes)

Tests: 101 passing (319 assertions)
API routes: unchanged (8 routes intact)
This commit is contained in:
Javier Braña
2026-08-28 13:04:28 +02:00
parent 2dccd59385
commit 90630379fb
139 changed files with 2888 additions and 2510 deletions
+73 -68
View File
@@ -5,20 +5,22 @@ namespace App\Exports;
use App\DTO\ReportFilters;
use App\Models\Project;
use Maatwebsite\Excel\Concerns\FromArray;
use Maatwebsite\Excel\Concerns\WithMultipleSheets;
use Maatwebsite\Excel\Concerns\WithTitle;
use Maatwebsite\Excel\Concerns\WithHeadings;
use Maatwebsite\Excel\Concerns\WithStyles;
use Maatwebsite\Excel\Concerns\WithColumnWidths;
use PhpOffice\PhpSpreadsheet\Worksheet\Worksheet;
use Maatwebsite\Excel\Concerns\WithHeadings;
use Maatwebsite\Excel\Concerns\WithMultipleSheets;
use Maatwebsite\Excel\Concerns\WithStyles;
use Maatwebsite\Excel\Concerns\WithTitle;
use PhpOffice\PhpSpreadsheet\Style\Alignment;
use PhpOffice\PhpSpreadsheet\Style\Border;
use PhpOffice\PhpSpreadsheet\Style\Fill;
use PhpOffice\PhpSpreadsheet\Worksheet\Worksheet;
class ProjectReportExport implements WithMultipleSheets
{
protected Project $project;
protected ReportFilters $filters;
protected array $data;
public function __construct(Project $project, ReportFilters $filters, array $data)
@@ -34,35 +36,35 @@ class ProjectReportExport implements WithMultipleSheets
new SummarySheet($this->data['summary'] ?? [], $this->project, $this->filters),
];
if (!empty($this->data['phases'])) {
if (! empty($this->data['phases'])) {
$sheets[] = new PhasesSheet($this->data['phases']);
}
if (!empty($this->data['features'])) {
if (! empty($this->data['features'])) {
$sheets[] = new FeaturesSheet($this->data['features']);
}
if (!empty($this->data['inspections'])) {
if (! empty($this->data['inspections'])) {
$sheets[] = new InspectionsSheet($this->data['inspections']);
}
if (!empty($this->data['issues'])) {
if (! empty($this->data['issues'])) {
$sheets[] = new IssuesSheet($this->data['issues']);
}
if (!empty($this->data['tasks'])) {
if (! empty($this->data['tasks'])) {
$sheets[] = new TasksSheet($this->data['tasks']);
}
if (!empty($this->data['deviations'])) {
if (! empty($this->data['deviations'])) {
$sheets[] = new DeviationsSheet($this->data['deviations']);
}
if (!empty($this->data['media'])) {
if (! empty($this->data['media'])) {
$sheets[] = new MediaSheet($this->data['media']);
}
if (!empty($this->data['progress_curve'])) {
if (! empty($this->data['progress_curve'])) {
$sheets[] = new ProgressCurveSheet($this->data['progress_curve']);
}
@@ -77,7 +79,7 @@ class ProjectReportExport implements WithMultipleSheets
// Base Sheet with common styling
// ============================================================
abstract class BaseSheet implements FromArray, WithHeadings, WithStyles, WithColumnWidths, WithTitle
abstract class BaseSheet implements FromArray, WithColumnWidths, WithHeadings, WithStyles, WithTitle
{
protected array $rows = [];
@@ -129,7 +131,7 @@ abstract class BaseSheet implements FromArray, WithHeadings, WithStyles, WithCol
// Auto-filter
$sheet->setAutoFilter($sheet->calculateWorksheetDimension());
// Freeze header row
$sheet->freezePane('A2');
}
@@ -147,13 +149,14 @@ abstract class BaseSheet implements FromArray, WithHeadings, WithStyles, WithCol
class SummarySheet extends BaseSheet
{
protected Project $project;
protected ReportFilters $filters;
public function __construct(array $summary, Project $project, ReportFilters $filters)
{
$this->project = $project;
$this->filters = $filters;
$rows = [
['Informe de Proyecto', $project->name],
['Referencia', $project->reference ?? '—'],
@@ -194,7 +197,7 @@ class SummarySheet extends BaseSheet
['Retrasadas', $summary['phases_delayed'] ?? 0],
['Sin datos', $summary['phases_no_data'] ?? 0],
];
parent::__construct($rows);
}
@@ -218,10 +221,10 @@ class PhasesSheet extends BaseSheet
public function headings(): array
{
return [
'ID', 'Fase', 'Orden', 'Color', 'Inicio Plan', 'Fin Plan',
'Inicio Real', 'Fin Real', 'Progreso (%)', 'Progreso Plan (%)',
'ID', 'Fase', 'Orden', 'Color', 'Inicio Plan', 'Fin Plan',
'Inicio Real', 'Fin Real', 'Progreso (%)', 'Progreso Plan (%)',
'Desvío Fin (días)', 'Desvío Inicio (días)', 'SPI', 'En Plazo',
'Elementos', 'Completados', 'Capas'
'Elementos', 'Completados', 'Capas',
];
}
@@ -252,9 +255,9 @@ class PhasesSheet extends BaseSheet
public function columnWidths(): array
{
return ['A' => 8, 'B' => 25, 'C' => 8, 'D' => 10, 'E' => 12, 'F' => 12,
'G' => 12, 'H' => 12, 'I' => 12, 'J' => 14, 'K' => 14, 'L' => 14,
'M' => 8, 'N' => 10, 'O' => 10, 'P' => 12, 'Q' => 10];
return ['A' => 8, 'B' => 25, 'C' => 8, 'D' => 10, 'E' => 12, 'F' => 12,
'G' => 12, 'H' => 12, 'I' => 12, 'J' => 14, 'K' => 14, 'L' => 14,
'M' => 8, 'N' => 10, 'O' => 10, 'P' => 12, 'Q' => 10];
}
}
@@ -270,7 +273,7 @@ class FeaturesSheet extends BaseSheet
'ID', 'Elemento', 'Fase', 'Capa', 'Estado', 'Progreso (%)', 'Progreso Plan (%)',
'Inicio Plan', 'Fin Plan', 'Inicio Real', 'Fin Real', 'Desvío Fin (días)',
'Desvío Inicio (días)', 'SPI', 'En Plazo', 'Responsable', 'Template',
'Última Inspección', 'Resultado', 'Inspecciones', 'Issues Abiertos'
'Última Inspección', 'Resultado', 'Inspecciones', 'Issues Abiertos',
];
}
@@ -305,10 +308,10 @@ class FeaturesSheet extends BaseSheet
public function columnWidths(): array
{
return ['A' => 8, 'B' => 25, 'C' => 20, 'D' => 20, 'E' => 15, 'F' => 12,
'G' => 14, 'H' => 12, 'I' => 12, 'J' => 12, 'K' => 12, 'L' => 14,
'M' => 14, 'N' => 8, 'O' => 10, 'P' => 20, 'Q' => 20, 'R' => 14,
'S' => 12, 'T' => 12, 'U' => 12];
return ['A' => 8, 'B' => 25, 'C' => 20, 'D' => 20, 'E' => 15, 'F' => 12,
'G' => 14, 'H' => 12, 'I' => 12, 'J' => 12, 'K' => 12, 'L' => 14,
'M' => 14, 'N' => 8, 'O' => 10, 'P' => 20, 'Q' => 20, 'R' => 14,
'S' => 12, 'T' => 12, 'U' => 12];
}
}
@@ -321,8 +324,8 @@ class InspectionsSheet extends BaseSheet
public function headings(): array
{
return [
'ID', 'Elemento', 'Fase', 'Template', 'Inspector', 'Fecha',
'Estado', 'Resultado', 'Notas', 'Fotos'
'ID', 'Elemento', 'Fase', 'Template', 'Inspector', 'Fecha',
'Estado', 'Resultado', 'Notas', 'Fotos',
];
}
@@ -346,8 +349,8 @@ class InspectionsSheet extends BaseSheet
public function columnWidths(): array
{
return ['A' => 8, 'B' => 25, 'C' => 20, 'D' => 25, 'E' => 20, 'F' => 18,
'G' => 12, 'H' => 12, 'I' => 40, 'J' => 8];
return ['A' => 8, 'B' => 25, 'C' => 20, 'D' => 25, 'E' => 20, 'F' => 18,
'G' => 12, 'H' => 12, 'I' => 40, 'J' => 8];
}
}
@@ -360,9 +363,9 @@ class IssuesSheet extends BaseSheet
public function headings(): array
{
return [
'ID', 'Título', 'Elemento', 'Fase', 'Prioridad', 'Estado',
'Reportado por', 'Asignado a', 'Creado', 'Cerrado', 'Días abierto',
'Tareas total', 'Tareas completadas'
'ID', 'Título', 'Elemento', 'Fase', 'Prioridad', 'Estado',
'Reportado por', 'Asignado a', 'Creado', 'Cerrado', 'Días abierto',
'Tareas total', 'Tareas completadas',
];
}
@@ -389,8 +392,8 @@ class IssuesSheet extends BaseSheet
public function columnWidths(): array
{
return ['A' => 8, 'B' => 35, 'C' => 20, 'D' => 20, 'E' => 12, 'F' => 15,
'G' => 20, 'H' => 20, 'I' => 12, 'J' => 12, 'K' => 12, 'L' => 12, 'M' => 14];
return ['A' => 8, 'B' => 35, 'C' => 20, 'D' => 20, 'E' => 12, 'F' => 15,
'G' => 20, 'H' => 20, 'I' => 12, 'J' => 12, 'K' => 12, 'L' => 12, 'M' => 14];
}
}
@@ -404,15 +407,16 @@ class TasksSheet extends BaseSheet
{
return [
'ID', 'Tarea', 'Fase', 'Estado', 'Prioridad', 'Asignado', 'Creador',
'Fecha inicio', 'Fecha fin', 'Completada', 'Horas est.', 'Horas real',
'Progreso (%)', 'Vencida', 'Subtareas'
'Fecha inicio', 'Fecha fin', 'Completada', 'Horas est.', 'Horas real',
'Progreso (%)', 'Vencida', 'Subtareas',
];
}
public function array(): array
{
return array_map(function ($task) {
$subtasksStr = implode('; ', array_map(fn($st) => "{$st['title']} ({$st['status']})", $task['subtasks']));
$subtasksStr = implode('; ', array_map(fn ($st) => "{$st['title']} ({$st['status']})", $task['subtasks']));
return [
$task['id'],
$task['title'],
@@ -435,9 +439,9 @@ class TasksSheet extends BaseSheet
public function columnWidths(): array
{
return ['A' => 8, 'B' => 30, 'C' => 20, 'D' => 15, 'E' => 12, 'F' => 20,
'G' => 20, 'H' => 12, 'I' => 12, 'J' => 12, 'K' => 10, 'L' => 10,
'M' => 12, 'N' => 10, 'O' => 40];
return ['A' => 8, 'B' => 30, 'C' => 20, 'D' => 15, 'E' => 12, 'F' => 20,
'G' => 20, 'H' => 12, 'I' => 12, 'J' => 12, 'K' => 10, 'L' => 10,
'M' => 12, 'N' => 10, 'O' => 40];
}
}
@@ -453,14 +457,14 @@ class DeviationsSheet extends BaseSheet
{
$this->deviations = $deviations;
$rows = [];
// Phase deviations
if (!empty($deviations['phases'])) {
if (! empty($deviations['phases'])) {
$rows[] = ['=== DESVÍOS POR FASE ===', '', '', '', '', '', '', '', '', '', ''];
$rows[] = ['ID', 'Fase', 'Inicio Plan', 'Fin Plan', 'Inicio Real', 'Fin Real',
'Desvío Inicio (d)', 'Desvío Fin (d)', 'Prog. Plan (%)', 'Prog. Real (%)',
'Desvío Prog.', 'SPI', 'En Plazo'];
$rows[] = ['ID', 'Fase', 'Inicio Plan', 'Fin Plan', 'Inicio Real', 'Fin Real',
'Desvío Inicio (d)', 'Desvío Fin (d)', 'Prog. Plan (%)', 'Prog. Real (%)',
'Desvío Prog.', 'SPI', 'En Plazo'];
foreach ($deviations['phases'] as $phase) {
$rows[] = [
$phase['id'], $phase['name'], $phase['planned_start'], $phase['planned_end'],
@@ -475,12 +479,12 @@ class DeviationsSheet extends BaseSheet
}
// Feature deviations
if (!empty($deviations['features'])) {
if (! empty($deviations['features'])) {
$rows[] = ['=== DESVÍOS POR ELEMENTO ===', '', '', '', '', '', '', '', '', '', '', '', ''];
$rows[] = ['ID', 'Elemento', 'Fase', 'Inicio Plan', 'Fin Plan', 'Inicio Real', 'Fin Real',
'Desvío Inicio (d)', 'Desvío Fin (d)', 'Prog. Plan (%)', 'Prog. Real (%)',
'Desvío Prog.', 'SPI', 'En Plazo', 'Responsable'];
$rows[] = ['ID', 'Elemento', 'Fase', 'Inicio Plan', 'Fin Plan', 'Inicio Real', 'Fin Real',
'Desvío Inicio (d)', 'Desvío Fin (d)', 'Prog. Plan (%)', 'Prog. Real (%)',
'Desvío Prog.', 'SPI', 'En Plazo', 'Responsable'];
foreach ($deviations['features'] as $feature) {
$rows[] = [
$feature['id'], $feature['name'], $feature['phase'],
@@ -497,7 +501,7 @@ class DeviationsSheet extends BaseSheet
}
// Summary
if (!empty($deviations['summary'])) {
if (! empty($deviations['summary'])) {
$rows[] = ['=== RESUMEN DESVÍOS ===', ''];
$rows[] = ['Fases retrasadas', $deviations['summary']['phases_delayed'] ?? 0];
$rows[] = ['Fases adelantadas', $deviations['summary']['phases_early'] ?? 0];
@@ -522,9 +526,9 @@ class DeviationsSheet extends BaseSheet
public function columnWidths(): array
{
return ['A' => 25, 'B' => 25, 'C' => 20, 'D' => 12, 'E' => 12, 'F' => 12,
'G' => 12, 'H' => 14, 'I' => 14, 'J' => 14, 'K' => 14, 'L' => 10,
'M' => 10, 'N' => 20];
return ['A' => 25, 'B' => 25, 'C' => 20, 'D' => 12, 'E' => 12, 'F' => 12,
'G' => 12, 'H' => 14, 'I' => 14, 'J' => 14, 'K' => 14, 'L' => 10,
'M' => 10, 'N' => 20];
}
}
@@ -558,8 +562,8 @@ class MediaSheet extends BaseSheet
public function columnWidths(): array
{
return ['A' => 8, 'B' => 30, 'C' => 12, 'D' => 15, 'E' => 30, 'F' => 12,
'G' => 20, 'H' => 18, 'I' => 50];
return ['A' => 8, 'B' => 30, 'C' => 12, 'D' => 15, 'E' => 30, 'F' => 12,
'G' => 20, 'H' => 18, 'I' => 50];
}
}
@@ -574,17 +578,17 @@ class ProgressCurveSheet extends BaseSheet
public function __construct(array $curveData)
{
$this->curveData = $curveData;
$rows = [['Fecha', 'Progreso Planificado (%)', 'Progreso Real (%)']];
$labels = $curveData['labels'] ?? [];
$planned = $curveData['planned'] ?? [];
$actual = $curveData['actual'] ?? [];
for ($i = 0; $i < count($labels); $i++) {
$rows[] = [$labels[$i], $planned[$i] ?? 0, $actual[$i] ?? 0];
}
$this->rows = $rows;
}
@@ -611,13 +615,14 @@ class ProgressCurveSheet extends BaseSheet
class ParametersSheet extends BaseSheet
{
protected ReportFilters $filters;
protected Project $project;
public function __construct(ReportFilters $filters, Project $project)
{
$this->filters = $filters;
$this->project = $project;
$rows = [
['Parámetro', 'Valor'],
['Proyecto', $project->name],
@@ -625,7 +630,7 @@ class ParametersSheet extends BaseSheet
['Fecha desde', $filters->dateFrom?->format('d/m/Y') ?? '—'],
['Fecha hasta', $filters->dateTo?->format('d/m/Y') ?? '—'],
['Entidades incluidas', implode(', ', array_map(
fn($e) => $filters->getAvailableEntities()[$e] ?? $e,
fn ($e) => $filters->getAvailableEntities()[$e] ?? $e,
$filters->entityTypes
))],
['Incluir fotos', $filters->includePhotos ? 'Sí' : 'No'],
@@ -634,7 +639,7 @@ class ParametersSheet extends BaseSheet
['Generado', now()->format('d/m/Y H:i')],
['Generado por', auth()->guard()->user()?->name ?? 'Sistema'],
];
parent::__construct($rows);
}
@@ -652,4 +657,4 @@ class ParametersSheet extends BaseSheet
{
return ['A' => 30, 'B' => 50];
}
}
}