diff --git a/src/modules/dealModularEditorTabs/FulfillmentBase/desktop/components/DealInfoView/components/ProductsActions/ProductsActions.tsx b/src/modules/dealModularEditorTabs/FulfillmentBase/desktop/components/DealInfoView/components/ProductsActions/ProductsActions.tsx index 9dd25eb..07a69ca 100644 --- a/src/modules/dealModularEditorTabs/FulfillmentBase/desktop/components/DealInfoView/components/ProductsActions/ProductsActions.tsx +++ b/src/modules/dealModularEditorTabs/FulfillmentBase/desktop/components/DealInfoView/components/ProductsActions/ProductsActions.tsx @@ -1,14 +1,19 @@ import { FC } from "react"; import { Button, Flex } from "@mantine/core"; import { modals } from "@mantine/modals"; -import { useFulfillmentBaseContext } from "@/modules/dealModularEditorTabs/FulfillmentBase/shared/contexts/FulfillmentBaseContext"; import { notifications } from "@/lib/notifications"; +import { useFulfillmentBaseContext } from "@/modules/dealModularEditorTabs/FulfillmentBase/shared/contexts/FulfillmentBaseContext"; const ProductsActions: FC = () => { const { deal, dealProductsList, productsCrud, dealProductsCrud } = useFulfillmentBaseContext(); const onCreateProductClick = () => { + if (!deal.client) { + notifications.error({ message: "Выберите клиента для сделки" }); + return; + } + modals.openContextModal({ modal: "productEditorModal", title: "Создание товара", @@ -16,6 +21,7 @@ const ProductsActions: FC = () => { innerProps: { onCreate: productsCrud.onCreate, isEditing: false, + clientId: deal.client.id, }, }); }; diff --git a/src/modules/dealModularEditorTabs/FulfillmentBase/desktop/components/ProductView/components/ProductViewActions.tsx b/src/modules/dealModularEditorTabs/FulfillmentBase/desktop/components/ProductView/components/ProductViewActions.tsx index a35c97e..23967bf 100644 --- a/src/modules/dealModularEditorTabs/FulfillmentBase/desktop/components/ProductView/components/ProductViewActions.tsx +++ b/src/modules/dealModularEditorTabs/FulfillmentBase/desktop/components/ProductView/components/ProductViewActions.tsx @@ -28,6 +28,7 @@ const ProductViewActions: FC = ({ dealProduct }) => { ), entity: dealProduct.product, isEditing: true, + clientId: dealProduct.product.clientId, }, }); };