feat: deal group and stuff

This commit is contained in:
2024-11-09 08:50:13 +03:00
parent 1ee8135508
commit 33dd65c497
2 changed files with 29 additions and 10 deletions

View File

@@ -8,5 +8,6 @@ export type DealProductSchema = {
product: ProductSchema; product: ProductSchema;
services: Array<DealProductServiceSchema>; services: Array<DealProductServiceSchema>;
quantity: number; quantity: number;
comment?: string;
}; };

View File

@@ -6,7 +6,7 @@ import {
ProductSchema, ProductSchema,
} from "../../../../../../client"; } from "../../../../../../client";
import styles from "./ProductView.module.css"; import styles from "./ProductView.module.css";
import { ActionIcon, Box, Flex, Image, NumberInput, rem, Text, Title, Tooltip } from "@mantine/core"; import { ActionIcon, Box, Flex, Image, NumberInput, rem, Text, Textarea, Title, Tooltip } from "@mantine/core";
import ProductServicesTable from "../ProductServicesTable/ProductServicesTable.tsx"; import ProductServicesTable from "../ProductServicesTable/ProductServicesTable.tsx";
import { isNil, isNumber } from "lodash"; import { isNil, isNumber } from "lodash";
import { IconBarcode, IconEdit, IconTrash } from "@tabler/icons-react"; import { IconBarcode, IconEdit, IconTrash } from "@tabler/icons-react";
@@ -58,7 +58,7 @@ const ProductView: FC<Props> = ({
onChange({ onChange({
...product, ...product,
services: product.services.filter( services: product.services.filter(
service => service.service.id !== item.service.id service => service.service.id !== item.service.id,
), ),
}); });
}; };
@@ -75,7 +75,7 @@ const ProductView: FC<Props> = ({
onChange({ onChange({
...product, ...product,
services: product.services.map(service => services: product.services.map(service =>
service.service.id === item.service.id ? item : service service.service.id === item.service.id ? item : service,
), ),
}); });
}; };
@@ -162,6 +162,24 @@ const ProductView: FC<Props> = ({
} }
placeholder={"Введите количество товара"} placeholder={"Введите количество товара"}
/> />
<Textarea
mih={rem(140)}
styles={{
wrapper: { height: "90%" },
input: { height: "90%" },
}}
my={rem(10)}
disabled={isLocked}
defaultValue={product.comment}
onChange={event => {
if (!onChange) return;
debouncedOnChange({
...product,
comment: event.currentTarget.value,
});
}}
placeholder={"Введите комментарий для товара"}
/>
</div> </div>
<div className={styles["services-container"]}> <div className={styles["services-container"]}>