user()->isAdmin() || auth()->user()->isManager(), 403); } public function render(ReportService $reportService) { $filters = [ 'date_from' => $this->dateFrom ?: null, 'date_to' => $this->dateTo ?: null, 'technician_id' => $this->technicianId ?: null, 'type_id' => $this->typeId ?: null, 'status_id' => $this->statusId ?: null, ]; $rows = $reportService->requestBaseQuery($filters)->latest()->limit(200)->get(); $statusChart = $reportService->requestsByStatus($filters); $this->dispatch('general-report-chart-updated', chart: $statusChart->values()->toArray()); return view('livewire.reports.general-report-page', [ 'rows' => $rows, 'statusChart' => $statusChart, 'technicians' => User::query()->where('role', 'technician')->orderBy('name')->get(), 'types' => RequestType::query()->orderBy('name')->get(), 'statuses' => Status::query()->orderBy('sort_order')->get(), ])->title('Отчет: Общий'); } }