+
+
+
+
Activity Logs: {{ $user->name ?? 'Unknown' }}
+
Export CSV
+
+
+ @if($logs->isNotEmpty())
+
+
+
+
+ | No |
+ Date & Time |
+ Action |
+ Subject |
+ Details |
+ IP Address |
+
+
+
+ @foreach ($logs as $log)
+ @php
+ $actionLabel = match($log->action) {
+ 'login' => 'Login',
+ 'logout' => 'Logout',
+ 'create_station' => 'Create Station',
+ 'update_station' => 'Update Station',
+ 'delete_station' => 'Delete Station',
+ 'import_stations_csv' => 'Import CSV',
+ 'export_stations_csv' => 'Export CSV',
+ 'update_cctv_link' => 'Update CCTV Link',
+ 'create_user' => 'Create User',
+ 'update_user' => 'Update User',
+ 'update_password' => 'Update Password',
+ 'delete_user' => 'Delete User',
+ 'export_user_logs' => 'Export Logs',
+ default => '' . e($log->action) . '',
+ };
+ $details = '';
+ if ($log->properties) {
+ $parts = [];
+ foreach ($log->properties as $key => $val) {
+ if ($key === 'password') continue;
+ $parts[] = "$key: $val";
+ }
+ $details = implode(', ', $parts);
+ }
+ @endphp
+
+ | {{ $loop->iteration }} |
+ {{ $log->created_at ? \Carbon\Carbon::parse($log->created_at)->format('d/m/Y H:i:s') : '-' }} |
+ {!! $actionLabel !!} |
+ {{ $log->subject_type ? ucfirst($log->subject_type) . ' ' . $log->subject_id : '-' }} |
+ {{ $details }} |
+ {{ $log->ip_address ?? '-' }} |
+
+ @endforeach
+
+
+
+
+ @if ($logs->hasPages())
+
+ @endif
+
+ @else
+
+ No activity logs found for this user.
+
+ @endif
+
+