added missin lang keys
This commit is contained in:
@@ -8,6 +8,7 @@ import { Building2, MapPin, Clock } from 'lucide-react'
|
||||
import type { LucideIcon } from 'lucide-react'
|
||||
import { FormInput } from '@/components/formInput'
|
||||
import { FormActions } from '@/components/formActions'
|
||||
import { MultiLangInput } from '@/components/multiLangInput'
|
||||
import { Checkbox } from '@/components/ui/checkbox'
|
||||
import { StepBarCards, type StepCardItem } from '@/components/stepBarV2'
|
||||
import { useCreateBranch, useUpdateBranch } from '@/features/branches/hooks/useBranches'
|
||||
@@ -27,14 +28,6 @@ function flattenErrors(errors: Record<string, { message?: string } | undefined>)
|
||||
return result
|
||||
}
|
||||
|
||||
type LangKey = 'tk' | 'ru' | 'en'
|
||||
|
||||
const LANG_TABS: { key: LangKey; label: string }[] = [
|
||||
{ key: 'tk', label: 'Türkmen' },
|
||||
{ key: 'ru', label: 'Русский' },
|
||||
{ key: 'en', label: 'English' },
|
||||
]
|
||||
|
||||
interface StepDef {
|
||||
id: string
|
||||
titleKey: string
|
||||
@@ -85,46 +78,25 @@ interface StepContentProps {
|
||||
form: BranchFormData
|
||||
errors: FlatErrors
|
||||
set: <K extends keyof BranchFormData>(k: K, v: BranchFormData[K]) => void
|
||||
activeLang: LangKey
|
||||
setActiveLang: (l: LangKey) => void
|
||||
t: (key: string, fallback?: string) => string
|
||||
lang: 'tk' | 'ru' | 'en'
|
||||
}
|
||||
|
||||
function StepBasic({ form, errors, set, activeLang, setActiveLang }: StepContentProps) {
|
||||
const nameFieldKey = `name${activeLang.charAt(0).toUpperCase() + activeLang.slice(1)}` as 'nameTk' | 'nameRu' | 'nameEn'
|
||||
const nameErrorKey = nameFieldKey as keyof FlatErrors
|
||||
function StepBasic({ form, errors, set, t, lang }: StepContentProps) {
|
||||
const nameFields = {
|
||||
tk: { value: form.nameTk, onChange: (v: string) => set('nameTk', v), error: errors.nameTk },
|
||||
ru: { value: form.nameRu, onChange: (v: string) => set('nameRu', v), error: errors.nameRu },
|
||||
en: { value: form.nameEn, onChange: (v: string) => set('nameEn', v), error: errors.nameEn },
|
||||
}
|
||||
|
||||
return (
|
||||
<div className="flex flex-col gap-6">
|
||||
<div className="flex gap-3 justify-end mb-2">
|
||||
{LANG_TABS.map((tab) => (
|
||||
<button
|
||||
key={tab.key}
|
||||
type="button"
|
||||
onClick={() => setActiveLang(tab.key)}
|
||||
className={`text-sm transition-colors ${
|
||||
activeLang === tab.key
|
||||
? 'text-primary font-semibold underline underline-offset-4'
|
||||
: 'text-muted-foreground hover:text-foreground'
|
||||
}`}
|
||||
>
|
||||
{tab.label}
|
||||
</button>
|
||||
))}
|
||||
</div>
|
||||
<MultiLangInput fields={nameFields} placeholder={t('branches.fields.name', 'Şahamçanyň ady')} />
|
||||
|
||||
<div className="grid grid-cols-1 sm:grid-cols-2 gap-6">
|
||||
<FormInput
|
||||
type="text"
|
||||
label="Şahamçanyň ady"
|
||||
required
|
||||
value={form[nameFieldKey]}
|
||||
onChange={(v) => set(nameFieldKey, v)}
|
||||
placeholder="Şahamçanyň ady"
|
||||
error={errors[nameErrorKey]}
|
||||
/>
|
||||
<FormInput
|
||||
type="text"
|
||||
label="Kod"
|
||||
label={t('branches.fields.code', 'Kod')}
|
||||
required
|
||||
value={form.code}
|
||||
onChange={(v) => set('code', v)}
|
||||
@@ -136,12 +108,12 @@ function StepBasic({ form, errors, set, activeLang, setActiveLang }: StepContent
|
||||
<div className="grid grid-cols-1 sm:grid-cols-2 gap-6">
|
||||
<FormInput
|
||||
type="searchable-select"
|
||||
label="Etrap"
|
||||
label={t('branches.fields.district', 'Etrap')}
|
||||
required
|
||||
value={form.districtId}
|
||||
onChange={(v) => set('districtId', v)}
|
||||
options={getDistrictOptions().map((d) => ({ value: String(d.id), label: d.name.tk }))}
|
||||
placeholder="Etrap saýlaň"
|
||||
options={getDistrictOptions().map((d) => ({ value: String(d.id), label: d.name[lang] }))}
|
||||
placeholder={t('branches.fields.district', 'Etrap saýlaň')}
|
||||
error={errors.districtId}
|
||||
/>
|
||||
<div className="flex items-end pb-2">
|
||||
@@ -152,7 +124,7 @@ function StepBasic({ form, errors, set, activeLang, setActiveLang }: StepContent
|
||||
onCheckedChange={(checked) => set('isActive', !!checked)}
|
||||
/>
|
||||
<label htmlFor="isActive" className="text-sm text-muted-foreground cursor-pointer select-none">
|
||||
Işjeň
|
||||
{t('branches.fields.isActive', 'Işjeň')}
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
@@ -161,43 +133,21 @@ function StepBasic({ form, errors, set, activeLang, setActiveLang }: StepContent
|
||||
)
|
||||
}
|
||||
|
||||
function StepAddress({ form, errors, set, activeLang, setActiveLang }: StepContentProps) {
|
||||
const addrFieldKey = `address${activeLang.charAt(0).toUpperCase() + activeLang.slice(1)}` as 'addressTk' | 'addressRu' | 'addressEn'
|
||||
const addrErrorKey = addrFieldKey as keyof FlatErrors
|
||||
function StepAddress({ form, errors, set, t }: StepContentProps) {
|
||||
const addressFields = {
|
||||
tk: { value: form.addressTk, onChange: (v: string) => set('addressTk', v), error: errors.addressTk },
|
||||
ru: { value: form.addressRu, onChange: (v: string) => set('addressRu', v), error: errors.addressRu },
|
||||
en: { value: form.addressEn, onChange: (v: string) => set('addressEn', v), error: errors.addressEn },
|
||||
}
|
||||
|
||||
return (
|
||||
<div className="flex flex-col gap-6">
|
||||
<div className="flex gap-3 justify-end mb-2">
|
||||
{LANG_TABS.map((tab) => (
|
||||
<button
|
||||
key={tab.key}
|
||||
type="button"
|
||||
onClick={() => setActiveLang(tab.key)}
|
||||
className={`text-sm transition-colors ${
|
||||
activeLang === tab.key
|
||||
? 'text-primary font-semibold underline underline-offset-4'
|
||||
: 'text-muted-foreground hover:text-foreground'
|
||||
}`}
|
||||
>
|
||||
{tab.label}
|
||||
</button>
|
||||
))}
|
||||
</div>
|
||||
|
||||
<FormInput
|
||||
type="text"
|
||||
label="Salgy"
|
||||
required
|
||||
value={form[addrFieldKey]}
|
||||
onChange={(v) => set(addrFieldKey, v)}
|
||||
placeholder="Salgy"
|
||||
error={errors[addrErrorKey]}
|
||||
/>
|
||||
<MultiLangInput fields={addressFields} placeholder={t('branches.fields.address', 'Salgy')} />
|
||||
|
||||
<div className="grid grid-cols-1 sm:grid-cols-2 gap-6">
|
||||
<FormInput
|
||||
type="phone"
|
||||
label="Telefon"
|
||||
label={t('branches.fields.phone', 'Telefon')}
|
||||
required
|
||||
value={form.phone}
|
||||
onChange={(v) => set('phone', v)}
|
||||
@@ -206,7 +156,7 @@ function StepAddress({ form, errors, set, activeLang, setActiveLang }: StepConte
|
||||
/>
|
||||
<FormInput
|
||||
type="email"
|
||||
label="E-poçta"
|
||||
label={t('branches.fields.email', 'E-poçta')}
|
||||
required
|
||||
value={form.email}
|
||||
onChange={(v) => set('email', v)}
|
||||
@@ -218,13 +168,13 @@ function StepAddress({ form, errors, set, activeLang, setActiveLang }: StepConte
|
||||
)
|
||||
}
|
||||
|
||||
function StepHours({ form, errors, set }: StepContentProps) {
|
||||
function StepHours({ form, errors, set, t }: StepContentProps) {
|
||||
return (
|
||||
<div className="flex flex-col gap-6">
|
||||
<div className="grid grid-cols-1 sm:grid-cols-2 gap-6">
|
||||
<FormInput
|
||||
type="text"
|
||||
label="Iş wagty"
|
||||
label={t('branches.fields.workingHours', 'Iş wagty')}
|
||||
required
|
||||
value={form.workingHours}
|
||||
onChange={(v) => set('workingHours', v)}
|
||||
@@ -234,7 +184,7 @@ function StepHours({ form, errors, set }: StepContentProps) {
|
||||
</div>
|
||||
<FormInput
|
||||
type="textarea"
|
||||
label="Bellikler"
|
||||
label={t('branches.fields.description', 'Bellikler')}
|
||||
value={form.description}
|
||||
onChange={(v) => set('description', v)}
|
||||
placeholder="Goşmaça maglumatlar..."
|
||||
@@ -273,14 +223,13 @@ export function BranchForm({ mode, initialData }: BranchFormProps) {
|
||||
(key, fallback) => _t(key, fallback ?? key) as string,
|
||||
[_t],
|
||||
)
|
||||
const lang = (i18n.language?.slice(0, 2) ?? 'tk') as 'tk' | 'ru' | 'en'
|
||||
const navigate = useNavigate()
|
||||
|
||||
const createMutation = useCreateBranch()
|
||||
const updateMutation = useUpdateBranch()
|
||||
const isPending = createMutation.isPending || updateMutation.isPending
|
||||
|
||||
const [activeLang, setActiveLang] = useState<LangKey>('tk')
|
||||
|
||||
const schema = useMemo(() => createBranchFormSchema(t), [t, i18n.language])
|
||||
|
||||
const {
|
||||
@@ -312,7 +261,7 @@ export function BranchForm({ mode, initialData }: BranchFormProps) {
|
||||
clearErrors(key)
|
||||
}, [setValue, clearErrors])
|
||||
|
||||
const stepProps = useMemo(() => ({ form, errors, set, activeLang, setActiveLang }), [form, errors, set, activeLang])
|
||||
const stepProps = useMemo(() => ({ form, errors, set, t, lang }), [form, errors, set, t, lang])
|
||||
|
||||
const markVisited = (i: number) =>
|
||||
setVisited((prev) => new Set([...prev, i]))
|
||||
@@ -409,7 +358,7 @@ export function BranchForm({ mode, initialData }: BranchFormProps) {
|
||||
<div className="flex flex-col gap-5">
|
||||
<div className="flex flex-col gap-1">
|
||||
<h1 className="text-xl font-semibold text-foreground">
|
||||
{mode === 'create' ? t('branches.create.title', 'Şahamça döretmek') : t('branches.edit.title', 'Şahamçany üýtgetmek')}
|
||||
{mode === 'create' ? t('branches.createTitle', 'Şahamça döretmek') : t('branches.editTitle', 'Şahamçany üýtgetmek')}
|
||||
</h1>
|
||||
<p className="text-sm text-muted-foreground">
|
||||
{t('branches.form.subtitle', 'Ähli meýdanlary dolduryp, ädim-ädim öň geçiň.')}
|
||||
|
||||
@@ -25,12 +25,6 @@ interface CardPinFormProps {
|
||||
|
||||
// ─── Constants ────────────────────────────────────────────────────────────────
|
||||
|
||||
const STATUS_OPTIONS = [
|
||||
{ value: 'pending', label: 'Garaşylýar' },
|
||||
{ value: 'approved', label: 'Tassyklandy' },
|
||||
{ value: 'rejected', label: 'Ret edildi' },
|
||||
]
|
||||
|
||||
const CARD_TYPE_OPTIONS = [
|
||||
{ value: 'altyn_asyr', label: 'Altyn Asyr' },
|
||||
{ value: 'visa', label: 'Visa' },
|
||||
@@ -120,6 +114,12 @@ interface StepContentProps {
|
||||
// ─── Step panels ──────────────────────────────────────────────────────────────
|
||||
|
||||
function StepCard({ form, errors, set, t }: StepContentProps) {
|
||||
const STATUS_OPTIONS = useMemo(() => [
|
||||
{ value: 'pending', label: t('cardPin.status.pending', 'Garaşylýar') },
|
||||
{ value: 'approved', label: t('cardPin.status.approved', 'Tassyklandy') },
|
||||
{ value: 'rejected', label: t('cardPin.status.rejected', 'Ret edildi') },
|
||||
], [t])
|
||||
|
||||
return (
|
||||
<div className="space-y-4">
|
||||
<BentoGrid cols={2}>
|
||||
|
||||
@@ -109,8 +109,8 @@ export function CardReasonForm({ mode, initialData }: CardReasonFormProps) {
|
||||
<div className="flex flex-col gap-5">
|
||||
<h1 className="text-xl font-semibold text-foreground">
|
||||
{mode === 'create'
|
||||
? t('reasons.createTitle', 'Sebäp dörediň')
|
||||
: t('reasons.editTitle', 'Sebäp üýtgetmek')}
|
||||
? t('cardReasons.createTitle', 'Sebäp dörediň')
|
||||
: t('cardReasons.editTitle', 'Sebäp üýtgetmek')}
|
||||
</h1>
|
||||
<div>
|
||||
{/* Form rows */}
|
||||
@@ -118,23 +118,23 @@ export function CardReasonForm({ mode, initialData }: CardReasonFormProps) {
|
||||
{/* Name row */}
|
||||
<div className="grid grid-cols-[220px_1fr] items-start py-4 px-4 border-b border-border">
|
||||
<span className="text-sm text-muted-foreground pt-2">
|
||||
{t('CardReasons.fields.name', 'Ady')}
|
||||
{t('cardReasons.fields.name', 'Ady')}
|
||||
<span className="text-destructive ml-0.5">*</span>
|
||||
</span>
|
||||
<MultiLangInput fields={nameFields} placeholder={t('CardReasons.fields.name', 'Ady')} disabled={isPending} />
|
||||
<MultiLangInput fields={nameFields} placeholder={t('cardReasons.fields.name', 'Ady')} disabled={isPending} />
|
||||
</div>
|
||||
|
||||
{/* Value row */}
|
||||
<div className="grid grid-cols-[220px_1fr] items-center py-3 px-4 border-b border-border">
|
||||
<span className="text-sm text-muted-foreground">
|
||||
{t('CardReasons.fields.value', 'Baha')}
|
||||
{t('cardReasons.fields.value', 'Baha')}
|
||||
<span className="text-destructive ml-0.5">*</span>
|
||||
</span>
|
||||
<FormInput
|
||||
type="number"
|
||||
value={form.value}
|
||||
onChange={(v) => set('value', v)}
|
||||
placeholder={t('CardReasons.fields.value', 'Baha')}
|
||||
placeholder={t('cardReasons.fields.value', 'Baha')}
|
||||
error={errors.value}
|
||||
/>
|
||||
</div>
|
||||
@@ -142,20 +142,20 @@ export function CardReasonForm({ mode, initialData }: CardReasonFormProps) {
|
||||
{/* Description row */}
|
||||
<div className="grid grid-cols-[220px_1fr] items-center py-3 px-4 border-b border-border">
|
||||
<span className="text-sm text-muted-foreground">
|
||||
{t('CardReasons.fields.description', 'Bellikler')}
|
||||
{t('cardReasons.fields.description', 'Bellikler')}
|
||||
</span>
|
||||
<FormInput
|
||||
type="text"
|
||||
value={form.description}
|
||||
onChange={(v) => set('description', v)}
|
||||
placeholder={t('CardReasons.fields.description', 'Bellikler')}
|
||||
placeholder={t('cardReasons.fields.description', 'Bellikler')}
|
||||
/>
|
||||
</div>
|
||||
|
||||
{/* isActive row */}
|
||||
<div className="grid grid-cols-[220px_1fr] items-center py-3 px-4">
|
||||
<span className="text-sm text-muted-foreground">
|
||||
{t('CardReasons.fields.isActive', 'Işjeň')}
|
||||
{t('cardReasons.fields.isActive', 'Işjeň')}
|
||||
</span>
|
||||
<Checkbox
|
||||
checked={form.isActive}
|
||||
@@ -170,8 +170,8 @@ export function CardReasonForm({ mode, initialData }: CardReasonFormProps) {
|
||||
onCancel={() => navigate('/resources/card-states')}
|
||||
cancelVariant="ghost"
|
||||
submitLabel={mode === 'create'
|
||||
? t('CardReasons.actions.create', 'Kartyň çykarylmagynyň sebäbini döretdiň')
|
||||
: t('CardReasons.actions.update', 'Täzelemek')}
|
||||
? t('cardReasons.actions.create', 'Kartyň çykarylmagynyň sebäbini döretdiň')
|
||||
: t('cardReasons.actions.update', 'Täzelemek')}
|
||||
className="mt-6"
|
||||
/>
|
||||
</div>
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { useState, useCallback, useMemo, useEffect } from 'react'
|
||||
import { useCallback, useMemo, useEffect } from 'react'
|
||||
import { useNavigate } from 'react-router-dom'
|
||||
import { useTranslation } from 'react-i18next'
|
||||
import { useForm } from 'react-hook-form'
|
||||
@@ -6,6 +6,7 @@ import { zodResolver } from '@hookform/resolvers/zod'
|
||||
import { Checkbox } from '@/components/ui/checkbox'
|
||||
import { FormActions } from '@/components/formActions'
|
||||
import { FormInput } from '@/components/formInput'
|
||||
import { MultiLangInput } from '@/components/multiLangInput'
|
||||
import type { District } from '../api/districtsApi'
|
||||
import { useCreateDistrict, useUpdateDistrict } from '../hooks/useDistricts'
|
||||
import { createDistrictFormSchema, DEFAULT_FORM_VALUES, buildPayload } from '../schemas/district.schema'
|
||||
@@ -22,21 +23,11 @@ function flattenErrors(errors: Record<string, { message?: string } | undefined>)
|
||||
return result
|
||||
}
|
||||
|
||||
type FormErrors = FlatErrors
|
||||
|
||||
export interface DistrictFormProps {
|
||||
mode: 'create' | 'edit'
|
||||
initialData?: District
|
||||
}
|
||||
|
||||
type LangKey = 'tk' | 'ru' | 'en'
|
||||
|
||||
const LANG_TABS: { key: LangKey; label: string }[] = [
|
||||
{ key: 'tk', label: 'Türkmen' },
|
||||
{ key: 'ru', label: 'Русский' },
|
||||
{ key: 'en', label: 'English' },
|
||||
]
|
||||
|
||||
function mapInitial(data: District): DistrictFormData {
|
||||
return {
|
||||
nameTk: data.name.tk,
|
||||
@@ -72,8 +63,6 @@ export function DistrictForm({ mode, initialData }: DistrictFormProps) {
|
||||
const form = watch()
|
||||
const errors = useMemo(() => flattenErrors(rhfErrors as Record<string, { message?: string } | undefined>), [rhfErrors])
|
||||
|
||||
const [activeLang, setActiveLang] = useState<LangKey>('tk')
|
||||
|
||||
const set = useCallback(<K extends keyof DistrictFormData>(key: K) =>
|
||||
(value: DistrictFormData[K]) => {
|
||||
(setValue as (name: K, val: DistrictFormData[K]) => void)(key, value)
|
||||
@@ -104,11 +93,11 @@ export function DistrictForm({ mode, initialData }: DistrictFormProps) {
|
||||
}
|
||||
}
|
||||
|
||||
const nameFieldKey = `name${activeLang.charAt(0).toUpperCase() + activeLang.slice(1)}` as
|
||||
| 'nameTk'
|
||||
| 'nameRu'
|
||||
| 'nameEn'
|
||||
const nameErrorKey = nameFieldKey as keyof FormErrors
|
||||
const nameFields = {
|
||||
tk: { value: form.nameTk, onChange: set('nameTk'), error: errors.nameTk },
|
||||
ru: { value: form.nameRu, onChange: set('nameRu'), error: errors.nameRu },
|
||||
en: { value: form.nameEn, onChange: set('nameEn'), error: errors.nameEn },
|
||||
}
|
||||
|
||||
return (
|
||||
<div className="flex flex-col gap-5">
|
||||
@@ -118,36 +107,13 @@ export function DistrictForm({ mode, initialData }: DistrictFormProps) {
|
||||
: t('districts.editTitle', 'Etrap üýtgetmek')}
|
||||
</h1>
|
||||
<div>
|
||||
<div className="flex gap-3 justify-end mb-4">
|
||||
{LANG_TABS.map((tab) => (
|
||||
<button
|
||||
key={tab.key}
|
||||
type="button"
|
||||
onClick={() => setActiveLang(tab.key)}
|
||||
className={`text-sm transition-colors ${
|
||||
activeLang === tab.key
|
||||
? 'text-primary font-semibold underline underline-offset-4'
|
||||
: 'text-muted-foreground hover:text-foreground'
|
||||
}`}
|
||||
>
|
||||
{tab.label}
|
||||
</button>
|
||||
))}
|
||||
</div>
|
||||
|
||||
<div className="bg-card border border-border rounded-xl overflow-hidden">
|
||||
<div className="grid grid-cols-[220px_1fr] items-center py-3 px-4 border-b border-border">
|
||||
<span className="text-sm text-muted-foreground">
|
||||
<div className="grid grid-cols-[220px_1fr] items-start px-4 py-4 border-b border-border">
|
||||
<span className="text-sm text-muted-foreground pt-2">
|
||||
{t('districts.fields.name', 'Ady')}
|
||||
<span className="text-destructive ml-0.5">*</span>
|
||||
</span>
|
||||
<FormInput
|
||||
type="text"
|
||||
value={form[nameFieldKey]}
|
||||
onChange={set(nameFieldKey)}
|
||||
placeholder={t('districts.fields.name', 'Ady')}
|
||||
error={errors[nameErrorKey]}
|
||||
/>
|
||||
<MultiLangInput fields={nameFields} placeholder={t('districts.fields.name', 'Ady')} />
|
||||
</div>
|
||||
|
||||
<div className="grid grid-cols-[220px_1fr] items-center py-3 px-4 border-b border-border">
|
||||
|
||||
@@ -40,11 +40,7 @@ interface RequiredDocumentFormProps {
|
||||
|
||||
// ─── Lang tabs ────────────────────────────────────────────────────────────────
|
||||
|
||||
const LOCALES: { code: Locale; label: string }[] = [
|
||||
{ code: 'tk', label: 'Türkmen' },
|
||||
{ code: 'ru', label: 'Русский' },
|
||||
{ code: 'en', label: 'English' },
|
||||
]
|
||||
const LOCALES: Locale[] = ['tk', 'ru', 'en']
|
||||
|
||||
// ─── Tiptap Toolbar ───────────────────────────────────────────────────────────
|
||||
|
||||
@@ -148,9 +144,10 @@ interface LangTabsProps {
|
||||
}
|
||||
|
||||
function LangTabs({ active, onChange }: LangTabsProps) {
|
||||
const { t } = useTranslation()
|
||||
return (
|
||||
<div className="flex items-center justify-end gap-3 mb-2">
|
||||
{LOCALES.map(({ code, label }) => (
|
||||
{LOCALES.map((code) => (
|
||||
<button
|
||||
key={code}
|
||||
type="button"
|
||||
@@ -162,7 +159,7 @@ function LangTabs({ active, onChange }: LangTabsProps) {
|
||||
: 'text-muted-foreground hover:text-foreground'
|
||||
)}
|
||||
>
|
||||
{label}
|
||||
{t('languages.' + code, code === 'tk' ? 'Türkmen' : code === 'ru' ? 'Русский' : 'English')}
|
||||
</button>
|
||||
))}
|
||||
</div>
|
||||
@@ -326,9 +323,9 @@ export function RequiredDocumentForm({ mode, initialData }: RequiredDocumentForm
|
||||
error={errors[`name_${nameLang}`]}
|
||||
/>
|
||||
{/* Show errors for other locales as hints */}
|
||||
{LOCALES.filter((l) => l.code !== nameLang && errors[`name_${l.code}`]).map(({ code, label }) => (
|
||||
{LOCALES.filter((l) => l !== nameLang && errors[`name_${l}`]).map((code) => (
|
||||
<p key={code} className="mt-1 text-xs text-destructive/70">
|
||||
{label}: {errors[`name_${code}`]}
|
||||
{t('languages.' + code, code === 'tk' ? 'Türkmen' : code === 'ru' ? 'Русский' : 'English')}: {errors[`name_${code}`]}
|
||||
</p>
|
||||
))}
|
||||
</div>
|
||||
@@ -347,9 +344,9 @@ export function RequiredDocumentForm({ mode, initialData }: RequiredDocumentForm
|
||||
onChange={(val) => setDescription((prev) => ({ ...prev, [descLang]: val }))}
|
||||
error={errors[`desc_${descLang}`]}
|
||||
/>
|
||||
{LOCALES.filter((l) => l.code !== descLang && errors[`desc_${l.code}`]).map(({ code, label }) => (
|
||||
{LOCALES.filter((l) => l !== descLang && errors[`desc_${l}`]).map((code) => (
|
||||
<p key={code} className="mt-1 text-xs text-destructive/70">
|
||||
{label}: {errors[`desc_${code}`]}
|
||||
{t('languages.' + code, code === 'tk' ? 'Türkmen' : code === 'ru' ? 'Русский' : 'English')}: {errors[`desc_${code}`]}
|
||||
</p>
|
||||
))}
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user