feat: small refactor, address now is telegram
This commit is contained in:
@@ -10,16 +10,20 @@ export const useClientsTableColumns = () => {
|
||||
header: "Имя",
|
||||
},
|
||||
{
|
||||
accessorKey: "details.address",
|
||||
header: "Адрес"
|
||||
accessorKey: "details.telegram",
|
||||
header: "Телеграм"
|
||||
},
|
||||
{
|
||||
accessorKey: "details.email",
|
||||
header: "EMAIL"
|
||||
},
|
||||
{
|
||||
accessorKey: "details.phone_number",
|
||||
accessorKey: "details.phoneNumber",
|
||||
header: "Телефон"
|
||||
},
|
||||
{
|
||||
accessorKey: "details.inn",
|
||||
header: "ИНН"
|
||||
}
|
||||
], []);
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import {ContextModalProps} from "@mantine/modals";
|
||||
import {Fieldset, NumberInput, TextInput} from "@mantine/core";
|
||||
import {Fieldset, TextInput} from "@mantine/core";
|
||||
import {useForm} from "@mantine/form";
|
||||
import {ClientSchema} from "../../../../client";
|
||||
import {getDigitsCount} from "../../../../shared/lib/utils.ts";
|
||||
@@ -19,7 +19,7 @@ const ClientFormModal = ({
|
||||
id: innerProps.element.id,
|
||||
name: innerProps.element.name,
|
||||
details: {
|
||||
address: innerProps.element.details?.address,
|
||||
telegram: innerProps.element.details?.telegram,
|
||||
phoneNumber: innerProps.element.details?.phoneNumber,
|
||||
email: innerProps.element.details?.email,
|
||||
inn: innerProps.element.details?.inn
|
||||
@@ -28,7 +28,7 @@ const ClientFormModal = ({
|
||||
id: -1,
|
||||
name: '',
|
||||
details: {
|
||||
address: '',
|
||||
telegram: '',
|
||||
phoneNumber: '',
|
||||
email: '',
|
||||
inn: undefined
|
||||
@@ -39,7 +39,7 @@ const ClientFormModal = ({
|
||||
validate: {
|
||||
name: (name: string) => name.trim() !== '' ? null : "Необходимо ввести название клиента",
|
||||
details: {
|
||||
address: (address: string | undefined | null) => (address && address.trim() !== '') ? null : "Необходимо ввести адрес",
|
||||
telegram: (address: string | undefined | null) => (address && address.trim() !== '') ? null : "Необходимо ввести телеграм",
|
||||
phoneNumber: (phoneNumber: string | undefined | null) => (phoneNumber && phoneNumber.trim() !== '') ? null : "Необходимо ввести номер телефона",
|
||||
email: (email: string | undefined | null) => (email && email.trim() !== '') ? null : "Необходимо ввести почту",
|
||||
inn: (inn: string | undefined | null) => (inn && getDigitsCount(parseInt(inn)) >= 10) ? null : "ИНН должен содержать не менее 10 цифр",
|
||||
@@ -71,9 +71,9 @@ const ClientFormModal = ({
|
||||
<Fieldset legend={"Дополнительная информация"}>
|
||||
<TextInput
|
||||
required
|
||||
label={"Адрес"}
|
||||
placeholder={"Введите адрес"}
|
||||
{...form.getInputProps('details.address')}
|
||||
label={"Телеграм"}
|
||||
placeholder={"Введите телеграм"}
|
||||
{...form.getInputProps('details.telegram')}
|
||||
/>
|
||||
<TextInput
|
||||
required
|
||||
@@ -87,9 +87,8 @@ const ClientFormModal = ({
|
||||
placeholder={"Введите почту"}
|
||||
{...form.getInputProps('details.email')}
|
||||
/>
|
||||
<NumberInput
|
||||
<TextInput
|
||||
required
|
||||
hideControls
|
||||
label={"ИНН"}
|
||||
placeholder={"Введите ИНН"}
|
||||
{...form.getInputProps('details.inn')}
|
||||
|
||||
Reference in New Issue
Block a user