import { Form, Input, DatePicker, Select, Button, Upload, message } from 'antd'; import { UploadOutlined } from '@ant-design/icons'; import type { UploadFile } from 'antd/es/upload/interface'; import { useState } from 'react'; const { TextArea } = Input; const { Option } = Select; interface Props { formData: any; updateFormData: (data: any) => void; onNext: () => void; onPrev: () => void; } export default function Step2Details({ formData, updateFormData, onNext, onPrev }: Props) { const [form] = Form.useForm(); const [fileList, setFileList] = useState([]); const handleNext = async () => { try { const values = await form.validateFields(); updateFormData({ ...values, incidentDate: values.incidentDate?.format('YYYY-MM-DD'), uploadedFiles: fileList.map(f => f.uid), }); onNext(); } catch (error) { message.error('Заполните все обязательные поля'); } }; const uploadProps = { fileList, beforeUpload: (file: File) => { const isImage = file.type.startsWith('image/'); const isPDF = file.type === 'application/pdf'; if (!isImage && !isPDF) { message.error('Можно загружать только изображения и PDF'); return false; } const isLt10M = file.size / 1024 / 1024 < 10; if (!isLt10M) { message.error('Файл должен быть меньше 10MB'); return false; } setFileList([...fileList, { uid: Math.random().toString(), name: file.name, status: 'done', url: URL.createObjectURL(file), } as UploadFile]); return false; // Отключаем автозагрузку }, onRemove: (file: UploadFile) => { setFileList(fileList.filter(f => f.uid !== file.uid)); }, }; return (