From 2007ecd2f2381aa3d4f6abd59c830ce171176344 Mon Sep 17 00:00:00 2001 From: AlexSserb Date: Sun, 24 Nov 2024 00:07:52 +0400 Subject: [PATCH] feat: default deal status in statistics --- .../components/ProfitChart/hooks/useProfitChart.tsx | 3 ++- .../components/ProfitTable/hooks/useProfitTable.tsx | 3 ++- src/pages/StatisticsPage/utils/defaultFilterValues.ts | 6 ++++++ 3 files changed, 10 insertions(+), 2 deletions(-) create mode 100644 src/pages/StatisticsPage/utils/defaultFilterValues.ts diff --git a/src/pages/StatisticsPage/tabs/ProfitTab/components/ProfitChart/hooks/useProfitChart.tsx b/src/pages/StatisticsPage/tabs/ProfitTab/components/ProfitChart/hooks/useProfitChart.tsx index d3c090a..aca6dd2 100644 --- a/src/pages/StatisticsPage/tabs/ProfitTab/components/ProfitChart/hooks/useProfitChart.tsx +++ b/src/pages/StatisticsPage/tabs/ProfitTab/components/ProfitChart/hooks/useProfitChart.tsx @@ -3,6 +3,7 @@ import { useForm } from "@mantine/form"; import { dateToString, getDefaultDates } from "../../../../../utils/dates.ts"; import { useEffect, useState } from "react"; import { ProfitChartDataItem, StatisticsService } from "../../../../../../../client"; +import { defaultDealStatus } from "../../../../../utils/defaultFilterValues.ts"; export const useProfitChart = () => { @@ -12,7 +13,7 @@ export const useProfitChart = () => { dateRange: getDefaultDates(), client: null, marketplace: null, - dealStatus: null, + dealStatus: defaultDealStatus, manager: null, }, }); 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 8d5cc8f..8577113 100644 --- a/src/pages/StatisticsPage/tabs/ProfitTab/components/ProfitTable/hooks/useProfitTable.tsx +++ b/src/pages/StatisticsPage/tabs/ProfitTab/components/ProfitTable/hooks/useProfitTable.tsx @@ -5,6 +5,7 @@ import { GroupStatisticsTable } from "../../ProfitTableSegmentedControl/ProfitTa import { useEffect, useState } from "react"; import { ProfitTableDataItem, StatisticsService } from "../../../../../../../client"; import { useProfitMantineTable } from "./useProfitMantineTable.tsx"; +import { defaultDealStatus } from "../../../../../utils/defaultFilterValues.ts"; export const useProfitTable = () => { @@ -15,7 +16,7 @@ export const useProfitTable = () => { groupTableBy: GroupStatisticsTable.BY_DATES, client: null, marketplace: null, - dealStatus: null, + dealStatus: defaultDealStatus, manager: null, }, }); diff --git a/src/pages/StatisticsPage/utils/defaultFilterValues.ts b/src/pages/StatisticsPage/utils/defaultFilterValues.ts new file mode 100644 index 0000000..5d22b4d --- /dev/null +++ b/src/pages/StatisticsPage/utils/defaultFilterValues.ts @@ -0,0 +1,6 @@ +import { DealStatus, DealStatusDictionary } from "../../../shared/enums/DealStatus.ts"; + +export const defaultDealStatus = { + id: DealStatus.COMPLETED, + name: DealStatusDictionary[DealStatus.COMPLETED], +}; \ No newline at end of file