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 = {
id: number;
name: string;
companyName: string;
barcodeTemplate?: (BarcodeTemplateSchema | null);
details?: (ClientDetailsSchema | null);
};

View File

@@ -25,6 +25,10 @@ export const useClientsTableColumns = () => {
accessorKey: "details.inn",
header: "ИНН"
},
{
accessorKey: "companyName",
header: "Название компании"
},
{
accessorKey: "barcodeTemplate.name",
header: "Шаблон штрихкодов"

View File

@@ -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