@extends('layouts.app')
@section('title', 'Activity Log')
@section('page_title', 'Activity Log')
@section('breadcrumbs')
    <li class="breadcrumb-item"><a href="{{ route('dashboard') }}">Home</a></li>
    <li class="breadcrumb-item active">Activity Log</li>
@endsection

@section('content')
    <div class="card">
        <div class="card-body">
            <div class="table-responsive">
                <table class="table table-hover align-middle">
                    <thead><tr><th>When</th><th>User</th><th>Action</th><th>Subject</th></tr></thead>
                    <tbody>
                        @forelse($activities as $log)
                            <tr>
                                <td class="small">{{ $log->created_at->format('d M Y, H:i') }}</td>
                                <td>{{ $log->causer?->name ?? 'System' }}</td>
                                <td><span class="badge bg-soft-info text-capitalize">{{ $log->event ?? $log->description }}</span></td>
                                <td class="small text-muted">{{ class_basename($log->subject_type) }} #{{ $log->subject_id }}</td>
                            </tr>
                        @empty
                            <tr><td colspan="4" class="text-center text-muted py-4">No activity recorded yet.</td></tr>
                        @endforelse
                    </tbody>
                </table>
            </div>
            {{ $activities->links() }}
        </div>
    </div>
@endsection
