71 lines
1.8 KiB
Markdown
71 lines
1.8 KiB
Markdown
# Story 6.7: Monthly Statistics Report
|
|
|
|
## Epic Reference
|
|
**Epic 6:** Admin Dashboard
|
|
|
|
## User Story
|
|
As an **admin**,
|
|
I want **to generate comprehensive monthly PDF reports**,
|
|
So that **I have professional summaries of business performance**.
|
|
|
|
## Acceptance Criteria
|
|
|
|
### Generation
|
|
- [ ] "Generate Monthly Report" button
|
|
- [ ] Select month/year
|
|
|
|
### PDF Report Includes
|
|
- [ ] Overview of key metrics
|
|
- [ ] Charts (rendered as images)
|
|
- [ ] User statistics
|
|
- [ ] Consultation statistics
|
|
- [ ] Timeline statistics
|
|
- [ ] Post statistics
|
|
|
|
### Design
|
|
- [ ] Professional layout with branding
|
|
- [ ] Table of contents
|
|
- [ ] Printable format
|
|
- [ ] Bilingual based on admin preference
|
|
|
|
### UX
|
|
- [ ] Loading indicator during generation
|
|
- [ ] Download on completion
|
|
|
|
## Technical Notes
|
|
|
|
Pre-render charts as base64 images for PDF inclusion.
|
|
|
|
```php
|
|
public function generateMonthlyReport(int $year, int $month)
|
|
{
|
|
$startDate = Carbon::create($year, $month, 1)->startOfMonth();
|
|
$endDate = $startDate->copy()->endOfMonth();
|
|
|
|
$data = [
|
|
'period' => $startDate->format('F Y'),
|
|
'userStats' => $this->getUserStatsForPeriod($startDate, $endDate),
|
|
'consultationStats' => $this->getConsultationStatsForPeriod($startDate, $endDate),
|
|
'timelineStats' => $this->getTimelineStatsForPeriod($startDate, $endDate),
|
|
'postStats' => $this->getPostStatsForPeriod($startDate, $endDate),
|
|
'charts' => $this->renderChartsAsImages($startDate, $endDate),
|
|
];
|
|
|
|
$pdf = Pdf::loadView('exports.monthly-report', $data)
|
|
->setPaper('a4', 'portrait');
|
|
|
|
return $pdf->download("monthly-report-{$year}-{$month}.pdf");
|
|
}
|
|
```
|
|
|
|
## Definition of Done
|
|
- [ ] Month/year selector works
|
|
- [ ] All statistics accurate
|
|
- [ ] Charts rendered in PDF
|
|
- [ ] Professional branding
|
|
- [ ] Bilingual support
|
|
- [ ] Tests pass
|
|
|
|
## Estimation
|
|
**Complexity:** High | **Effort:** 5-6 hours
|