50 lines
1.3 KiB
Markdown
50 lines
1.3 KiB
Markdown
# Story 6.2: Analytics Charts
|
|
|
|
## Epic Reference
|
|
**Epic 6:** Admin Dashboard
|
|
|
|
## User Story
|
|
As an **admin**,
|
|
I want **visual charts showing trends and historical data**,
|
|
So that **I can analyze business patterns over time**.
|
|
|
|
## Acceptance Criteria
|
|
|
|
### Charts Required
|
|
- [ ] Monthly Trends (Line chart): New clients and consultations per month
|
|
- [ ] Consultation Breakdown (Pie/Donut): Free vs paid ratio
|
|
- [ ] No-show Rate (Line chart): Monthly no-show trend
|
|
|
|
### Features
|
|
- [ ] Date range selector (6 months, 12 months, custom)
|
|
- [ ] Chart tooltips with exact values
|
|
- [ ] Responsive charts
|
|
- [ ] Bilingual labels
|
|
|
|
## Technical Notes
|
|
|
|
Use Chart.js for visualizations. Aggregate data server-side.
|
|
|
|
```php
|
|
public function getChartData(string $period = '6m'): array
|
|
{
|
|
$months = $period === '6m' ? 6 : 12;
|
|
|
|
return [
|
|
'labels' => collect(range($months - 1, 0))->map(fn($i) => now()->subMonths($i)->format('M Y'))->toArray(),
|
|
'clients' => $this->getMonthlyClients($months),
|
|
'consultations' => $this->getMonthlyConsultations($months),
|
|
];
|
|
}
|
|
```
|
|
|
|
## Definition of Done
|
|
- [ ] All charts render correctly
|
|
- [ ] Date range selector works
|
|
- [ ] Tooltips functional
|
|
- [ ] Mobile responsive
|
|
- [ ] Tests pass
|
|
|
|
## Estimation
|
|
**Complexity:** Medium-High | **Effort:** 4-5 hours
|