From 43c1400e7c3d24792c4cd95230b2f970c1614f66 Mon Sep 17 00:00:00 2001 From: Juan Felipe Zapata Moreno Date: Wed, 21 Jan 2026 19:35:07 -0600 Subject: [PATCH] =?UTF-8?q?fix:=20excluir=20actualizaci=C3=B3n=20al=20gene?= =?UTF-8?q?rar=20excel=20vista=20consulta=20para=20admin?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Http/Controllers/Repuve/ExcelController.php | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/app/Http/Controllers/Repuve/ExcelController.php b/app/Http/Controllers/Repuve/ExcelController.php index 2c19ef9..f89f40e 100644 --- a/app/Http/Controllers/Repuve/ExcelController.php +++ b/app/Http/Controllers/Repuve/ExcelController.php @@ -1181,7 +1181,7 @@ public function exportSearchRecords(Request $request) 'vin' => 'nullable|string', 'tag_number' => 'nullable|string', 'module_id' => 'nullable|integer|exists:modules,id', - 'action_type' => 'nullable|string|in:inscripcion,actualizacion,sustitucion,cancelacion', + 'action_type' => 'nullable|string|in:inscripcion,sustitucion,cancelacion', 'status' => 'nullable|string', 'start_date' => 'nullable|date', 'end_date' => 'nullable|date|after_or_equal:start_date', @@ -1277,8 +1277,10 @@ public function exportSearchRecords(Request $request) $moduleName = $record->module->name ?? ''; $operador = $record->user->name ?? $record->user->username ?? ''; - // Obtener todos los logs ordenados por fecha ascendente - $vehicleLogs = $vehicle->vehicleTagLogs->sortBy('created_at'); + // Obtener logs ordenados por fecha, excluyendo actualizaciones + $vehicleLogs = $vehicle->vehicleTagLogs + ->whereIn('action_type', ['inscripcion', 'sustitucion', 'cancelacion']) + ->sortBy('created_at'); // Generar una fila por cada log (cada acción en el historial) foreach ($vehicleLogs as $log) { @@ -1408,7 +1410,7 @@ public function exportSearchRecords(Request $request) $sheet->setCellValue('L' . $row, $item['tag']); // Aplicar estilos a todas las columnas - foreach (range('A', 'M') as $col) { + foreach (range('A', 'L') as $col) { $sheet->getStyle("{$col}{$row}")->applyFromArray($cellStyle); }