From b1f3df5c055fc8ca23e1bcffeb459d4faa981568 Mon Sep 17 00:00:00 2001 From: admin Date: Tue, 15 Oct 2024 07:41:43 +0300 Subject: [PATCH] feat: add comment, creating refactor --- src/client/models/ClientSchema.ts | 1 + .../ClientFormModal/ClientFormModal.tsx | 38 +++++++++++-------- .../drawers/DealEditDrawer/tabs/ClientTab.tsx | 8 +++- 3 files changed, 31 insertions(+), 16 deletions(-) diff --git a/src/client/models/ClientSchema.ts b/src/client/models/ClientSchema.ts index be3caa4..b59f6af 100644 --- a/src/client/models/ClientSchema.ts +++ b/src/client/models/ClientSchema.ts @@ -9,6 +9,7 @@ export type ClientSchema = { name: string; companyName: string; barcodeTemplate?: (BarcodeTemplateSchema | null); + comment?: (string | null); details?: (ClientDetailsSchema | null); }; diff --git a/src/pages/ClientsPage/modals/ClientFormModal/ClientFormModal.tsx b/src/pages/ClientsPage/modals/ClientFormModal/ClientFormModal.tsx index 5b51f75..8596577 100644 --- a/src/pages/ClientsPage/modals/ClientFormModal/ClientFormModal.tsx +++ b/src/pages/ClientsPage/modals/ClientFormModal/ClientFormModal.tsx @@ -1,5 +1,5 @@ import { ContextModalProps } from "@mantine/modals"; -import { Fieldset, TextInput } from "@mantine/core"; +import { Fieldset, Textarea, TextInput } from "@mantine/core"; import { useForm } from "@mantine/form"; import { ClientSchema } from "../../../../client"; import BaseFormModal, { @@ -10,25 +10,26 @@ import BarcodeTemplateSelect from "../../../../components/Selects/BarcodeTemplat type Props = CreateEditFormProps; const ClientFormModal = ({ - context, - id, - innerProps, -}: ContextModalProps) => { + context, + id, + innerProps, + }: ContextModalProps) => { const isEditing = "onChange" in innerProps; const initialValues: ClientSchema = isEditing ? innerProps.element : { - id: -1, - name: "", - companyName: "", - details: { - telegram: "", - phoneNumber: "", - email: "", - inn: undefined, - }, - }; + id: -1, + name: "", + companyName: "", + details: { + telegram: "", + phoneNumber: "", + email: "", + inn: undefined, + }, + comment: "", + }; const form = useForm({ initialValues: initialValues, validate: { @@ -63,6 +64,7 @@ const ClientFormModal = ({ placeholder={"Введите название клиента"} {...form.getInputProps("name")} /> +
+