temp image upload
This commit is contained in:
@@ -5,6 +5,7 @@ import {BaseProduct, CreateProductRequest} from "../../types.ts";
|
||||
import {ProductSchema} from "../../../../client";
|
||||
import BarcodeTemplateSelect from "../../../../components/Selects/BarcodeTemplateSelect/BarcodeTemplateSelect.tsx";
|
||||
import ImageDropzone from "../../../../components/ImageDropzone/ImageDropzone.tsx";
|
||||
import {BaseFormInputProps} from "../../../../types/utils.ts";
|
||||
|
||||
type CreateProps = {
|
||||
clientId: number;
|
||||
@@ -25,12 +26,13 @@ const CreateProductModal = ({
|
||||
}: ContextModalProps<Props>) => {
|
||||
const isEditProps = 'product' in innerProps;
|
||||
const isCreatingProps = 'clientId' in innerProps;
|
||||
const initialValues = isEditProps ? innerProps.product : {
|
||||
const initialValues: Omit<ProductSchema, 'id'> = isEditProps ? innerProps.product : {
|
||||
name: '',
|
||||
article: '',
|
||||
barcodes: []
|
||||
barcodes: [],
|
||||
clientId: innerProps.clientId
|
||||
};
|
||||
const form = useForm({
|
||||
const form = useForm<Omit<ProductSchema, 'id'>>({
|
||||
initialValues: initialValues,
|
||||
validate: {
|
||||
name: (name) => name.trim() !== '' ? null : "Необходимо ввести название товара",
|
||||
@@ -99,11 +101,15 @@ const CreateProductModal = ({
|
||||
label={"Доп. информация"}
|
||||
{...form.getInputProps('additionalInfo')} />
|
||||
</Fieldset>
|
||||
<Fieldset legend={"Изображение"}>
|
||||
|
||||
<ImageDropzone onDrop={(data) => {
|
||||
}}/>
|
||||
</Fieldset>
|
||||
{isEditProps &&
|
||||
// <Fieldset legend={"Изображение"}>
|
||||
<ImageDropzone
|
||||
imageUrlInputProps={form.getInputProps('imageUrl') as BaseFormInputProps<string>}
|
||||
productId={innerProps.product.id}
|
||||
/>
|
||||
// </Fieldset>
|
||||
}
|
||||
<Flex justify={"flex-end"} mt={rem(5)} gap={rem(10)}>
|
||||
<Button onClick={() => onCancelClick()} variant={"subtle"}>Отменить</Button>
|
||||
{isEditProps ?
|
||||
|
||||
Reference in New Issue
Block a user