feat: temp barcode templates
This commit is contained in:
@@ -1,11 +1,17 @@
|
||||
import BaseFormModal, {CreateEditFormProps} from "../../../ClientsPage/modals/BaseFormModal/BaseFormModal.tsx";
|
||||
import {BarcodeTemplateAttributeSchema, BarcodeTemplateSchema} from "../../../../client";
|
||||
import {
|
||||
BarcodeTemplateAdditionalAttributeSchema,
|
||||
BarcodeTemplateAttributeSchema,
|
||||
BarcodeTemplateSchema
|
||||
} from "../../../../client";
|
||||
import {ContextModalProps} from "@mantine/modals";
|
||||
import {useForm} from "@mantine/form";
|
||||
import {Checkbox, Fieldset, Flex, NumberInput, rem, TextInput} from "@mantine/core";
|
||||
import {IconX} from "@tabler/icons-react";
|
||||
import BarcodeTemplateAttributeMultiselect
|
||||
from "../../components/BarcodeTemplateAttributeMultiselect/BarcodeTemplateAttributeMultiselect.tsx";
|
||||
import BarcodeTemplateAdditionalFieldTable
|
||||
from "../../components/BarcodeTemplateAdditionalFieldTable/BarcodeTemplateAdditionalFieldTable.tsx";
|
||||
|
||||
type Props = CreateEditFormProps<BarcodeTemplateSchema>
|
||||
const BarcodeTemplateFormModal = ({
|
||||
@@ -19,7 +25,8 @@ const BarcodeTemplateFormModal = ({
|
||||
width: undefined,
|
||||
height: undefined,
|
||||
isDefault: false,
|
||||
attributes: [] as Array<BarcodeTemplateAttributeSchema>
|
||||
attributes: [] as Array<BarcodeTemplateAttributeSchema>,
|
||||
additionalAttributes: [] as Array<BarcodeTemplateAdditionalAttributeSchema>
|
||||
} as Partial<BarcodeTemplateSchema>;
|
||||
const form = useForm<Partial<BarcodeTemplateSchema>>({
|
||||
initialValues: initialValues,
|
||||
@@ -30,7 +37,7 @@ const BarcodeTemplateFormModal = ({
|
||||
name: (name: string | undefined) => name && name.trim() !== '' ? null : "Необходимо ввести название шаблона",
|
||||
}
|
||||
})
|
||||
|
||||
console.log(form.values.additionalAttributes);
|
||||
return (
|
||||
<BaseFormModal
|
||||
{...innerProps}
|
||||
@@ -64,10 +71,13 @@ const BarcodeTemplateFormModal = ({
|
||||
/>
|
||||
</Flex>
|
||||
<BarcodeTemplateAttributeMultiselect
|
||||
label={"Атрибуты"}
|
||||
label={"Стандартные атрибуты"}
|
||||
placeholder={!form.values.attributes?.length ? "Выберите атрибуты" : undefined}
|
||||
{...form.getInputProps('attributes')}
|
||||
/>
|
||||
<BarcodeTemplateAdditionalFieldTable
|
||||
{...form.getInputProps('additionalAttributes')}
|
||||
/>
|
||||
<Checkbox
|
||||
label={"Использовать как стандартный шаблон"}
|
||||
checked={form.getInputProps('isDefault').value as boolean}
|
||||
|
||||
Reference in New Issue
Block a user