diff --git a/backend/benefit/calculator/rules.py b/backend/benefit/calculator/rules.py index 853f6db4ba..5446f84036 100644 --- a/backend/benefit/calculator/rules.py +++ b/backend/benefit/calculator/rules.py @@ -106,8 +106,13 @@ def get_item_in_effect( training_compensation, ) ) - assert ranges[0].start_date == self.calculation.start_date - assert ranges[-1].end_date == self.calculation.end_date + + if ( + ranges[-1].end_date != self.calculation.end_date + or ranges[0].start_date != self.calculation.start_date + ): + raise ValueError("Error in range of calculation.start_date / end_date") + return ranges def get_amount(self, row_type: RowType, default=None): diff --git a/frontend/benefit/handler/public/locales/en/common.json b/frontend/benefit/handler/public/locales/en/common.json index cbabf87258..99a6ffa9ab 100644 --- a/frontend/benefit/handler/public/locales/en/common.json +++ b/frontend/benefit/handler/public/locales/en/common.json @@ -862,6 +862,10 @@ "monthlyAmount": { "label": "Koulutuskorvaus", "placeholder": "Koulutuskorvaus € / kk" + }, + "unknownField": { + "label": "Tunnistamaton kenttä", + "placeholder": "" } }, "notifications": { @@ -920,6 +924,11 @@ "header": "Myönnettävä Helsinki-lisä", "header2": "Arvio koostuu seuraavista tiedoista:", "acceptedBenefit": "Myönnettävä Helsinki-lisä" + }, + "errors": { + "trainingCompensation": { + "invalid": "Koulutuskorvausrivin syöttö on vielä kesken. Lisää rivi laskelmaan." + } } }, "organizationTypes": { diff --git a/frontend/benefit/handler/public/locales/fi/common.json b/frontend/benefit/handler/public/locales/fi/common.json index a81a91f7ae..4009647d1e 100644 --- a/frontend/benefit/handler/public/locales/fi/common.json +++ b/frontend/benefit/handler/public/locales/fi/common.json @@ -862,6 +862,10 @@ "monthlyAmount": { "label": "Koulutuskorvaus", "placeholder": "Koulutuskorvaus € / kk" + }, + "unknownField": { + "label": "Tunnistamaton kenttä", + "placeholder": "" } }, "notifications": { @@ -920,6 +924,11 @@ "header": "Myönnettävä Helsinki-lisä", "header2": "Arvio koostuu seuraavista tiedoista:", "acceptedBenefit": "Myönnettävä Helsinki-lisä" + }, + "errors": { + "trainingCompensation": { + "invalid": "Koulutuskorvausrivin syöttö on vielä kesken. Lisää rivi laskelmaan." + } } }, "organizationTypes": { diff --git a/frontend/benefit/handler/public/locales/sv/common.json b/frontend/benefit/handler/public/locales/sv/common.json index cbabf87258..99a6ffa9ab 100644 --- a/frontend/benefit/handler/public/locales/sv/common.json +++ b/frontend/benefit/handler/public/locales/sv/common.json @@ -862,6 +862,10 @@ "monthlyAmount": { "label": "Koulutuskorvaus", "placeholder": "Koulutuskorvaus € / kk" + }, + "unknownField": { + "label": "Tunnistamaton kenttä", + "placeholder": "" } }, "notifications": { @@ -920,6 +924,11 @@ "header": "Myönnettävä Helsinki-lisä", "header2": "Arvio koostuu seuraavista tiedoista:", "acceptedBenefit": "Myönnettävä Helsinki-lisä" + }, + "errors": { + "trainingCompensation": { + "invalid": "Koulutuskorvausrivin syöttö on vielä kesken. Lisää rivi laskelmaan." + } } }, "organizationTypes": { diff --git a/frontend/benefit/handler/src/components/applicationReview/salaryBenefitCalculatorView/SalaryBenefitCalculatorView.tsx b/frontend/benefit/handler/src/components/applicationReview/salaryBenefitCalculatorView/SalaryBenefitCalculatorView.tsx index 3b19c3f16b..e661c18ddb 100644 --- a/frontend/benefit/handler/src/components/applicationReview/salaryBenefitCalculatorView/SalaryBenefitCalculatorView.tsx +++ b/frontend/benefit/handler/src/components/applicationReview/salaryBenefitCalculatorView/SalaryBenefitCalculatorView.tsx @@ -2,6 +2,7 @@ import ReviewSection from 'benefit/handler/components/reviewSection/ReviewSectio import { CALCULATION_TYPES } from 'benefit/handler/constants'; import { useCalculatorData } from 'benefit/handler/hooks/useCalculatorData'; import { SalaryBenefitCalculatorViewProps } from 'benefit/handler/types/application'; +import { PAY_SUBSIDY_GRANTED } from 'benefit-shared/constants'; import { PaySubsidy } from 'benefit-shared/types/application'; import { Button, @@ -179,16 +180,23 @@ const SalaryBenefitCalculatorView: React.FC< /> - <$GridCell $colStart={1} $colSpan={11}> - <$CalculatorHeader> - {t(`${translationsBase}.subsidies`)} - - - {formik.values.paySubsidies && ( + {formik.values.paySubsidies?.length > 0 && ( <$GridCell $colStart={1} $colSpan={11}> -

- {t(`${translationsBase}.paySubsidy`)} -

+ <$CalculatorHeader as="div"> +

+ {t(`${translationsBase}.subsidies`)} +

+ <$ViewField> + + {t(`${translationsBase}.paySubsidy`)}{' '} + {data.paySubsidyGranted === PAY_SUBSIDY_GRANTED.GRANTED_AGED + ? `(${t( + 'applications.sections.fields.paySubsidyGranted.grantedAged' + )})` + : null} + + + )} {formik.values.paySubsidies?.map( @@ -607,6 +615,15 @@ const SalaryBenefitCalculatorView: React.FC< $colSpan={11} style={{ marginTop: 'var(--spacing-xs)' }} > + <$ViewField + css={` + color: ${theme.colors.brick}; + `} + > + {isDisabledAddTrainingCompensationButton === false && + t('common:calculators.errors.trainingCompensation.invalid')} + +