fix: fixed price in productServiceEditorModal
This commit is contained in:
@ -18,12 +18,17 @@ const ProductServicesTable: FC<Props> = ({
|
|||||||
onDuplicateServices,
|
onDuplicateServices,
|
||||||
onKitAdd,
|
onKitAdd,
|
||||||
}) => {
|
}) => {
|
||||||
const { productServiceCrud } = useFulfillmentBaseContext();
|
const { productServiceCrud, dealProductsList } =
|
||||||
|
useFulfillmentBaseContext();
|
||||||
|
|
||||||
const onChange = (item: ProductServiceSchema) => {
|
const onChange = (item: ProductServiceSchema) => {
|
||||||
const excludeServiceIds = dealProduct.productServices.map(
|
const excludeServiceIds = dealProduct.productServices.map(
|
||||||
productService => productService.service.id
|
productService => productService.service.id
|
||||||
);
|
);
|
||||||
|
const totalQuantity = dealProductsList.dealProducts.reduce(
|
||||||
|
(sum, prod) => prod.quantity + sum,
|
||||||
|
0
|
||||||
|
);
|
||||||
|
|
||||||
modals.openContextModal({
|
modals.openContextModal({
|
||||||
modal: "productServiceEditorModal",
|
modal: "productServiceEditorModal",
|
||||||
@ -37,7 +42,7 @@ const ProductServicesTable: FC<Props> = ({
|
|||||||
values
|
values
|
||||||
),
|
),
|
||||||
excludeServiceIds,
|
excludeServiceIds,
|
||||||
quantity: dealProduct.quantity,
|
quantity: totalQuantity,
|
||||||
isEditing: true,
|
isEditing: true,
|
||||||
},
|
},
|
||||||
withCloseButton: false,
|
withCloseButton: false,
|
||||||
|
|||||||
@ -65,7 +65,7 @@ const useProductServicesTableColumns = ({
|
|||||||
{
|
{
|
||||||
accessor: "price",
|
accessor: "price",
|
||||||
title: "Цена",
|
title: "Цена",
|
||||||
footer: (
|
footer: data.length > 0 && (
|
||||||
<Box h={"100%"}>
|
<Box h={"100%"}>
|
||||||
<Text fw={700}>
|
<Text fw={700}>
|
||||||
Итог: {totalPrice.toLocaleString("ru")}₽
|
Итог: {totalPrice.toLocaleString("ru")}₽
|
||||||
|
|||||||
Reference in New Issue
Block a user