feat: attrs on product
This commit is contained in:
@@ -7,6 +7,7 @@ import type { ClientDetailsSchema } from './ClientDetailsSchema';
|
||||
export type ClientSchema = {
|
||||
id: number;
|
||||
name: string;
|
||||
companyName: string;
|
||||
barcodeTemplate?: (BarcodeTemplateSchema | null);
|
||||
details?: (ClientDetailsSchema | null);
|
||||
};
|
||||
|
||||
@@ -25,6 +25,10 @@ export const useClientsTableColumns = () => {
|
||||
accessorKey: "details.inn",
|
||||
header: "ИНН"
|
||||
},
|
||||
{
|
||||
accessorKey: "companyName",
|
||||
header: "Название компании"
|
||||
},
|
||||
{
|
||||
accessorKey: "barcodeTemplate.name",
|
||||
header: "Шаблон штрихкодов"
|
||||
|
||||
@@ -15,24 +15,15 @@ const ClientFormModal = ({
|
||||
}: ContextModalProps<Props>) => {
|
||||
const isEditing = 'onChange' in innerProps;
|
||||
|
||||
const initialValues: ClientSchema = isEditing ? {
|
||||
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
|
||||
} : {
|
||||
const initialValues: ClientSchema = isEditing ? innerProps.element : {
|
||||
id: -1,
|
||||
name: '',
|
||||
companyName: '',
|
||||
details: {
|
||||
telegram: '',
|
||||
phoneNumber: '',
|
||||
email: '',
|
||||
inn: undefined
|
||||
inn: undefined,
|
||||
}
|
||||
}
|
||||
const form = useForm<ClientSchema>({
|
||||
@@ -90,6 +81,10 @@ const ClientFormModal = ({
|
||||
placeholder={"Введите ИНН"}
|
||||
{...form.getInputProps('details.inn')}
|
||||
/>
|
||||
<TextInput
|
||||
label={"Название компании"}
|
||||
placeholder={"Введите название компании"}
|
||||
{...form.getInputProps('companyName')}/>
|
||||
</Fieldset>
|
||||
<Fieldset legend={'Настройки'}>
|
||||
<BarcodeTemplateSelect
|
||||
|
||||
Reference in New Issue
Block a user