Skip to content

Commit

Permalink
fix: ask apprentishipProgram also for GRANTED_AGED (#2306)
Browse files Browse the repository at this point in the history
  • Loading branch information
mjturt authored Sep 28, 2023
1 parent 8cd3355 commit 47da9f1
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -460,6 +460,10 @@ const FormContent: React.FC<Props> = ({
fields.paySubsidyGranted.name,
PAY_SUBSIDY_GRANTED.GRANTED_AGED
);
formik.setFieldValue(
APPLICATION_FIELD_KEYS.APPRENTICESHIP_PROGRAM,
null
);
}}
checked={
formik.values.paySubsidyGranted ===
Expand All @@ -481,7 +485,10 @@ const FormContent: React.FC<Props> = ({
/>
</SelectionGroup>
</$GridCell>
{formik.values.paySubsidyGranted === PAY_SUBSIDY_GRANTED.GRANTED && (
{[
PAY_SUBSIDY_GRANTED.GRANTED,
PAY_SUBSIDY_GRANTED.GRANTED_AGED,
].includes(formik.values.paySubsidyGranted as PAY_SUBSIDY_GRANTED) && (
<$GridCell
as={$Grid}
$colSpan={12}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,11 @@ export const getValidationSchema = (
[APPLICATION_FIELD_KEYS.APPRENTICESHIP_PROGRAM]: Yup.boolean()
.nullable()
.when(APPLICATION_FIELD_KEYS.PAY_SUBSIDY_GRANTED, {
is: PAY_SUBSIDY_GRANTED.GRANTED,
is: (value: PAY_SUBSIDY_GRANTED) =>
[
PAY_SUBSIDY_GRANTED.GRANTED,
PAY_SUBSIDY_GRANTED.GRANTED_AGED,
].includes(value),
then: Yup.boolean()
.nullable()
.required(t(VALIDATION_MESSAGE_KEYS.REQUIRED)),
Expand Down

0 comments on commit 47da9f1

Please sign in to comment.