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:
@@ -43,48 +43,26 @@ export default function StepClaimConfirmation({
|
|||||||
const claimData = claimPlanData?.propertyName?.claim || {};
|
const claimData = claimPlanData?.propertyName?.claim || {};
|
||||||
const offenders = claimPlanData?.propertyName?.offenders || [];
|
const offenders = claimPlanData?.propertyName?.offenders || [];
|
||||||
|
|
||||||
|
// Передаем данные в формате propertyName, чтобы функция normalizeData могла их правильно обработать
|
||||||
const formData = {
|
const formData = {
|
||||||
case: {
|
propertyName: claimPlanData?.propertyName || {
|
||||||
user: {
|
applicant: applicant,
|
||||||
firstname: applicant.first_name || null,
|
case: caseData,
|
||||||
lastname: applicant.last_name || null,
|
contract_or_service: contract,
|
||||||
secondname: applicant.middle_name || null,
|
claim: claimData,
|
||||||
birthday: applicant.birth_date_fmt || applicant.birth_date || null,
|
offenders: offenders,
|
||||||
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 || [],
|
|
||||||
meta: {
|
meta: {
|
||||||
...claimPlanData?.propertyName?.meta,
|
...claimPlanData?.propertyName?.meta,
|
||||||
session_token: claimPlanData?.session_token || '',
|
|
||||||
prefix: claimPlanData?.prefix || '',
|
|
||||||
telegram_id: claimPlanData?.telegram_id || '',
|
|
||||||
claim_id: claimId,
|
claim_id: claimId,
|
||||||
unified_id: unifiedId,
|
unified_id: unifiedId,
|
||||||
user_id: claimPlanData?.user_id || claimPlanData?.propertyName?.meta?.user_id || '',
|
user_id: claimPlanData?.user_id || claimPlanData?.propertyName?.meta?.user_id || '',
|
||||||
},
|
},
|
||||||
|
attachments_names: claimPlanData?.propertyName?.attachments_names || [],
|
||||||
},
|
},
|
||||||
session_token: claimPlanData?.session_token || '',
|
session_token: claimPlanData?.session_token || '',
|
||||||
telegram_id: claimPlanData?.telegram_id || '',
|
telegram_id: claimPlanData?.telegram_id || '',
|
||||||
|
prefix: claimPlanData?.prefix || '',
|
||||||
|
claim_id: claimId,
|
||||||
token: claimPlanData?.token || '',
|
token: claimPlanData?.token || '',
|
||||||
sms_meta: {
|
sms_meta: {
|
||||||
session_token: claimPlanData?.session_token || '',
|
session_token: claimPlanData?.session_token || '',
|
||||||
|
|||||||
Reference in New Issue
Block a user