diff --git a/frontend/benefit/applicant/public/locales/en/common.json b/frontend/benefit/applicant/public/locales/en/common.json index 69ec4f1399..b37627defb 100644 --- a/frontend/benefit/applicant/public/locales/en/common.json +++ b/frontend/benefit/applicant/public/locales/en/common.json @@ -362,6 +362,9 @@ "title": "Pay subsidy decision", "message": "Attach both issued pay subsidy decisions" }, + "paySubsidyDecisionAged": { + "title": "Decision for employment aid for people aged 55 and above" + }, "commissionContract": { "title": "Toimeksiantosopimus", "message": "" diff --git a/frontend/benefit/applicant/public/locales/fi/common.json b/frontend/benefit/applicant/public/locales/fi/common.json index e2c4b81c21..53fbbeb7be 100644 --- a/frontend/benefit/applicant/public/locales/fi/common.json +++ b/frontend/benefit/applicant/public/locales/fi/common.json @@ -362,6 +362,9 @@ "title": "Palkkatukipäätös", "message": "Liitä molemmat myönnetyt palkkatukipäätökset" }, + "paySubsidyDecisionAged": { + "title": "55 vuotta täyttäneiden työllistämistukipäätös" + }, "commissionContract": { "title": "Toimeksiantosopimus", "message": "" diff --git a/frontend/benefit/applicant/public/locales/sv/common.json b/frontend/benefit/applicant/public/locales/sv/common.json index 4eda5b864f..51f74ef03b 100644 --- a/frontend/benefit/applicant/public/locales/sv/common.json +++ b/frontend/benefit/applicant/public/locales/sv/common.json @@ -362,6 +362,9 @@ "title": "Beslut om lönesubvention", "message": "Bifoga båda besluten om beviljad lönesubvention" }, + "paySubsidyDecisionAged": { + "title": "Beslut om finansiella stöd för personer som är 55 år och äldre" + }, "commissionContract": { "title": "Toimeksiantosopimus", "message": "" diff --git a/frontend/benefit/applicant/src/components/applications/forms/application/step3/ApplicationFormStep3.tsx b/frontend/benefit/applicant/src/components/applications/forms/application/step3/ApplicationFormStep3.tsx index 6afae7ca58..6840cb8e7d 100644 --- a/frontend/benefit/applicant/src/components/applications/forms/application/step3/ApplicationFormStep3.tsx +++ b/frontend/benefit/applicant/src/components/applications/forms/application/step3/ApplicationFormStep3.tsx @@ -13,6 +13,18 @@ import StepperActions from '../stepperActions/StepperActions'; import AttachmentsList from './attachmentsList/AttachmentsList'; import { useApplicationFormStep3 } from './useApplicationFormStep3'; +const translationKeyForPaySubsidyAttachement = ( + paySubsidyGranted: PAY_SUBSIDY_GRANTED +): 'paySubsidyDecision' | 'paySubsidyDecisionAged' => { + if (paySubsidyGranted === PAY_SUBSIDY_GRANTED.GRANTED) { + return 'paySubsidyDecision'; + } + if (paySubsidyGranted === PAY_SUBSIDY_GRANTED.GRANTED_AGED) { + return 'paySubsidyDecisionAged'; + } + return 'paySubsidyDecision'; +}; + const ApplicationFormStep3: React.FC = ({ data, }) => { @@ -60,6 +72,9 @@ const ApplicationFormStep3: React.FC = ({ as="li" attachments={attachments} attachmentType={ATTACHMENT_TYPES.PAY_SUBSIDY_CONTRACT} + attachmentTypeTranslationKey={translationKeyForPaySubsidyAttachement( + paySubsidyGranted + )} showMessage={showSubsidyMessage} required /> diff --git a/frontend/benefit/applicant/src/components/applications/forms/application/step3/attachmentsList/AttachmentsList.tsx b/frontend/benefit/applicant/src/components/applications/forms/application/step3/attachmentsList/AttachmentsList.tsx index 0dcd2941b2..286572f97c 100644 --- a/frontend/benefit/applicant/src/components/applications/forms/application/step3/attachmentsList/AttachmentsList.tsx +++ b/frontend/benefit/applicant/src/components/applications/forms/application/step3/attachmentsList/AttachmentsList.tsx @@ -1,5 +1,6 @@ import { ATTACHMENT_TYPES } from 'benefit-shared/constants'; import camelCase from 'lodash/camelCase'; +import { TFunction } from 'next-i18next'; import * as React from 'react'; import AttachmentsListBase from 'shared/components/attachments/AttachmentsList'; import { BenefitAttachment } from 'shared/types/attachment'; @@ -8,14 +9,28 @@ import { useAttachmentsList } from './useAttachmentsList'; export type AttachmentsListProps = { attachmentType: ATTACHMENT_TYPES; + attachmentTypeTranslationKey?: string; showMessage?: boolean; attachments?: BenefitAttachment[]; required?: boolean; as?: 'div' | 'li'; }; +const getTitleTranslation = ( + t: TFunction, + translationsBase: string, + attachmentType: ATTACHMENT_TYPES, + attachmentTypeTranslationKey: string +): string => { + const key = attachmentTypeTranslationKey + ? String(attachmentTypeTranslationKey) + : attachmentType; + return t(`${translationsBase}.types.${camelCase(key)}.title`); +}; + const AttachmentsList: React.FC = ({ attachmentType, + attachmentTypeTranslationKey, showMessage = true, attachments, required, @@ -38,7 +53,12 @@ const AttachmentsList: React.FC = ({ return (