fix: fixed typing in ProjectModal, removed unused DealStatus enum
This commit is contained in:
@@ -1,8 +1,7 @@
|
|||||||
import { useDealSummariesFull } from "./useDealSummaries.tsx";
|
import { useDealSummariesFull } from "./useDealSummaries.tsx";
|
||||||
import { useForm } from "@mantine/form";
|
import { useForm } from "@mantine/form";
|
||||||
import { useEffect, useState } from "react";
|
import { useEffect, useState } from "react";
|
||||||
import { BaseMarketplaceSchema, BoardSchema, ClientSchema, ProjectSchema } from "../../../client";
|
import { BaseMarketplaceSchema, BoardSchema, ClientSchema, ProjectSchema, StatusSchema } from "../../../client";
|
||||||
import { DealStatusType } from "../../../shared/enums/DealStatus.ts";
|
|
||||||
|
|
||||||
|
|
||||||
type Props = {
|
type Props = {
|
||||||
@@ -17,7 +16,7 @@ export type DealsPageState = {
|
|||||||
|
|
||||||
projectForTable: ProjectSchema | null;
|
projectForTable: ProjectSchema | null;
|
||||||
board: BoardSchema | null;
|
board: BoardSchema | null;
|
||||||
dealStatus: DealStatusType | null;
|
dealStatus: StatusSchema | null;
|
||||||
};
|
};
|
||||||
|
|
||||||
const useDealsPageState = ({ projects }: Props) => {
|
const useDealsPageState = ({ projects }: Props) => {
|
||||||
|
|||||||
@@ -1,9 +1,9 @@
|
|||||||
import { useEffect, useState } from "react";
|
import { useEffect, useState } from "react";
|
||||||
import { ProjectSchema, ProjectService } from "../../../client";
|
import { type ProjectSchemaWithCount, ProjectService } from "../../../client";
|
||||||
|
|
||||||
|
|
||||||
const useProjects = () => {
|
const useProjects = () => {
|
||||||
const [projects, setProjects] = useState<ProjectSchema[]>([]);
|
const [projects, setProjects] = useState<ProjectSchemaWithCount[]>([]);
|
||||||
|
|
||||||
const refetchProjects = () => {
|
const refetchProjects = () => {
|
||||||
ProjectService.getProjects()
|
ProjectService.getProjects()
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import { ProjectSchema } from "../../../../client";
|
import { type ProjectSchemaWithCount } from "../../../../client";
|
||||||
import { ContextModalProps } from "@mantine/modals";
|
import { ContextModalProps } from "@mantine/modals";
|
||||||
import { ActionIcon, Flex, rem, Stack, TextInput, Tooltip } from "@mantine/core";
|
import { ActionIcon, Flex, rem, Stack, TextInput, Tooltip } from "@mantine/core";
|
||||||
import { BaseTable } from "../../../../components/BaseTable/BaseTable.tsx";
|
import { BaseTable } from "../../../../components/BaseTable/BaseTable.tsx";
|
||||||
@@ -75,7 +75,7 @@ const ProjectsModal = ({ innerProps }: ContextModalProps<Props>) => {
|
|||||||
</Tooltip>
|
</Tooltip>
|
||||||
</Flex>
|
</Flex>
|
||||||
),
|
),
|
||||||
} as MRT_TableOptions<ProjectSchema>
|
} as MRT_TableOptions<ProjectSchemaWithCount>
|
||||||
}
|
}
|
||||||
/>
|
/>
|
||||||
</Stack>
|
</Stack>
|
||||||
|
|||||||
@@ -1,10 +0,0 @@
|
|||||||
import { BaseMarketplaceSchema, ClientSchema, UserSchema } from "../../../client";
|
|
||||||
import { DealStatusType } from "../../../shared/enums/DealStatus.ts";
|
|
||||||
|
|
||||||
export interface ChartFormFilters {
|
|
||||||
dateRange: [Date | null, Date | null];
|
|
||||||
client: ClientSchema | null;
|
|
||||||
marketplace: BaseMarketplaceSchema | null;
|
|
||||||
dealStatus: DealStatusType | null;
|
|
||||||
manager: UserSchema | null;
|
|
||||||
}
|
|
||||||
@@ -1,35 +0,0 @@
|
|||||||
export enum DealStatus {
|
|
||||||
CREATED = 0,
|
|
||||||
AWAITING_ACCEPTANCE = 1,
|
|
||||||
READY_FOR_WORK = 2,
|
|
||||||
PACKAGING = 3,
|
|
||||||
AWAITING_SHIPMENT = 4,
|
|
||||||
IN_DELIVERY = 5,
|
|
||||||
AWAITING_PAYMENT = 6,
|
|
||||||
COMPLETED = 7,
|
|
||||||
CANCELLED = 8,
|
|
||||||
}
|
|
||||||
|
|
||||||
export const getDealStatusByName = (name: string): DealStatus => {
|
|
||||||
return DealStatus[name as keyof typeof DealStatus];
|
|
||||||
};
|
|
||||||
export const DealStatusDictionary = {
|
|
||||||
[DealStatus.CREATED]: "Создан",
|
|
||||||
[DealStatus.AWAITING_ACCEPTANCE]: "Ожидает приемки",
|
|
||||||
[DealStatus.READY_FOR_WORK]: "Готов к работе",
|
|
||||||
[DealStatus.PACKAGING]: "Упаковка",
|
|
||||||
[DealStatus.AWAITING_SHIPMENT]: "Ожидает отгрузки",
|
|
||||||
[DealStatus.IN_DELIVERY]: "В доставке",
|
|
||||||
[DealStatus.AWAITING_PAYMENT]: "Ожидает оплаты",
|
|
||||||
[DealStatus.COMPLETED]: "Завершена",
|
|
||||||
[DealStatus.CANCELLED]: "Отменена",
|
|
||||||
};
|
|
||||||
export type DealStatusType = {
|
|
||||||
id: number;
|
|
||||||
name: string;
|
|
||||||
};
|
|
||||||
export const DealStatuses: DealStatusType[] = Object.entries(
|
|
||||||
DealStatusDictionary,
|
|
||||||
).map(([key, value]) => {
|
|
||||||
return { id: parseInt(key), name: value };
|
|
||||||
});
|
|
||||||
Reference in New Issue
Block a user