feat: deal group and stuff
This commit is contained in:
		@@ -1,8 +1,5 @@
 | 
				
			|||||||
import { useParams } from "@tanstack/react-router";
 | 
					import { useParams } from "@tanstack/react-router";
 | 
				
			||||||
import {
 | 
					import { DealPageContextProvider, useDealPageContext } from "../../LeadsPage/contexts/DealPageContext.tsx";
 | 
				
			||||||
    DealPageContextProvider,
 | 
					 | 
				
			||||||
    useDealPageContext,
 | 
					 | 
				
			||||||
} from "../../LeadsPage/contexts/DealPageContext.tsx";
 | 
					 | 
				
			||||||
import ProductAndServiceTab from "../../LeadsPage/tabs/ProductAndServiceTab/ProductAndServiceTab.tsx";
 | 
					import ProductAndServiceTab from "../../LeadsPage/tabs/ProductAndServiceTab/ProductAndServiceTab.tsx";
 | 
				
			||||||
import { FC, useEffect } from "react";
 | 
					import { FC, useEffect } from "react";
 | 
				
			||||||
import { DealService } from "../../../client";
 | 
					import { DealService } from "../../../client";
 | 
				
			||||||
@@ -20,7 +17,8 @@ const DealPageContent: FC<Props> = ({ dealId }) => {
 | 
				
			|||||||
    return <ProductAndServiceTab />;
 | 
					    return <ProductAndServiceTab />;
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
const DealPageWrapper: FC<{ children: React.ReactNode }> = ({ children }) => {
 | 
					const DealPageWrapper: FC<{ children: React.ReactNode }> = ({ children }) => {
 | 
				
			||||||
    return <DealPageContextProvider>{children}</DealPageContextProvider>;
 | 
					    return <DealPageContextProvider refetchDeals={async () => {
 | 
				
			||||||
 | 
					    }}>{children}</DealPageContextProvider>;
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
export const DealPage = () => {
 | 
					export const DealPage = () => {
 | 
				
			||||||
    const { dealId } = useParams({ strict: false });
 | 
					    const { dealId } = useParams({ strict: false });
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -44,12 +44,12 @@ const useDealsTableColumns = () => {
 | 
				
			|||||||
            },
 | 
					            },
 | 
				
			||||||
            {
 | 
					            {
 | 
				
			||||||
                Cell: ({ row }) =>
 | 
					                Cell: ({ row }) =>
 | 
				
			||||||
                    new Date(row.original.deadline).toLocaleString("ru-RU"),
 | 
					                    new Date(row.original.deadline || 0).toLocaleString("ru-RU"),
 | 
				
			||||||
                accessorKey: "deadline",
 | 
					                accessorKey: "deadline",
 | 
				
			||||||
                header: "Дедлайн",
 | 
					                header: "Дедлайн",
 | 
				
			||||||
                sortingFn: (rowA, rowB) =>
 | 
					                sortingFn: (rowA, rowB) =>
 | 
				
			||||||
                    new Date(rowB.original.deadline).getTime() -
 | 
					                    new Date(rowB.original.deadline || 0).getTime() -
 | 
				
			||||||
                    new Date(rowA.original.deadline).getTime(),
 | 
					                    new Date(rowA.original.deadline || 0).getTime(),
 | 
				
			||||||
            },
 | 
					            },
 | 
				
			||||||
            {
 | 
					            {
 | 
				
			||||||
                header: "Общая стоимость",
 | 
					                header: "Общая стоимость",
 | 
				
			||||||
@@ -58,7 +58,7 @@ const useDealsTableColumns = () => {
 | 
				
			|||||||
                accessorKey: "totalPrice",
 | 
					                accessorKey: "totalPrice",
 | 
				
			||||||
            },
 | 
					            },
 | 
				
			||||||
        ],
 | 
					        ],
 | 
				
			||||||
        []
 | 
					        [],
 | 
				
			||||||
    );
 | 
					    );
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -13,7 +13,9 @@ export const DealsPage: FC = () => {
 | 
				
			|||||||
    const { data, form } = useDealsPageState();
 | 
					    const { data, form } = useDealsPageState();
 | 
				
			||||||
    return (
 | 
					    return (
 | 
				
			||||||
        <>
 | 
					        <>
 | 
				
			||||||
            <DealPageContextProvider>
 | 
					            <DealPageContextProvider refetchDeals={async () => {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					            }}>
 | 
				
			||||||
                <div className={styles["container"]}>
 | 
					                <div className={styles["container"]}>
 | 
				
			||||||
                    <PageBlock>
 | 
					                    <PageBlock>
 | 
				
			||||||
                        <div className={styles["top-panel"]}>
 | 
					                        <div className={styles["top-panel"]}>
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,6 +1,4 @@
 | 
				
			|||||||
import BaseFormModal, {
 | 
					import BaseFormModal, { CreateEditFormProps } from "../../ClientsPage/modals/BaseFormModal/BaseFormModal.tsx";
 | 
				
			||||||
    CreateEditFormProps,
 | 
					 | 
				
			||||||
} from "../../ClientsPage/modals/BaseFormModal/BaseFormModal.tsx";
 | 
					 | 
				
			||||||
import { DealSummary, ShippingWarehouseSchema } from "../../../client";
 | 
					import { DealSummary, ShippingWarehouseSchema } from "../../../client";
 | 
				
			||||||
import { ContextModalProps } from "@mantine/modals";
 | 
					import { ContextModalProps } from "@mantine/modals";
 | 
				
			||||||
import { useForm } from "@mantine/form";
 | 
					import { useForm } from "@mantine/form";
 | 
				
			||||||
@@ -29,7 +27,9 @@ const ShippingWarehouseForm = ({
 | 
				
			|||||||
            },
 | 
					            },
 | 
				
			||||||
    });
 | 
					    });
 | 
				
			||||||
    return (
 | 
					    return (
 | 
				
			||||||
        <DealPageContextProvider>
 | 
					        <DealPageContextProvider refetchDeals={async () => {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        }}>
 | 
				
			||||||
            <BaseFormModal
 | 
					            <BaseFormModal
 | 
				
			||||||
                {...innerProps}
 | 
					                {...innerProps}
 | 
				
			||||||
                closeOnSubmit
 | 
					                closeOnSubmit
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user