subMonth(); $this->selectedPeriod = $previousMonth->format('Y-m'); } public function getAvailableMonthsProperty(): array { $months = []; for ($i = 1; $i <= 12; $i++) { $date = now()->subMonths($i); $months[] = [ 'value' => $date->format('Y-m'), 'label' => $date->translatedFormat('F Y'), ]; } return $months; } public function generate(): ?StreamedResponse { $this->generating = true; try { [$year, $month] = explode('-', $this->selectedPeriod); $service = app(MonthlyReportService::class); return $service->generate((int) $year, (int) $month); } catch (\Exception $e) { $this->dispatch('notify', type: 'error', message: __('report.report_failed')); return null; } finally { $this->generating = false; } } }; ?>
{{ __('report.monthly_report') }} {{ __('report.monthly_report_description') }}
@foreach ($this->availableMonths as $option) {{ $option['label'] }} @endforeach
{{ __('report.generate') }} {{ __('report.generating') }}
{{ __('report.table_of_contents') }}
1 {{ __('report.executive_summary') }}
2 {{ __('report.user_statistics') }}
3 {{ __('report.consultation_statistics') }}
4 {{ __('report.timeline_statistics') }}
5 {{ __('report.post_statistics') }}
6 {{ __('report.trends_chart') }}