fix: Pass data in propertyName format to match n8n structure

Problem:
- Data was being passed in normalized 'case' format
- generateConfirmationFormHTML expects propertyName format for normalization
- Form fields were empty because normalization didn't work correctly

Solution:
- Changed StepClaimConfirmation to pass data in propertyName format
- This matches the structure expected by normalizeData function
- Function can now properly normalize data from propertyName to case format
- All fields should now populate correctly

Files:
- frontend/src/components/form/StepClaimConfirmation.tsx: Changed data format to propertyName
This commit is contained in:
AI Assistant
2025-11-24 16:16:45 +03:00
parent 5e59a15bae
commit fc3ecdb63f

View File

@@ -43,48 +43,26 @@ export default function StepClaimConfirmation({
const claimData = claimPlanData?.propertyName?.claim || {};
const offenders = claimPlanData?.propertyName?.offenders || [];
// Передаем данные в формате propertyName, чтобы функция normalizeData могла их правильно обработать
const formData = {
case: {
user: {
firstname: applicant.first_name || null,
lastname: applicant.last_name || null,
secondname: applicant.middle_name || null,
birthday: applicant.birth_date_fmt || applicant.birth_date || null,
birthplace: applicant.birth_place || null,
inn: applicant.inn || null,
mailingstreet: applicant.address || null,
mobile: applicant.phone || null,
email: applicant.email || null,
},
project: {
category: caseData.category || null,
subject: contract.subject || null,
agrdate: contract.agreement_date_fmt || contract.agreement_date || null,
agrprice: contract.amount_paid_fmt || contract.amount_paid || null,
reason: claimData.reason || caseData.category || null,
description: claimData.description || null,
},
offenders: offenders.length > 0 ? [{
accountname: offenders[0].name || offenders[0].accountname || null,
address: offenders[0].address || null,
inn: offenders[0].inn || null,
ogrn: offenders[0].ogrn || null,
phone: offenders[0].phone || null,
email: offenders[0].email || null,
}] : [],
attachments: claimPlanData?.propertyName?.attachments_names || [],
propertyName: claimPlanData?.propertyName || {
applicant: applicant,
case: caseData,
contract_or_service: contract,
claim: claimData,
offenders: offenders,
meta: {
...claimPlanData?.propertyName?.meta,
session_token: claimPlanData?.session_token || '',
prefix: claimPlanData?.prefix || '',
telegram_id: claimPlanData?.telegram_id || '',
claim_id: claimId,
unified_id: unifiedId,
user_id: claimPlanData?.user_id || claimPlanData?.propertyName?.meta?.user_id || '',
},
attachments_names: claimPlanData?.propertyName?.attachments_names || [],
},
session_token: claimPlanData?.session_token || '',
telegram_id: claimPlanData?.telegram_id || '',
prefix: claimPlanData?.prefix || '',
claim_id: claimId,
token: claimPlanData?.token || '',
sms_meta: {
session_token: claimPlanData?.session_token || '',