feat: attrs on product
This commit is contained in:
@@ -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);
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -26,8 +26,12 @@ export const useClientsTableColumns = () => {
|
|||||||
header: "ИНН"
|
header: "ИНН"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
accessorKey:"barcodeTemplate.name",
|
accessorKey: "companyName",
|
||||||
header:"Шаблон штрихкодов"
|
header: "Название компании"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
accessorKey: "barcodeTemplate.name",
|
||||||
|
header: "Шаблон штрихкодов"
|
||||||
}
|
}
|
||||||
], []);
|
], []);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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
|
||||||
|
|||||||
Reference in New Issue
Block a user