1
- import { Alert , BodyShort , Box , Button , Heading , ReadMore , Switch , VStack } from '@navikt/ds-react' ;
2
- import { useState } from 'react' ;
1
+ import { Alert , Box , Button , VStack } from '@navikt/ds-react' ;
3
2
import { getIntlFormErrorHandler , YesOrNo } from '@navikt/sif-common-formik-ds' ;
4
- import { DateRange , dateRangeFormatter , dateToISODate } from '@navikt/sif-common-utils' ;
3
+ import { DateRange , dateToISODate } from '@navikt/sif-common-utils' ;
5
4
import { Inntekt } from '@navikt/ung-common' ;
6
5
import { useAppIntl } from '../../../../i18n' ;
7
6
import { useRapporterInntekt } from '../../hooks/useRapporterInntekt' ;
8
7
import { getInntektFromFormValues , inntektFormComponents } from './inntektFormUtils' ;
9
8
import { InntektFormValues } from './types' ;
10
9
import InntektDefaultForm from './varianter/InntektDefaultForm' ;
11
- import InntektTableForm from './varianter/InntektTableForm' ;
12
10
import {
13
11
UngdomsytelseInntektsrapportering ,
14
12
zUngdomsytelseInntektsrapportering ,
@@ -17,27 +15,16 @@ import {
17
15
interface Props {
18
16
inntekt ?: Inntekt ;
19
17
periode : DateRange ;
20
- gjelderEndring ?: boolean ;
21
- variant ?: 'kompakt' | 'vanlig' ;
22
- kanEndreVariant ?: boolean ;
23
18
onCancel : ( ) => void ;
24
19
}
25
20
26
- const InntektForm = ( {
27
- periode,
28
- inntekt,
29
- gjelderEndring,
30
- variant = 'vanlig' ,
31
- kanEndreVariant = true ,
32
- onCancel,
33
- } : Props ) => {
21
+ const InntektForm = ( { periode, inntekt, onCancel } : Props ) => {
34
22
const { intl } = useAppIntl ( ) ;
35
23
const { error, inntektSendt, pending, rapporterInntekt } = useRapporterInntekt ( ) ;
36
- const [ kompakt , setKompakt ] = useState ( variant === 'kompakt' ) ;
37
24
const { FormikWrapper, Form } = inntektFormComponents ;
38
25
39
26
const handleSubmit = ( values : InntektFormValues ) => {
40
- const inntekt = getInntektFromFormValues ( values , kompakt ) ;
27
+ const inntekt = getInntektFromFormValues ( values , false ) ;
41
28
const data : UngdomsytelseInntektsrapportering = zUngdomsytelseInntektsrapportering . parse ( {
42
29
oppgittInntektForPeriode : {
43
30
periodeForInntekt : {
@@ -63,25 +50,6 @@ const InntektForm = ({
63
50
64
51
return (
65
52
< VStack gap = "6" >
66
- < VStack gap = "2" >
67
- { /* {kompakt ? null : ( */ }
68
- < Heading level = "2" size = "small" >
69
- Inntektskjema { gjelderEndring ? '(endring)' : null }
70
- </ Heading >
71
- { /* )} */ }
72
-
73
- { kanEndreVariant ? (
74
- < Switch
75
- size = "small"
76
- value = "kompakt"
77
- onChange = { ( evt ) => {
78
- setKompakt ( evt . target . checked ) ;
79
- } }
80
- checked = { kompakt } >
81
- Vis kompakt skjema
82
- </ Switch >
83
- ) : null }
84
- </ VStack >
85
53
{ inntektSendt ? (
86
54
< VStack gap = "8" >
87
55
< Alert variant = "success" > Inntekt for perioden er sendt</ Alert >
@@ -93,46 +61,21 @@ const InntektForm = ({
93
61
</ VStack >
94
62
) : (
95
63
< VStack gap = "8" >
96
- { ! kompakt ? (
97
- < VStack gap = "2" >
98
- < BodyShort >
99
- Spørsmålene nedenfor gjelder for perioden{ ' ' }
100
- { dateRangeFormatter . getDateRangeText ( periode , intl . locale ) } .
101
- </ BodyShort >
102
- < ReadMore header = "Les mer om inntekt" >
103
- Inntekten du skal oppgi er hva du har tjent i perioden. Dette er ikke det samme som hva
104
- du har fått utbetalt. Hvis du er usikker på hva du skal oppgi, kan du se på lønnsslippen
105
- din eller kontakte arbeidsgiveren din.
106
- </ ReadMore >
107
- </ VStack >
108
- ) : null }
109
-
110
64
< FormikWrapper
111
65
initialValues = { initialValues }
112
66
onSubmit = { handleSubmit }
113
67
renderForm = { ( { values } ) => {
114
68
return (
115
69
< Form
116
- submitButtonLabel = "Send inn inntekt"
70
+ submitButtonLabel = "Send inn"
71
+ showButtonArrows = { true }
117
72
onCancel = { onCancel }
118
73
cancelButtonLabel = "Avbryt"
119
74
includeValidationSummary = { true }
120
75
submitPending = { pending }
121
76
formErrorHandler = { getIntlFormErrorHandler ( intl , 'inntektForm.validation' ) } >
122
77
< VStack gap = "4" >
123
- { kompakt ? (
124
- < InntektTableForm inntekt = { getInntektFromFormValues ( values , true ) } />
125
- ) : (
126
- < InntektDefaultForm values = { values } periode = { periode } />
127
- ) }
128
-
129
- { inntekt ? (
130
- < Alert variant = "info" inline = { true } >
131
- Når du endrer inntekt på tidligere perioder, vil Lorem ipsum dolor sit
132
- amet consectetur adipisicing elit. Voluptas cumque quo sunt.
133
- </ Alert >
134
- ) : null }
135
-
78
+ < InntektDefaultForm values = { values } periode = { periode } />
136
79
{ error ? < Alert variant = "error" > { error } </ Alert > : null }
137
80
</ VStack >
138
81
</ Form >
0 commit comments