libra/docs/stories/story-6.6-data-export-timel...

66 lines
1.5 KiB
Markdown

# Story 6.6: Data Export - Timeline Reports
## Epic Reference
**Epic 6:** Admin Dashboard
## User Story
As an **admin**,
I want **to export timeline and case data**,
So that **I can maintain records and generate case reports**.
## Acceptance Criteria
### Export Options
- [ ] Export all timelines (across all clients)
- [ ] Export timelines for specific client
### Filters
- [ ] Status (active/archived)
- [ ] Date range
### Export Includes
- [ ] Case name and reference
- [ ] Client name
- [ ] Status
- [ ] Created date
- [ ] Number of updates
- [ ] Last update date
### Formats
- [ ] CSV format
- [ ] PDF format
### Optional
- [ ] Include update content or summary only toggle
## Technical Notes
```php
public function exportTimelinesPdf(Request $request)
{
$timelines = Timeline::query()
->with(['user', 'updates'])
->withCount('updates')
->when($request->client_id, fn($q) => $q->where('user_id', $request->client_id))
->when($request->status, fn($q) => $q->where('status', $request->status))
->get();
$pdf = Pdf::loadView('exports.timelines', [
'timelines' => $timelines,
'includeUpdates' => $request->boolean('include_updates'),
]);
return $pdf->download('timelines-export.pdf');
}
```
## Definition of Done
- [ ] All filters work
- [ ] CSV export works
- [ ] PDF with branding works
- [ ] Optional update content toggle works
- [ ] Tests pass
## Estimation
**Complexity:** Medium | **Effort:** 3 hours