diff --git a/src/components/reports/csat-report.tsx b/src/components/reports/csat-report.tsx index 39f19b1..61e33d9 100644 --- a/src/components/reports/csat-report.tsx +++ b/src/components/reports/csat-report.tsx @@ -12,6 +12,7 @@ import { Badge } from "@/components/ui/badge" import { useState } from "react" import { Button } from "@/components/ui/button" import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from "@/components/ui/select" +import { ToggleGroup, ToggleGroupItem } from "@/components/ui/toggle-group" function formatScore(value: number | null) { if (value === null) return "—" @@ -20,12 +21,13 @@ function formatScore(value: number | null) { export function CsatReport() { const [companyId, setCompanyId] = useState("all") + const [timeRange, setTimeRange] = useState("90d") const { session, convexUserId } = useAuth() const tenantId = session?.user.tenantId ?? DEFAULT_TENANT_ID const data = useQuery( api.reports.csatOverview, convexUserId - ? ({ tenantId, viewerId: convexUserId as Id<"users">, companyId: companyId === "all" ? undefined : (companyId as Id<"companies">) }) + ? ({ tenantId, viewerId: convexUserId as Id<"users">, range: timeRange, companyId: companyId === "all" ? undefined : (companyId as Id<"companies">) }) : "skip" ) const companies = useQuery(api.companies.list, convexUserId ? { tenantId, viewerId: convexUserId as Id<"users"> } : "skip") as Array<{ id: Id<"companies">; name: string }> | undefined @@ -45,27 +47,42 @@ export function CsatReport() {
- - CSAT médio - - Média das respostas recebidas. + + CSAT médio + + Média das respostas recebidas. - - +
+ + + + 90 dias + 30 dias + 7 dias + + + +
diff --git a/src/components/reports/sla-report.tsx b/src/components/reports/sla-report.tsx index bb0bf8e..2735bb0 100644 --- a/src/components/reports/sla-report.tsx +++ b/src/components/reports/sla-report.tsx @@ -13,6 +13,7 @@ import { Badge } from "@/components/ui/badge" import { Button } from "@/components/ui/button" import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from "@/components/ui/select" import { useState } from "react" +import { ToggleGroup, ToggleGroupItem } from "@/components/ui/toggle-group" function formatMinutes(value: number | null) { if (value === null) return "—" @@ -25,12 +26,13 @@ function formatMinutes(value: number | null) { export function SlaReport() { const [companyId, setCompanyId] = useState("all") + const [timeRange, setTimeRange] = useState("90d") const { session, convexUserId } = useAuth() const tenantId = session?.user.tenantId ?? DEFAULT_TENANT_ID const data = useQuery( api.reports.slaOverview, convexUserId - ? ({ tenantId, viewerId: convexUserId as Id<"users">, companyId: companyId === "all" ? undefined : (companyId as Id<"companies">) }) + ? ({ tenantId, viewerId: convexUserId as Id<"users">, range: timeRange, companyId: companyId === "all" ? undefined : (companyId as Id<"companies">) }) : "skip" ) const companies = useQuery(api.companies.list, convexUserId ? { tenantId, viewerId: convexUserId as Id<"users"> } : "skip") as Array<{ id: Id<"companies">; name: string }> | undefined @@ -105,22 +107,37 @@ export function SlaReport() {
- - +
+ + + + 90 dias + 30 dias + 7 dias + + + +