diff --git a/src/client/models/ProductSchema.ts b/src/client/models/ProductSchema.ts index 8888d73..bf70c75 100644 --- a/src/client/models/ProductSchema.ts +++ b/src/client/models/ProductSchema.ts @@ -10,5 +10,8 @@ export type ProductSchema = { clientId: number; barcodes: Array; barcodeTemplate?: (BarcodeTemplateSchema | null); + brand?: (string | null); + color?: (string | null); + composition?: (string | null); }; diff --git a/src/pages/ProductsPage/components/ProductsTable/columns.tsx b/src/pages/ProductsPage/components/ProductsTable/columns.tsx index 1011fc4..3762ca9 100644 --- a/src/pages/ProductsPage/components/ProductsTable/columns.tsx +++ b/src/pages/ProductsPage/components/ProductsTable/columns.tsx @@ -41,6 +41,21 @@ export const useProductsTableColumns = () => { accessorKey: "barcodeTemplate.name", header: "Шаблон штрихкода", enableSorting: false, + }, + { + accessorKey: "brand", + header: "Бренд", + enableSorting: false + }, + { + accessorKey: "composition", + header: "Состав", + enableSorting: false, + }, + { + accessorKey: "color", + header: "Цвет", + enableSorting: false } ], []); diff --git a/src/pages/ProductsPage/modals/CreateProductModal/CreateProductModal.tsx b/src/pages/ProductsPage/modals/CreateProductModal/CreateProductModal.tsx index 8838315..36452cb 100644 --- a/src/pages/ProductsPage/modals/CreateProductModal/CreateProductModal.tsx +++ b/src/pages/ProductsPage/modals/CreateProductModal/CreateProductModal.tsx @@ -1,5 +1,5 @@ import {ContextModalProps} from "@mantine/modals"; -import {Button, Flex, rem, TagsInput, TextInput} from "@mantine/core"; +import {Button, Fieldset, Flex, rem, TagsInput, TextInput} from "@mantine/core"; import {useForm} from "@mantine/form"; import {BaseProduct, CreateProductRequest} from "../../types.ts"; import {ProductSchema} from "../../../../client"; @@ -24,12 +24,7 @@ const CreateProductModal = ({ }: ContextModalProps) => { const isEditProps = 'product' in innerProps; const isCreatingProps = 'clientId' in innerProps; - const initialValues = isEditProps ? { - name: innerProps.product.name, - article: innerProps.product.article, - barcodes: innerProps.product.barcodes, - barcodeTemplate: innerProps.product.barcodeTemplate - } : { + const initialValues = isEditProps ? innerProps.product : { name: '', article: '', barcodes: [] @@ -44,7 +39,6 @@ const CreateProductModal = ({ const onCancelClick = () => { context.closeContextModal(id); } - const onSubmit = (values: BaseProduct) => { if (isEditProps) innerProps.onChange({...innerProps.product, ...values}) if (isCreatingProps) { @@ -56,26 +50,46 @@ const CreateProductModal = ({ <>
onSubmit(values))}> - - - - +
+ + + + +
+ +
+ + + +
{isEditProps ?