@extends('layouts.app') @section('title', 'Audit Trail') @section('content')

📜 Audit Trail - {{ ucfirst(str_replace('_', ' ', $auditableType)) }} #{{ $auditableId }}

@if($auditLogs->isEmpty())

No audit records found.

@else
@foreach($auditLogs as $log)
{{ $log->created_at->format('M d, Y H:i:s') }} {{ $log->human_event }}
{!! $log->getEventIconAttribute() !!} {{ $log->user?->name ?? 'System' }} @if($log->user && isset($log->user->familyMember)) ({{ ucfirst($log->user->familyMember->role) }}) @endif
@if($log->changed_attributes && count($log->changed_attributes) > 0)
Changes made: @foreach($log->changed_attributes as $field => $change)
{{ ucfirst(str_replace('_', ' ', $field)) }}: {{ $change['from'] ?? 'NULL' }} → {{ $change['to'] ?? 'NULL' }}
@endforeach
@elseif($log->event === 'created')
Transaction Created
Initial record created in system
@elseif($log->event === 'deleted')
Transaction Deleted
Record removed from system
@endif
IP: {{ $log->ip_address }} Session: {{ substr($log->session_id ?? '', 0, 8) }}...
@endforeach
{{ $auditLogs->links() }} @endif
@endsection