{{ __('Configure') }} {{-- Retention warning --}} @if ($retentionDays <= 0)
{{ __('Auto-cleanup is disabled.') }} {{ __('Configure Log Retention') }} {{ __('to automatically purge old entries.') }} @if ($totalLogs > 0) {{ __('There are currently :n entries.', ['n' => number_format($totalLogs)]) }} @endif
@else
{{ __('Auto-cleanup is active: entries older than :days days are purged daily.', ['days' => $retentionDays]) }} {{ __(':total entries in the log.', ['total' => number_format($totalLogs)]) }}
@endif {{-- ── Filter bar ── --}} {{-- Desktop: single horizontal row. Tablet: 2 rows. Mobile: stacked. --}}
{{-- Search — wider than the rest --}}
{{-- Module --}}
{{-- Action --}}
{{-- Result --}}
{{-- Date from --}}
{{-- Date to --}}
{{-- Clear — only when a filter is active --}} @if ($search || $filterModule || $filterAction || $filterResult || $filterDateFrom || $filterDateTo)
@endif
{{-- ── Table ── --}}
@forelse ($logs as $log) {{-- Staff --}} {{-- Action badge --}} {{-- Module --}} {{-- Record --}} {{-- IP --}} {{-- Date --}} {{-- Result --}} {{-- Detail button --}} @empty @endforelse
{{ __('Staff') }} {{ __('Action') }} {{ __('Module') }} {{ __('Record') }} {{ __('IP Address') }} {{ __('Date') }} {{ __('Result') }}
{{ $log->user_name ?: '—' }}
{{ $log->user_role ?: '—' }}
@php $actionColor = match ($log->action) { 'create' => 'var(--color-success)', 'update' => 'var(--color-primary)', 'delete' => 'var(--color-danger)', 'toggle' => 'var(--color-warning)', default => 'var(--color-text-muted)', }; @endphp {{ __(ucfirst($log->action)) }} {{ __(ucwords(str_replace('_', ' ', $log->module))) }} @if ($log->target_label) {{ $log->target_label }} @if ($log->target_type) ({{ class_basename($log->target_type) }}) @endif @else — @endif {{ $log->ip ?? '—' }} {{ $log->created_at->diffForHumans() }} @if ($log->result === 'success') {{ __('Success') }} @else {{ __('Failed') }} @endif
@if ($logs->hasPages())
{{ $logs->links() }}
@endif
{{-- ── Detail modal ── --}} @if ($detail) {{-- Header info --}}

{{ __('Staff') }}

{{ $detail->user_name }}

{{ $detail->user_role }}

{{ __('Date') }}

{{ rf_datetime($detail->created_at) }}

{{ $detail->created_at->diffForHumans() }}

{{ __('IP Address') }}

{{ $detail->ip ?? '—' }}

{{ __('User Agent') }}

{{ $detail->user_agent ? \Illuminate\Support\Str::limit($detail->user_agent, 60) : '—' }}

{{-- Action summary --}}
@php $actionColor = match ($detail->action) { 'create' => 'var(--color-success)', 'update' => 'var(--color-primary)', 'delete' => 'var(--color-danger)', 'toggle' => 'var(--color-warning)', default => 'var(--color-text-muted)', }; @endphp {{ __(ucfirst($detail->action)) }} {{ __(ucwords(str_replace('_', ' ', $detail->module))) }} @if ($detail->result === 'success') {{ __('Success') }} @else {{ __('Failed') }} @endif
{{-- Target --}} @if ($detail->target_label || $detail->target_type)

{{ __('Record') }}

@if ($detail->target_type) {{ class_basename($detail->target_type) }} @if ($detail->target_id) #{{ $detail->target_id }} @endif  —  @endif {{ $detail->target_label ?? '—' }}

@endif {{-- old / new values --}} @if ($detail->old_values || $detail->new_values)
@if ($detail->old_values)

{{ __('Before') }}

@foreach ($detail->old_values as $k => $v) @endforeach
{{ $k }} @if ($v === '[REDACTED]') [REDACTED] @elseif (is_array($v)) {{ json_encode($v) }} @else {{ $v }} @endif
@endif @if ($detail->new_values)

{{ __('After') }}

@foreach ($detail->new_values as $k => $v) @endforeach
{{ $k }} @if ($v === '[REDACTED]') [REDACTED] @elseif (is_array($v)) {{ json_encode($v) }} @else {{ $v }} @endif
@endif
@endif @else

{{ __('Log entry not found.') }}

@endif