chore: translate form fields
This commit is contained in:
@@ -20,6 +20,31 @@ interface BitrixMultiField {
|
||||
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). */
|
||||
interface BitrixLeadFields {
|
||||
SOURCE_ID: string
|
||||
@@ -96,10 +121,10 @@ function toLeadFields(submission: ContactSubmission): BitrixLeadFields {
|
||||
if (company) fields[UF_COMPANY] = company
|
||||
|
||||
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)
|
||||
if (timeline) fields[UF_TIMELINE] = timeline
|
||||
if (timeline) fields[UF_TIMELINE] = TIMELINE_LABELS[timeline] ?? timeline
|
||||
|
||||
const meetingSlot = trimmed(submission.meetingSlot1)
|
||||
if (meetingSlot) fields[UF_MEETING_SLOT] = toBitrixDateTime(meetingSlot)
|
||||
|
||||
Reference in New Issue
Block a user