feat: add comment, creating refactor
This commit is contained in:
@@ -9,6 +9,7 @@ export type ClientSchema = {
|
|||||||
name: string;
|
name: string;
|
||||||
companyName: string;
|
companyName: string;
|
||||||
barcodeTemplate?: (BarcodeTemplateSchema | null);
|
barcodeTemplate?: (BarcodeTemplateSchema | null);
|
||||||
|
comment?: (string | null);
|
||||||
details?: (ClientDetailsSchema | null);
|
details?: (ClientDetailsSchema | null);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import { ContextModalProps } from "@mantine/modals";
|
import { ContextModalProps } from "@mantine/modals";
|
||||||
import { Fieldset, TextInput } from "@mantine/core";
|
import { Fieldset, Textarea, TextInput } from "@mantine/core";
|
||||||
import { useForm } from "@mantine/form";
|
import { useForm } from "@mantine/form";
|
||||||
import { ClientSchema } from "../../../../client";
|
import { ClientSchema } from "../../../../client";
|
||||||
import BaseFormModal, {
|
import BaseFormModal, {
|
||||||
@@ -10,25 +10,26 @@ import BarcodeTemplateSelect from "../../../../components/Selects/BarcodeTemplat
|
|||||||
type Props = CreateEditFormProps<ClientSchema>;
|
type Props = CreateEditFormProps<ClientSchema>;
|
||||||
|
|
||||||
const ClientFormModal = ({
|
const ClientFormModal = ({
|
||||||
context,
|
context,
|
||||||
id,
|
id,
|
||||||
innerProps,
|
innerProps,
|
||||||
}: ContextModalProps<Props>) => {
|
}: ContextModalProps<Props>) => {
|
||||||
const isEditing = "onChange" in innerProps;
|
const isEditing = "onChange" in innerProps;
|
||||||
|
|
||||||
const initialValues: ClientSchema = isEditing
|
const initialValues: ClientSchema = isEditing
|
||||||
? innerProps.element
|
? innerProps.element
|
||||||
: {
|
: {
|
||||||
id: -1,
|
id: -1,
|
||||||
name: "",
|
name: "",
|
||||||
companyName: "",
|
companyName: "",
|
||||||
details: {
|
details: {
|
||||||
telegram: "",
|
telegram: "",
|
||||||
phoneNumber: "",
|
phoneNumber: "",
|
||||||
email: "",
|
email: "",
|
||||||
inn: undefined,
|
inn: undefined,
|
||||||
},
|
},
|
||||||
};
|
comment: "",
|
||||||
|
};
|
||||||
const form = useForm<ClientSchema>({
|
const form = useForm<ClientSchema>({
|
||||||
initialValues: initialValues,
|
initialValues: initialValues,
|
||||||
validate: {
|
validate: {
|
||||||
@@ -63,6 +64,7 @@ const ClientFormModal = ({
|
|||||||
placeholder={"Введите название клиента"}
|
placeholder={"Введите название клиента"}
|
||||||
{...form.getInputProps("name")}
|
{...form.getInputProps("name")}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
</Fieldset>
|
</Fieldset>
|
||||||
<Fieldset legend={"Дополнительная информация"}>
|
<Fieldset legend={"Дополнительная информация"}>
|
||||||
<TextInput
|
<TextInput
|
||||||
@@ -90,6 +92,12 @@ const ClientFormModal = ({
|
|||||||
placeholder={"Введите название компании"}
|
placeholder={"Введите название компании"}
|
||||||
{...form.getInputProps("companyName")}
|
{...form.getInputProps("companyName")}
|
||||||
/>
|
/>
|
||||||
|
<Textarea
|
||||||
|
label={"Комментарий"}
|
||||||
|
placeholder={"Введите комментарий"}
|
||||||
|
{...form.getInputProps("comment")}
|
||||||
|
/>
|
||||||
|
|
||||||
</Fieldset>
|
</Fieldset>
|
||||||
<Fieldset legend={"Настройки"}>
|
<Fieldset legend={"Настройки"}>
|
||||||
<BarcodeTemplateSelect
|
<BarcodeTemplateSelect
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import { Button, Fieldset, Flex, rem, TextInput } from "@mantine/core";
|
import { Button, Fieldset, Flex, rem, Textarea, TextInput } from "@mantine/core";
|
||||||
import { useDealPageContext } from "../../../contexts/DealPageContext.tsx";
|
import { useDealPageContext } from "../../../contexts/DealPageContext.tsx";
|
||||||
import { useForm } from "@mantine/form";
|
import { useForm } from "@mantine/form";
|
||||||
import { DealGeneralFormType } from "./DealEditDrawerGeneralTab.tsx";
|
import { DealGeneralFormType } from "./DealEditDrawerGeneralTab.tsx";
|
||||||
@@ -75,6 +75,12 @@ const ClientTab = () => {
|
|||||||
label={"ИНН"}
|
label={"ИНН"}
|
||||||
{...form.getInputProps("client.details.inn")}
|
{...form.getInputProps("client.details.inn")}
|
||||||
/>
|
/>
|
||||||
|
<Textarea
|
||||||
|
placeholder={"Введите комментарий"}
|
||||||
|
label={"Комментарий"}
|
||||||
|
{...form.getInputProps("client.comment")}
|
||||||
|
/>
|
||||||
|
|
||||||
</Fieldset>
|
</Fieldset>
|
||||||
</Flex>
|
</Flex>
|
||||||
<Flex
|
<Flex
|
||||||
|
|||||||
Reference in New Issue
Block a user