# Story 4.4: Admin Timeline Dashboard ## Epic Reference **Epic 4:** Case Timeline System ## User Story As an **admin**, I want **a central view to manage all timelines across all clients**, So that **I can efficiently track and update case progress**. ## Story Context ### Existing System Integration - **Integrates with:** timelines table, users table - **Technology:** Livewire Volt with pagination - **Follows pattern:** Admin list/dashboard pattern - **Touch points:** All timeline operations ## Acceptance Criteria ### List View - [ ] Display all timelines with: - Case name - Client name - Status (active/archived) - Last update date - Update count - [ ] Pagination (15/25/50 per page) ### Filtering - [ ] Filter by client (search/select) - [ ] Filter by status (active/archived/all) - [ ] Filter by date range (created/updated) - [ ] Search by case name or reference ### Sorting - [ ] Sort by client name - [ ] Sort by case name - [ ] Sort by last updated - [ ] Sort by created date ### Quick Actions - [ ] View timeline details - [ ] Add update (inline or link) - [ ] Archive/unarchive toggle ### Quality Requirements - [ ] Fast loading with eager loading - [ ] Bilingual support - [ ] Tests for filtering/sorting ## Technical Notes ### Volt Component ```php resetPage(); } public function sort(string $column): void { if ($this->sortBy === $column) { $this->sortDir = $this->sortDir === 'asc' ? 'desc' : 'asc'; } else { $this->sortBy = $column; $this->sortDir = 'asc'; } } public function with(): array { return [ 'timelines' => Timeline::query() ->with(['user', 'updates' => fn($q) => $q->latest()->limit(1)]) ->withCount('updates') ->when($this->search, fn($q) => $q->where(function($q) { $q->where('case_name', 'like', "%{$this->search}%") ->orWhere('case_reference', 'like', "%{$this->search}%"); })) ->when($this->clientFilter, fn($q) => $q->where('user_id', $this->clientFilter)) ->when($this->statusFilter, fn($q) => $q->where('status', $this->statusFilter)) ->when($this->dateFrom, fn($q) => $q->where('created_at', '>=', $this->dateFrom)) ->when($this->dateTo, fn($q) => $q->where('created_at', '<=', $this->dateTo)) ->orderBy($this->sortBy, $this->sortDir) ->paginate($this->perPage), ]; } }; ``` ### Template Structure ```blade
@foreach($timelines as $timeline) @endforeach
{{ __('admin.case_name') }} {{ __('admin.client') }} {{ __('admin.status') }} {{ __('admin.last_update') }} {{ __('admin.actions') }}
{{ $timeline->case_name }} {{ $timeline->user->name }} {{ __('admin.' . $timeline->status) }} {{ $timeline->updated_at->diffForHumans() }} {{ __('admin.actions') }} {{ __('admin.view') }} {{ $timeline->status === 'active' ? __('admin.archive') : __('admin.unarchive') }}
{{ $timelines->links() }}
``` ## Definition of Done - [ ] List displays all timelines - [ ] All filters working - [ ] All sorts working - [ ] Quick actions functional - [ ] Pagination working - [ ] No N+1 queries - [ ] Bilingual support - [ ] Tests pass - [ ] Code formatted with Pint ## Dependencies - **Story 4.1:** Timeline creation - **Story 4.3:** Archive functionality ## Estimation **Complexity:** Medium **Estimated Effort:** 3-4 hours