feat: attrs on product

This commit is contained in:
2024-05-10 16:48:48 +03:00
parent 09a6ed0c4f
commit 004ad9a562
3 changed files with 14 additions and 14 deletions

View File

@@ -7,6 +7,7 @@ import type { ClientDetailsSchema } from './ClientDetailsSchema';
export type ClientSchema = { export type ClientSchema = {
id: number; id: number;
name: string; name: string;
companyName: string;
barcodeTemplate?: (BarcodeTemplateSchema | null); barcodeTemplate?: (BarcodeTemplateSchema | null);
details?: (ClientDetailsSchema | null); details?: (ClientDetailsSchema | null);
}; };

View File

@@ -26,8 +26,12 @@ export const useClientsTableColumns = () => {
header: "ИНН" header: "ИНН"
}, },
{ {
accessorKey:"barcodeTemplate.name", accessorKey: "companyName",
header:"Шаблон штрихкодов" header: "Название компании"
},
{
accessorKey: "barcodeTemplate.name",
header: "Шаблон штрихкодов"
} }
], []); ], []);
} }

View File

@@ -15,24 +15,15 @@ const ClientFormModal = ({
}: ContextModalProps<Props>) => { }: ContextModalProps<Props>) => {
const isEditing = 'onChange' in innerProps; const isEditing = 'onChange' in innerProps;
const initialValues: ClientSchema = isEditing ? { const initialValues: ClientSchema = isEditing ? innerProps.element : {
id: innerProps.element.id,
name: innerProps.element.name,
details: {
telegram: innerProps.element.details?.telegram,
phoneNumber: innerProps.element.details?.phoneNumber,
email: innerProps.element.details?.email,
inn: innerProps.element.details?.inn
},
barcodeTemplate: innerProps.element.barcodeTemplate
} : {
id: -1, id: -1,
name: '', name: '',
companyName: '',
details: { details: {
telegram: '', telegram: '',
phoneNumber: '', phoneNumber: '',
email: '', email: '',
inn: undefined inn: undefined,
} }
} }
const form = useForm<ClientSchema>({ const form = useForm<ClientSchema>({
@@ -90,6 +81,10 @@ const ClientFormModal = ({
placeholder={"Введите ИНН"} placeholder={"Введите ИНН"}
{...form.getInputProps('details.inn')} {...form.getInputProps('details.inn')}
/> />
<TextInput
label={"Название компании"}
placeholder={"Введите название компании"}
{...form.getInputProps('companyName')}/>
</Fieldset> </Fieldset>
<Fieldset legend={'Настройки'}> <Fieldset legend={'Настройки'}>
<BarcodeTemplateSelect <BarcodeTemplateSelect