diff --git a/src/modules/dealModules/dealEditorTabs/FulfillmentBaseTab/components/ProductView/components/ProductServicesTable.tsx b/src/modules/dealModules/dealEditorTabs/FulfillmentBaseTab/components/ProductView/components/ProductServicesTable.tsx index 7d53bd8..2ee801c 100644 --- a/src/modules/dealModules/dealEditorTabs/FulfillmentBaseTab/components/ProductView/components/ProductServicesTable.tsx +++ b/src/modules/dealModules/dealEditorTabs/FulfillmentBaseTab/components/ProductView/components/ProductServicesTable.tsx @@ -18,12 +18,17 @@ const ProductServicesTable: FC = ({ onDuplicateServices, onKitAdd, }) => { - const { productServiceCrud } = useFulfillmentBaseContext(); + const { productServiceCrud, dealProductsList } = + useFulfillmentBaseContext(); const onChange = (item: ProductServiceSchema) => { const excludeServiceIds = dealProduct.productServices.map( productService => productService.service.id ); + const totalQuantity = dealProductsList.dealProducts.reduce( + (sum, prod) => prod.quantity + sum, + 0 + ); modals.openContextModal({ modal: "productServiceEditorModal", @@ -37,7 +42,7 @@ const ProductServicesTable: FC = ({ values ), excludeServiceIds, - quantity: dealProduct.quantity, + quantity: totalQuantity, isEditing: true, }, withCloseButton: false, diff --git a/src/modules/dealModules/dealEditorTabs/FulfillmentBaseTab/components/ProductView/hooks/useProductServicesTableColumns.tsx b/src/modules/dealModules/dealEditorTabs/FulfillmentBaseTab/components/ProductView/hooks/useProductServicesTableColumns.tsx index f2b320d..fe0d873 100644 --- a/src/modules/dealModules/dealEditorTabs/FulfillmentBaseTab/components/ProductView/hooks/useProductServicesTableColumns.tsx +++ b/src/modules/dealModules/dealEditorTabs/FulfillmentBaseTab/components/ProductView/hooks/useProductServicesTableColumns.tsx @@ -65,7 +65,7 @@ const useProductServicesTableColumns = ({ { accessor: "price", title: "Цена", - footer: ( + footer: data.length > 0 && ( Итог: {totalPrice.toLocaleString("ru")}₽