diff --git a/ticket_form/frontend/src/components/form/StepWizardPlan.tsx b/ticket_form/frontend/src/components/form/StepWizardPlan.tsx index 1f95c304..f3a21733 100644 --- a/ticket_form/frontend/src/components/form/StepWizardPlan.tsx +++ b/ticket_form/frontend/src/components/form/StepWizardPlan.tsx @@ -338,47 +338,6 @@ export default function StepWizardPlan({ setProgressState({ done, total }); }, [formValues, questions]); - // Автоматически создаём блоки для обязательных документов при ответе "Да" - useEffect(() => { - if (!plan || !formValues) return; - - questions.forEach((question) => { - const visible = evaluateCondition(question.ask_if, formValues); - if (!visible) return; - - const questionValue = formValues?.[question.name]; - if (!isAffirmative(questionValue)) return; - - const questionDocs = documentGroups[question.name] || []; - questionDocs.forEach((doc) => { - if (!doc.required) return; - - const docKey = doc.id || doc.name || `doc_${question.name}`; - - // Не создаём блок, если документ пропущен - if (skippedDocuments.has(docKey)) return; - - const existingBlocks = questionFileBlocks[docKey] || []; - - // Если блока ещё нет, создаём его автоматически - if (existingBlocks.length === 0) { - const category = doc.id && !doc.id.includes('_exist') ? doc.id : docKey; - handleDocumentBlocksChange(docKey, (blocks) => [ - ...blocks, - { - id: generateBlockId(docKey), - fieldName: docKey, - description: '', - category: category, - docLabel: doc.name, - files: [], - }, - ]); - } - }); - }); - }, [formValues, plan, questions, documentGroups, questionFileBlocks, handleDocumentBlocksChange, skippedDocuments]); - // Автоматически создаём блоки для ВСЕХ документов из плана при загрузке useEffect(() => { if (!plan || !documents || documents.length === 0) return;