feat(MED-97): fix occurance->occurrence in components, add missing translations

This commit is contained in:
2025-09-23 19:59:51 +03:00
parent 8af2c8710f
commit fb03d548af
11 changed files with 40 additions and 20 deletions

View File

@@ -20,7 +20,7 @@ const HealthBenefitFields = () => {
return ( return (
<div className="flex flex-col gap-3"> <div className="flex flex-col gap-3">
<FormField <FormField
name="occurance" name="occurrence"
render={({ field }) => ( render={({ field }) => (
<FormItem> <FormItem>
<FormLabel> <FormLabel>
@@ -30,20 +30,20 @@ const HealthBenefitFields = () => {
<Select {...field} onValueChange={field.onChange}> <Select {...field} onValueChange={field.onChange}>
<SelectTrigger> <SelectTrigger>
<SelectValue <SelectValue
placeholder={<Trans i18nKey="common:formField:occurance" />} placeholder={<Trans i18nKey="common:formField:occurrence" />}
/> />
</SelectTrigger> </SelectTrigger>
<SelectContent> <SelectContent>
<SelectGroup> <SelectGroup>
<SelectItem value="yearly"> <SelectItem value="yearly">
<Trans i18nKey="billing:occurance.yearly" /> <Trans i18nKey="billing:occurrence.yearly" />
</SelectItem> </SelectItem>
<SelectItem value="quarterly"> <SelectItem value="quarterly">
<Trans i18nKey="billing:occurance.quarterly" /> <Trans i18nKey="billing:occurrence.quarterly" />
</SelectItem> </SelectItem>
<SelectItem value="monthly"> <SelectItem value="monthly">
<Trans i18nKey="billing:occurance.monthly" /> <Trans i18nKey="billing:occurrence.monthly" />
</SelectItem> </SelectItem>
</SelectGroup> </SelectGroup>
</SelectContent> </SelectContent>

View File

@@ -39,13 +39,13 @@ const HealthBenefitForm = ({
resolver: zodResolver(UpdateHealthBenefitSchema), resolver: zodResolver(UpdateHealthBenefitSchema),
mode: 'onChange', mode: 'onChange',
defaultValues: { defaultValues: {
occurance: currentCompanyParams.benefit_occurance || 'yearly', occurrence: currentCompanyParams.benefit_occurance || 'yearly',
amount: currentCompanyParams.benefit_amount || 0, amount: currentCompanyParams.benefit_amount || 0,
}, },
}); });
const isDirty = form.formState.isDirty; const isDirty = form.formState.isDirty;
const onSubmit = (data: { occurance: string; amount: number }) => { const onSubmit = (data: { occurrence: string; amount: number }) => {
const promise = async () => { const promise = async () => {
setIsLoading(true); setIsLoading(true);
try { try {
@@ -53,7 +53,7 @@ const HealthBenefitForm = ({
setCurrentCompanyParams((prev) => ({ setCurrentCompanyParams((prev) => ({
...prev, ...prev,
benefit_amount: data.amount, benefit_amount: data.amount,
benefit_occurance: data.occurance, benefit_occurance: data.occurrence,
})); }));
} finally { } finally {
form.reset(data); form.reset(data);

View File

@@ -1,9 +1,9 @@
import { z } from 'zod'; import { z } from 'zod';
export const UpdateHealthBenefitSchema = z.object({ export const UpdateHealthBenefitSchema = z.object({
occurance: z occurrence: z
.string({ .string({
error: 'Occurance is required', error: 'Occurrence is required',
}) })
.nonempty(), .nonempty(),
amount: z.number({ error: 'Amount is required' }), amount: z.number({ error: 'Amount is required' }),

View File

@@ -267,7 +267,7 @@ export class TeamAccountsApi {
.schema('medreport') .schema('medreport')
.from('company_params') .from('company_params')
.update({ .update({
benefit_occurance: data.occurance, benefit_occurance: data.occurrence,
benefit_amount: data.amount, benefit_amount: data.amount,
updated_at: new Date().toISOString(), updated_at: new Date().toISOString(),
}) })

View File

@@ -1,5 +1,5 @@
export interface UpdateHealthBenefitData { export interface UpdateHealthBenefitData {
accountId: string; accountId: string;
occurance: string; occurrence: string;
amount: number; amount: number;
} }

View File

@@ -119,5 +119,25 @@
}, },
"cart": { "cart": {
"label": "Cart ({{ items }})" "label": "Cart ({{ items }})"
},
"pageTitle": "{{companyName}} budget",
"description": "Configure company budget..",
"saveChanges": "Save changes",
"healthBenefitForm": {
"title": "Health benefit form",
"description": "Company health benefit for employees",
"info": "* Taxes are added to the prices"
},
"occurrence": {
"yearly": "Yearly",
"quarterly": "Quarterly",
"monthly": "Monthly"
},
"expensesOverview": {
"title": "Expenses overview 2025",
"monthly": "Expense per employee per month *",
"yearly": "Maximum expense per employee per year *",
"total": "Maximum expense per {{employeeCount}} employee(s) per year *",
"sum": "Total"
} }
} }

View File

@@ -123,7 +123,7 @@
"city": "City", "city": "City",
"weight": "Weight", "weight": "Weight",
"height": "Height", "height": "Height",
"occurance": "Support frequency", "occurrence": "Support frequency",
"amount": "Amount", "amount": "Amount",
"selectDate": "Select date" "selectDate": "Select date"
}, },

View File

@@ -121,16 +121,16 @@
"label": "Cart ({{ items }})" "label": "Cart ({{ items }})"
}, },
"pageTitle": "{{companyName}} eelarve", "pageTitle": "{{companyName}} eelarve",
"description": "Vali kalendrist sobiv kuupäev ja broneeri endale vastuvõtuaeg.", "description": "Muuda ettevõtte eelarve seadistusi.",
"saveChanges": "Salvesta muudatused", "saveChanges": "Salvesta muudatused",
"healthBenefitForm": { "healthBenefitForm": {
"title": "Tervisetoetuse vorm", "title": "Tervisetoetuse vorm",
"description": "Ettevõtte Tervisekassa toetus töötajale", "description": "Ettevõtte Tervisekassa toetus töötajale",
"info": "* Hindadele lisanduvad riigipoolsed maksud" "info": "* Hindadele lisanduvad riigipoolsed maksud"
}, },
"occurance": { "occurrence": {
"yearly": "Kord aastas", "yearly": "Kord aastas",
"quarterly": "kord kvartalis", "quarterly": "Kord kvartalis",
"monthly": "Kord kuus" "monthly": "Kord kuus"
}, },
"expensesOverview": { "expensesOverview": {

View File

@@ -123,7 +123,7 @@
"city": "Linn", "city": "Linn",
"weight": "Kaal", "weight": "Kaal",
"height": "Pikkus", "height": "Pikkus",
"occurance": "Toetuse sagedus", "occurrence": "Toetuse sagedus",
"amount": "Summa", "amount": "Summa",
"selectDate": "Vali kuupäev" "selectDate": "Vali kuupäev"
}, },

View File

@@ -121,14 +121,14 @@
"label": "Корзина ({{ items }})" "label": "Корзина ({{ items }})"
}, },
"pageTitle": "Бюджет {{companyName}}", "pageTitle": "Бюджет {{companyName}}",
"description": "Выберите подходящую дату в календаре и запишитесь на прием.", "description": "Измените настройки бюджета компании.",
"saveChanges": "Сохранить изменения", "saveChanges": "Сохранить изменения",
"healthBenefitForm": { "healthBenefitForm": {
"title": "Форма здоровья", "title": "Форма здоровья",
"description": "Поддержка сотрудника из корпоративного фонда здоровья", "description": "Поддержка сотрудника из корпоративного фонда здоровья",
"info": "* К ценам добавляются государственные налоги" "info": "* К ценам добавляются государственные налоги"
}, },
"occurance": { "occurrence": {
"yearly": "Раз в год", "yearly": "Раз в год",
"quarterly": "Раз в квартал", "quarterly": "Раз в квартал",
"monthly": "Раз в месяц" "monthly": "Раз в месяц"

View File

@@ -123,7 +123,7 @@
"city": "Город", "city": "Город",
"weight": "Вес", "weight": "Вес",
"height": "Рост", "height": "Рост",
"occurance": "Частота поддержки", "occurrence": "Частота поддержки",
"amount": "Сумма", "amount": "Сумма",
"selectDate": "Выберите дату" "selectDate": "Выберите дату"
}, },