From a191ec8bddf8e8be05e0e7f4622a35607c904118 Mon Sep 17 00:00:00 2001
From: Vinicius Garcia
Nenhum registro neste período.
) : ( diff --git a/src/app/(app)/relatorios/page.tsx b/src/app/(app)/relatorios/page.tsx index ef7495a..4107c7f 100644 --- a/src/app/(app)/relatorios/page.tsx +++ b/src/app/(app)/relatorios/page.tsx @@ -17,6 +17,7 @@ import { loadCatalog, reportRowToEntryView } from "../views"; import { DayMatrixCard } from "./day-matrix"; import { loadReport } from "./load-report"; import { ReportFilters } from "./report-filters"; +import { UnassignedNotice } from "./unassigned-notice"; export const metadata: Metadata = { title: "Relatórios" }; @@ -42,13 +43,6 @@ async function Reports({ searchParams }: Pick- {report.unassignedCount === 1 ? "1 registro sem projeto neste período não entra" : `${report.unassignedCount} registros sem projeto neste período não entram`}{" "} - no filtro de cliente.{" "} - - Ver registros sem projeto - -
- )} +Nenhum registro encontrado com esses filtros.
diff --git a/src/app/(app)/relatorios/unassigned-notice.tsx b/src/app/(app)/relatorios/unassigned-notice.tsx new file mode 100644 index 0000000..96a3b81 --- /dev/null +++ b/src/app/(app)/relatorios/unassigned-notice.tsx @@ -0,0 +1,23 @@ +import Link from "next/link"; +import type { ReportQuery } from "@/lib/schemas/report"; + +/** + * Entries without a project cannot match a client filter, so they drop out of the numbers. Say so, with a link + * that lists them (same period and people) in the report. `count` is 0 unless a client filter is hiding them. + */ +export function UnassignedNotice({ count, query }: { count: number; query: ReportQuery }) { + if (count <= 0) return null; + const params = new URLSearchParams({ periodo: query.periodo, projeto: "none" }); + if (query.de) params.set("de", query.de); + if (query.ate) params.set("ate", query.ate); + for (const id of query.pessoas) params.append("pessoas", id); + + return ( ++ {count === 1 ? "1 registro sem projeto neste período não entra" : `${count} registros sem projeto neste período não entram`} no filtro de cliente.{" "} + + Ver registros sem projeto + +
+ ); +}