diff --git a/apps/edr-freight-web/backoffice/src/components/reports/ReportFilters.tsx b/apps/edr-freight-web/backoffice/src/components/reports/ReportFilters.tsx deleted file mode 100644 index e44e97ec8..000000000 --- a/apps/edr-freight-web/backoffice/src/components/reports/ReportFilters.tsx +++ /dev/null @@ -1,110 +0,0 @@ -import { Group, MultiSelect, Select, TextInput } from "@mantine/core"; -import { DateInput, DatePickerInput } from "@mantine/dates"; -import { Search } from "lucide-react"; - -import { getDateRangePresets } from "@/components/common/dateRangePresets"; -import type { ReportFilterDef } from "@/types/reports"; - -export interface ReportFilterValues { - [param: string]: string | undefined; -} - -interface ReportFiltersProps { - filters: ReportFilterDef[]; - values: ReportFilterValues; - onChange: (values: ReportFilterValues) => void; -} - -const toDate = (value: string | undefined): Date | null => (value ? new Date(value) : null); -const fromDate = (value: string | null): string | undefined => value ?? undefined; - -/** Renders one widget per report-declared filter and reports raw param values back up. */ -export function ReportFilters({ filters, values, onChange }: ReportFiltersProps) { - if (!filters.length) return null; - - const set = (patch: ReportFilterValues) => onChange({ ...values, ...patch }); - - return ( - - {filters.map((filter) => { - switch (filter.type) { - case "daterange": - return ( - - set({ [`${filter.key}From`]: fromDate(from), [`${filter.key}To`]: fromDate(to) }) - } - presets={getDateRangePresets()} - radius="md" - size="sm" - clearable - w={230} - /> - ); - case "date": - return ( - set({ [filter.key]: fromDate(d) })} - radius="md" - size="sm" - clearable - w={150} - /> - ); - case "select": - return ( -