-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Oppdatert bestilling #deploy-test-frontend
- Loading branch information
Showing
8 changed files
with
117 additions
and
66 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
5 changes: 4 additions & 1 deletion
5
.../dolly-frontend/src/main/js/src/components/fagsystem/alderspensjon/form/initialValues.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,10 @@ | ||
import { addMonths, setDate } from 'date-fns' | ||
|
||
export const initialAlderspensjon = { | ||
kravFremsattDato: new Date(), | ||
iverksettelsesdato: setDate(addMonths(new Date(), 1), 1), | ||
saksbehandler: null, | ||
attesterer: null, | ||
uttaksgrad: 100, | ||
relasjoner: [{ sumAvForvArbKapPenInntekt: null }], | ||
navEnhetId: null, | ||
} |
31 changes: 16 additions & 15 deletions
31
apps/dolly-frontend/src/main/js/src/components/fagsystem/alderspensjon/form/validation.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,26 +1,27 @@ | ||
import { ifPresent, messages, requiredDate, requiredNumber } from '@/utils/YupValidations' | ||
import * as Yup from 'yup' | ||
import { isAfter } from 'date-fns' | ||
import { isAfter, isBefore } from 'date-fns' | ||
|
||
export const validation = { | ||
alderspensjon: ifPresent( | ||
'$pensjonforvalter.alderspensjon', | ||
Yup.object({ | ||
iverksettelsesdato: requiredDate.test( | ||
'er-fremtid', | ||
'Måned må være frem i tid', | ||
function validDate(iverksettelsesdato) { | ||
return isAfter(new Date(iverksettelsesdato), new Date()) | ||
}, | ||
), | ||
kravFremsattDato: Yup.date().nullable(), | ||
iverksettelsesdato: Yup.date() | ||
.test( | ||
'er-tid-fram', | ||
'Måned må etter være etter krav fremsatt dato', | ||
function validDate(iverksettelsesdato) { | ||
const kravFremsattDato = | ||
this.options.context?.pensjonforvalter?.alderspensjon?.kravFremsattDato | ||
return isAfter(new Date(iverksettelsesdato), new Date(kravFremsattDato)) | ||
}, | ||
) | ||
.nullable(), | ||
saksbehandler: Yup.string().nullable(), | ||
attesterer: Yup.string().nullable(), | ||
uttaksgrad: requiredNumber.typeError(messages.required), | ||
relasjoner: Yup.array().of( | ||
Yup.object({ | ||
sumAvForvArbKapPenInntekt: Yup.number() | ||
.transform((i, j) => (j === '' ? null : i)) | ||
.nullable(), | ||
}), | ||
), | ||
navEnhetId: Yup.string().nullable(), | ||
}), | ||
), | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters