Skip to content

Commit dea60c9

Browse files
committed
Validering i livets sluttfase
1 parent 0ee2fda commit dea60c9

File tree

3 files changed

+18
-6
lines changed

3 files changed

+18
-6
lines changed

apps/pleiepenger-i-livets-sluttfase-soknad/src/app/søknad/steps/legeerklæring/LegeerklæringForm.tsx

+9-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { VStack } from '@navikt/ds-react';
22
import React from 'react';
3-
import { FormikAttachmentForm, useAttachmentsHelper } from '@navikt/sif-common-core-ds';
3+
import { FormikAttachmentForm, getAttachmentsValidator, useAttachmentsHelper } from '@navikt/sif-common-core-ds';
44
import SifGuidePanel from '@navikt/sif-common-core-ds/src/components/sif-guide-panel/SifGuidePanel';
55
import { Attachment } from '@navikt/sif-common-core-ds/src/types/Attachment';
66
import { getTypedFormComponents } from '@navikt/sif-common-formik-ds';
@@ -33,13 +33,13 @@ const LegeerklæringForm: React.FunctionComponent<Props> = ({
3333
isSubmitting,
3434
}) => {
3535
const { text, intl } = useAppIntl();
36-
const { hasPendingUploads, maxTotalSizeExceeded } = useAttachmentsHelper(legeerklæringer, andreVedlegg);
36+
const { hasPendingUploads } = useAttachmentsHelper(legeerklæringer, andreVedlegg);
3737
return (
3838
<Form
3939
formErrorHandler={getIntlFormErrorHandler(intl, 'validation')}
4040
includeValidationSummary={true}
4141
submitPending={isSubmitting}
42-
submitDisabled={hasPendingUploads || maxTotalSizeExceeded}
42+
submitDisabled={hasPendingUploads}
4343
runDelayedFormValidation={true}
4444
onBack={goBack}>
4545
<VStack gap="6">
@@ -54,6 +54,12 @@ const LegeerklæringForm: React.FunctionComponent<Props> = ({
5454
otherAttachments={andreVedlegg}
5555
uploadLaterURL={getLenker(intl.locale).ettersend}
5656
onUnauthorizedOrForbiddenUpload={relocateToLoginPage}
57+
validate={getAttachmentsValidator(
58+
{
59+
useDefaultMessages: true,
60+
},
61+
andreVedlegg,
62+
)}
5763
labels={{
5864
addLabel: text('step.legeerklæring.vedlegg.knappLabel'),
5965
noAttachmentsText: text('vedleggsliste.ingenLegeerklæringLastetOpp'),

apps/pleiepenger-i-livets-sluttfase-soknad/src/app/søknad/steps/opplysninger-om-pleietrengende/OpplysningerOmPleietrengendeForm.tsx

+2-2
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ const OpplysningerOmPleietrengendeForm = ({ andreVedlegg, søker, isSubmitting,
6666

6767
const { setFieldValue, values } = useFormikContext<OpplysningerOmPleietrengendeFormValues>();
6868

69-
const { hasPendingUploads, maxTotalSizeExceeded } = useAttachmentsHelper(
69+
const { hasPendingUploads } = useAttachmentsHelper(
7070
values[OpplysningerOmPleietrengendeFormFields.pleietrengendeId],
7171
andreVedlegg,
7272
);
@@ -77,7 +77,7 @@ const OpplysningerOmPleietrengendeForm = ({ andreVedlegg, søker, isSubmitting,
7777
formErrorHandler={getIntlFormErrorHandler(intl, 'validation')}
7878
includeValidationSummary={true}
7979
submitPending={isSubmitting}
80-
submitDisabled={hasPendingUploads || isSubmitting || maxTotalSizeExceeded}
80+
submitDisabled={hasPendingUploads || isSubmitting}
8181
onBack={goBack}
8282
runDelayedFormValidation={true}>
8383
<SifGuidePanel>

apps/pleiepenger-i-livets-sluttfase-soknad/src/app/søknad/steps/opplysninger-om-pleietrengende/form-parts/IdPart.tsx

+7-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { FormikAttachmentForm } from '@navikt/sif-common-core-ds/src';
1+
import { FormikAttachmentForm, getAttachmentsValidator } from '@navikt/sif-common-core-ds/src';
22
import { Attachment } from '@navikt/sif-common-core-ds/src/types';
33
import { useAppIntl } from '../../../../i18n';
44
import getLenker from '../../../../lenker';
@@ -19,6 +19,12 @@ const IdPart = ({ andreVedlegg = [], pleietrengendeId = [] }: Props) => {
1919
otherAttachments={andreVedlegg}
2020
uploadLaterURL={getLenker(intl.locale).ettersend}
2121
onUnauthorizedOrForbiddenUpload={relocateToLoginPage}
22+
validate={getAttachmentsValidator(
23+
{
24+
useDefaultMessages: true,
25+
},
26+
andreVedlegg,
27+
)}
2228
labels={{
2329
addLabel: text('step.opplysningerOmPleietrengende.id.uploadButtonLabel'),
2430
noAttachmentsText: text('vedleggsliste.ingenDokumenter'),

0 commit comments

Comments
 (0)