diff --git a/src/client/models/GetProfitTableDataRequest.ts b/src/client/models/GetProfitTableDataRequest.ts index 898bde3..cba7185 100644 --- a/src/client/models/GetProfitTableDataRequest.ts +++ b/src/client/models/GetProfitTableDataRequest.ts @@ -5,6 +5,9 @@ import type { ProfitTableGroupBy } from './ProfitTableGroupBy'; export type GetProfitTableDataRequest = { dateRange: any[]; + clientId: number; + baseMarketplaceKey: string; + dealStatusId: number; groupTableBy: ProfitTableGroupBy; }; diff --git a/src/pages/StatisticsPage/tabs/ProfitTab/components/ProfitTable/hooks/useProfitTable.tsx b/src/pages/StatisticsPage/tabs/ProfitTab/components/ProfitTable/hooks/useProfitTable.tsx index 3717aeb..da2dc6c 100644 --- a/src/pages/StatisticsPage/tabs/ProfitTab/components/ProfitTable/hooks/useProfitTable.tsx +++ b/src/pages/StatisticsPage/tabs/ProfitTab/components/ProfitTable/hooks/useProfitTable.tsx @@ -13,6 +13,9 @@ export const useProfitTable = () => { initialValues: { dateRange: getDefaultDates(), groupTableBy: GroupStatisticsTable.BY_DATES, + client: null, + marketplace: null, + dealStatus: null, }, }); const [isLoading, setIsLoading] = useState(false); @@ -33,6 +36,9 @@ export const useProfitTable = () => { dateToString(dateRange[1]), ], groupTableBy: form.values.groupTableBy, + clientId: form.values.client?.id ?? -1, + baseMarketplaceKey: form.values.marketplace?.key ?? "all", + dealStatusId: form.values.dealStatus?.id ?? -1, }; }; diff --git a/src/pages/StatisticsPage/tabs/ProfitTab/modals/ProfitTableFiltersModal.tsx b/src/pages/StatisticsPage/tabs/ProfitTab/modals/ProfitTableFiltersModal.tsx index b95d3ee..a78e2a1 100644 --- a/src/pages/StatisticsPage/tabs/ProfitTab/modals/ProfitTableFiltersModal.tsx +++ b/src/pages/StatisticsPage/tabs/ProfitTab/modals/ProfitTableFiltersModal.tsx @@ -36,6 +36,12 @@ export const ProfitTableFiltersModal = ({ form }: Props) => { value: form.values.groupTableBy.toString(), onChange: (value: string) => form.setFieldValue("groupTableBy", parseInt(value)), }} + clientSelectProps={form.getInputProps("client")} + onClientClear={() => form.setFieldValue("client", null)} + baseMarketplaceSelectProps={form.getInputProps("marketplace")} + onBaseMarketplaceClear={() => form.setFieldValue("marketplace", null)} + dealStatusSelectProps={form.getInputProps("dealStatus")} + onDealStatusClear={() => form.setFieldValue("dealStatus", null)} /> diff --git a/src/pages/StatisticsPage/types/TableFormFilters.ts b/src/pages/StatisticsPage/types/TableFormFilters.ts index 689493e..f70becd 100644 --- a/src/pages/StatisticsPage/types/TableFormFilters.ts +++ b/src/pages/StatisticsPage/types/TableFormFilters.ts @@ -1,6 +1,13 @@ -import { GroupStatisticsTable } from "../tabs/ProfitTab/components/ProfitTableSegmentedControl/ProfitTableSegmentedControl.tsx"; +import { + GroupStatisticsTable, +} from "../tabs/ProfitTab/components/ProfitTableSegmentedControl/ProfitTableSegmentedControl.tsx"; +import { BaseMarketplaceSchema, ClientSchema } from "../../../client"; +import { DealStatusType } from "../../../shared/enums/DealStatus.ts"; export interface TableFormFilters { dateRange: [Date | null, Date | null]; groupTableBy: GroupStatisticsTable; + client: ClientSchema | null; + marketplace: BaseMarketplaceSchema | null; + dealStatus: DealStatusType | null; } \ No newline at end of file