chore: translate form fields

This commit is contained in:
Zotov Ivan Yuryevich
2026-07-04 12:25:10 +03:00
parent 16e83e48ff
commit 588a547684

View File

@@ -20,6 +20,31 @@ interface BitrixMultiField {
VALUE: string VALUE: string
} }
// The form submits stable option ids; the CRM should show the same Russian
// labels the user sees in the UI (see ContactForm.tsx). Unknown ids fall
// through unchanged.
const PURPOSE_LABELS: Record<string, string> = {
modernization: 'Модернизация инфраструктуры',
'software-replacement': 'Замена импортного ПО на российское',
'capacity-expansion': 'Расширение мощностей',
'new-infrastructure': 'Создание новой инфраструктуры',
'security-improvement': 'Повышение безопасности',
automation: 'Автоматизация процессов',
'cloud-migration': 'Миграция в облако',
'disaster-recovery': 'Резервирование и восстановление',
compliance: 'Соответствие требованиям регуляторов',
other: 'Другое',
}
const TIMELINE_LABELS: Record<string, string> = {
urgent: 'До 1 месяца',
'1-3-months': '1-3 месяца',
'3-6-months': '3-6 месяцев',
'6-12-months': '6-12 месяцев',
'12-months-plus': 'Более 12 месяцев',
planning: 'На стадии планирования',
}
/** Lead fields sent to `crm.lead.add`. UF_CRM_* are mapped form fields (see consts above). */ /** Lead fields sent to `crm.lead.add`. UF_CRM_* are mapped form fields (see consts above). */
interface BitrixLeadFields { interface BitrixLeadFields {
SOURCE_ID: string SOURCE_ID: string
@@ -96,10 +121,10 @@ function toLeadFields(submission: ContactSubmission): BitrixLeadFields {
if (company) fields[UF_COMPANY] = company if (company) fields[UF_COMPANY] = company
const purpose = trimmed(submission.purpose) const purpose = trimmed(submission.purpose)
if (purpose) fields[UF_PURPOSE] = purpose if (purpose) fields[UF_PURPOSE] = PURPOSE_LABELS[purpose] ?? purpose
const timeline = trimmed(submission.timeline) const timeline = trimmed(submission.timeline)
if (timeline) fields[UF_TIMELINE] = timeline if (timeline) fields[UF_TIMELINE] = TIMELINE_LABELS[timeline] ?? timeline
const meetingSlot = trimmed(submission.meetingSlot1) const meetingSlot = trimmed(submission.meetingSlot1)
if (meetingSlot) fields[UF_MEETING_SLOT] = toBitrixDateTime(meetingSlot) if (meetingSlot) fields[UF_MEETING_SLOT] = toBitrixDateTime(meetingSlot)