fix: excluir actualización al generar excel vista consulta para admin
This commit is contained in:
parent
c725072291
commit
43c1400e7c
@ -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);
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user