diff --git a/src/client/models/GetProfitChartDataRequest.ts b/src/client/models/GetProfitChartDataRequest.ts index 0d586c4..765301c 100644 --- a/src/client/models/GetProfitChartDataRequest.ts +++ b/src/client/models/GetProfitChartDataRequest.ts @@ -7,5 +7,6 @@ export type GetProfitChartDataRequest = { clientId: number; baseMarketplaceKey: string; dealStatusId: number; + managerId: number; }; diff --git a/src/client/models/GetProfitTableDataRequest.ts b/src/client/models/GetProfitTableDataRequest.ts index cba7185..f5dd66b 100644 --- a/src/client/models/GetProfitTableDataRequest.ts +++ b/src/client/models/GetProfitTableDataRequest.ts @@ -8,6 +8,7 @@ export type GetProfitTableDataRequest = { clientId: number; baseMarketplaceKey: string; dealStatusId: number; + managerId: number; groupTableBy: ProfitTableGroupBy; }; diff --git a/src/client/models/ProfitTableGroupBy.ts b/src/client/models/ProfitTableGroupBy.ts index c9a9c1d..f56c4c7 100644 --- a/src/client/models/ProfitTableGroupBy.ts +++ b/src/client/models/ProfitTableGroupBy.ts @@ -2,4 +2,4 @@ /* istanbul ignore file */ /* tslint:disable */ /* eslint-disable */ -export type ProfitTableGroupBy = 0 | 1 | 2 | 3 | 4; +export type ProfitTableGroupBy = 0 | 1 | 2 | 3 | 4 | 5; diff --git a/src/pages/StatisticsPage/tabs/ProfitTab/components/Filters/Filters.tsx b/src/pages/StatisticsPage/tabs/ProfitTab/components/Filters/Filters.tsx index c7b4e35..0f346d5 100644 --- a/src/pages/StatisticsPage/tabs/ProfitTab/components/Filters/Filters.tsx +++ b/src/pages/StatisticsPage/tabs/ProfitTab/components/Filters/Filters.tsx @@ -1,13 +1,14 @@ import { DatePickerInput, DatePickerInputProps } from "@mantine/dates"; import { Stack, Text } from "@mantine/core"; import ClientSelectNew from "../../../../../../components/Selects/ClientSelectNew/ClientSelectNew.tsx"; -import { BaseMarketplaceSchema, ClientSchema } from "../../../../../../client"; +import { BaseMarketplaceSchema, ClientSchema, UserSchema } from "../../../../../../client"; import { ObjectSelectProps } from "../../../../../../components/ObjectSelect/ObjectSelect.tsx"; import BaseMarketplaceSelect from "../../../../../../components/Selects/BaseMarketplaceSelect/BaseMarketplaceSelect.tsx"; import DealStatusSelect from "../../../../../DealsPage/components/DealStatusSelect/DealStatusSelect.tsx"; import { DealStatusType } from "../../../../../../shared/enums/DealStatus.ts"; import { ProfitTableSegmentedControl } from "../ProfitTableSegmentedControl/ProfitTableSegmentedControl.tsx"; +import ManagerSelect from "../../../../../../components/ManagerSelect/ManagerSelect.tsx"; type FiltersProps = { @@ -25,6 +26,12 @@ type FiltersProps = { dealStatusSelectProps?: Omit, "data">; onDealStatusClear?: () => void; + managerSelectProps?: Omit< + ObjectSelectProps, + "data" | "getValueFn" | "getLabelFn" + >; + onManagerClear?: () => void; + groupTableByProps?: { value: string, onChange: (value: string) => void, @@ -40,6 +47,8 @@ export const Filters = (props: FiltersProps) => { onBaseMarketplaceClear, dealStatusSelectProps, onDealStatusClear, + managerSelectProps, + onManagerClear, groupTableByProps, } = props; @@ -78,6 +87,13 @@ export const Filters = (props: FiltersProps) => { placeholder={"Выберите маркетплейс"} /> } + {managerSelectProps && + + } {groupTableByProps && <> Группировать: 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 00a41cf..d3c090a 100644 --- a/src/pages/StatisticsPage/tabs/ProfitTab/components/ProfitChart/hooks/useProfitChart.tsx +++ b/src/pages/StatisticsPage/tabs/ProfitTab/components/ProfitChart/hooks/useProfitChart.tsx @@ -13,6 +13,7 @@ export const useProfitChart = () => { client: null, marketplace: null, dealStatus: null, + manager: null, }, }); const [profitData, setProfitData] = useState([]); @@ -29,6 +30,7 @@ export const useProfitChart = () => { clientId: form.values.client?.id ?? -1, baseMarketplaceKey: form.values.marketplace?.key ?? "all", dealStatusId: form.values.dealStatus?.id ?? -1, + managerId: form.values.manager?.id ?? -1, }; }; diff --git a/src/pages/StatisticsPage/tabs/ProfitTab/components/ProfitTable/hooks/columns.tsx b/src/pages/StatisticsPage/tabs/ProfitTab/components/ProfitTable/hooks/columns.tsx index 408fce1..b223e9e 100644 --- a/src/pages/StatisticsPage/tabs/ProfitTab/components/ProfitTable/hooks/columns.tsx +++ b/src/pages/StatisticsPage/tabs/ProfitTab/components/ProfitTable/hooks/columns.tsx @@ -15,6 +15,7 @@ export const useProfitTableColumns = ({ groupTableBy }: Props) => { [GroupStatisticsTable.BY_STATUSES]: "Статус", [GroupStatisticsTable.BY_MARKETPLACES]: "Маркетплейс", [GroupStatisticsTable.BY_WAREHOUSES]: "Склад отгрузки", + [GroupStatisticsTable.BY_MANAGERS]: "Менеджер", }; return useMemo[]>( 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 da2dc6c..8d5cc8f 100644 --- a/src/pages/StatisticsPage/tabs/ProfitTab/components/ProfitTable/hooks/useProfitTable.tsx +++ b/src/pages/StatisticsPage/tabs/ProfitTab/components/ProfitTable/hooks/useProfitTable.tsx @@ -16,6 +16,7 @@ export const useProfitTable = () => { client: null, marketplace: null, dealStatus: null, + manager: null, }, }); const [isLoading, setIsLoading] = useState(false); @@ -39,6 +40,7 @@ export const useProfitTable = () => { clientId: form.values.client?.id ?? -1, baseMarketplaceKey: form.values.marketplace?.key ?? "all", dealStatusId: form.values.dealStatus?.id ?? -1, + managerId: form.values.manager?.id ?? -1, }; }; diff --git a/src/pages/StatisticsPage/tabs/ProfitTab/components/ProfitTableSegmentedControl/ProfitTableSegmentedControl.tsx b/src/pages/StatisticsPage/tabs/ProfitTab/components/ProfitTableSegmentedControl/ProfitTableSegmentedControl.tsx index 5f1aee1..bac01f4 100644 --- a/src/pages/StatisticsPage/tabs/ProfitTab/components/ProfitTableSegmentedControl/ProfitTableSegmentedControl.tsx +++ b/src/pages/StatisticsPage/tabs/ProfitTab/components/ProfitTableSegmentedControl/ProfitTableSegmentedControl.tsx @@ -7,6 +7,7 @@ export enum GroupStatisticsTable { BY_STATUSES, BY_WAREHOUSES, BY_MARKETPLACES, + BY_MANAGERS, } type Props = Omit; @@ -31,6 +32,10 @@ const data = [ label: "По маркетплейсам", value: GroupStatisticsTable.BY_MARKETPLACES.toString(), }, + { + label: "По менеджерам", + value: GroupStatisticsTable.BY_MANAGERS.toString(), + }, ]; export const ProfitTableSegmentedControl: FC = props => { diff --git a/src/pages/StatisticsPage/tabs/ProfitTab/modals/ProfitChartFiltersModal.tsx b/src/pages/StatisticsPage/tabs/ProfitTab/modals/ProfitChartFiltersModal.tsx index 3e7ce40..46983c0 100644 --- a/src/pages/StatisticsPage/tabs/ProfitTab/modals/ProfitChartFiltersModal.tsx +++ b/src/pages/StatisticsPage/tabs/ProfitTab/modals/ProfitChartFiltersModal.tsx @@ -38,6 +38,8 @@ export const ProfitChartFiltersModal = ({ form }: Props) => { onBaseMarketplaceClear={() => form.setFieldValue("marketplace", null)} dealStatusSelectProps={form.getInputProps("dealStatus")} onDealStatusClear={() => form.setFieldValue("dealStatus", null)} + managerSelectProps={form.getInputProps("manager")} + onManagerClear={() => form.setFieldValue("manager", null)} /> diff --git a/src/pages/StatisticsPage/tabs/ProfitTab/modals/ProfitTableFiltersModal.tsx b/src/pages/StatisticsPage/tabs/ProfitTab/modals/ProfitTableFiltersModal.tsx index a78e2a1..89532b8 100644 --- a/src/pages/StatisticsPage/tabs/ProfitTab/modals/ProfitTableFiltersModal.tsx +++ b/src/pages/StatisticsPage/tabs/ProfitTab/modals/ProfitTableFiltersModal.tsx @@ -42,6 +42,8 @@ export const ProfitTableFiltersModal = ({ form }: Props) => { onBaseMarketplaceClear={() => form.setFieldValue("marketplace", null)} dealStatusSelectProps={form.getInputProps("dealStatus")} onDealStatusClear={() => form.setFieldValue("dealStatus", null)} + managerSelectProps={form.getInputProps("manager")} + onManagerClear={() => form.setFieldValue("manager", null)} /> diff --git a/src/pages/StatisticsPage/types/ChartFormFilters.ts b/src/pages/StatisticsPage/types/ChartFormFilters.ts index 3815461..515993f 100644 --- a/src/pages/StatisticsPage/types/ChartFormFilters.ts +++ b/src/pages/StatisticsPage/types/ChartFormFilters.ts @@ -1,4 +1,4 @@ -import { BaseMarketplaceSchema, ClientSchema } from "../../../client"; +import { BaseMarketplaceSchema, ClientSchema, UserSchema } from "../../../client"; import { DealStatusType } from "../../../shared/enums/DealStatus.ts"; export interface ChartFormFilters { @@ -6,4 +6,5 @@ export interface ChartFormFilters { client: ClientSchema | null; marketplace: BaseMarketplaceSchema | null; dealStatus: DealStatusType | null; + manager: UserSchema | null; } \ No newline at end of file diff --git a/src/pages/StatisticsPage/types/TableFormFilters.ts b/src/pages/StatisticsPage/types/TableFormFilters.ts index f70becd..9cd4553 100644 --- a/src/pages/StatisticsPage/types/TableFormFilters.ts +++ b/src/pages/StatisticsPage/types/TableFormFilters.ts @@ -1,7 +1,7 @@ import { GroupStatisticsTable, } from "../tabs/ProfitTab/components/ProfitTableSegmentedControl/ProfitTableSegmentedControl.tsx"; -import { BaseMarketplaceSchema, ClientSchema } from "../../../client"; +import { BaseMarketplaceSchema, ClientSchema, UserSchema } from "../../../client"; import { DealStatusType } from "../../../shared/enums/DealStatus.ts"; export interface TableFormFilters { @@ -10,4 +10,5 @@ export interface TableFormFilters { client: ClientSchema | null; marketplace: BaseMarketplaceSchema | null; dealStatus: DealStatusType | null; + manager: UserSchema | null; } \ No newline at end of file