@php /** @var \Illuminate\Contracts\Pagination\LengthAwarePaginator $paginator */ $paginator = $this->getActivities(); // Aktivitäten der aktuellen Seite nach Batch gruppieren $batches = $paginator->getCollection()->groupBy(fn ($a) => $a->batch_uuid ?? '_no_batch_'); @endphp
@foreach ($batches as $batchUuid => $activities) @php /** @var \Illuminate\Support\Collection|\Spatie\Activitylog\Models\Activity[] $activities */ $firstWithUser = $activities->first(fn ($a) => !is_null($a->causer)); $header = $firstWithUser ?: $activities->first(); // Zeitfenster (Seite) – Originalformat beibehalten $minAt = optional($activities->min('created_at')) ? optional($activities->min('created_at'))->format(__('filament-activity-log::activities.default_datetime_format')) : null; $maxAt = optional($activities->max('created_at')) ? optional($activities->max('created_at'))->format(__('filament-activity-log::activities.default_datetime_format')) : null; $timeText = $minAt && $maxAt ? ($minAt === $maxAt ? $minAt : ($minAt.' – '.$maxAt)) : ''; // Innerhalb des Batches nach log_name gruppieren $byLog = $activities->groupBy('log_name'); @endphp {{-- ===== EIN BLOCK / KARTE PRO BATCH – Original Look & Feel ===== --}}
@if ($header?->causer) @endif
{{ $header?->causer?->name ?? '—' }} @if ($timeText) {{ __('filament-activity-log::activities.events.updated') }} {{ $timeText }} @endif
@foreach ($byLog as $logName => $items) @php // Überschrift pro Bereich dezent $sectionLabel = match ($logName) { 'invoice' => 'Rechnung', 'invoice_items' => 'Position', 'invoice_logics' => 'Logik', 'invoice_thresholds' => 'Sonderposition/Schadenfreibetrag', default => $logName, }; @endphp
{{ $sectionLabel }}
@foreach ($items as $activityItem) @php $changes = $activityItem->getChangesAttribute(); @endphp @if ($changes->isNotEmpty()) @foreach (data_get($changes, 'attributes', []) as $field => $newValue) @php $oldValue = data_get($changes, "old.$field", ''); @endphp $loop->even])> @endforeach
{{ __('filament-activity-log::activities.table.field') }} {{ __('filament-activity-log::activities.table.old') }} {{ __('filament-activity-log::activities.table.new') }}
{{ $this->getFieldLabel($field) }} @if (is_array($oldValue))
{{ json_encode($oldValue, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES) }}
@elseif($field == 'status') {{ $this->getFieldLabel($oldValue,'invoice.status') }} @else {{ is_bool($oldValue) ? ($oldValue ? 'an' : 'aus') : $this->getFieldLabel($oldValue,'invoice.options') }} @endif
@if (is_array($newValue))
{{ json_encode($newValue, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES) }}
@elseif($field == 'status') {{ $this->getFieldLabel($newValue,'invoice.status') }} @else {{ is_bool($newValue) ? ($newValue ? 'an' : 'aus') : $this->getFieldLabel($newValue,'invoice.options') }} @endif
@endif @endforeach
@endforeach
@endforeach {{-- Original-Pagination beibehalten --}}