-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
1a51c2c
commit 2ca0580
Showing
8 changed files
with
100 additions
and
77 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
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
81 changes: 81 additions & 0 deletions
81
apps/ungdomsytelse-deltaker/src/apps/innsyn/components/Inntektsperiode.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 |
---|---|---|
@@ -0,0 +1,81 @@ | ||
import { Alert, BodyShort, Box, Button, Heading, ReadMore, VStack } from '@navikt/ds-react'; | ||
import { Rapporteringsperiode } from '../../../api/types'; | ||
import { dateFormatter } from '@navikt/sif-common-utils'; | ||
import { useState } from 'react'; | ||
import InntektForm from './inntekt-form/InntektForm'; | ||
import { FormattedNumber } from 'react-intl'; | ||
|
||
interface Props { | ||
deltakelseId: string; | ||
rapporteringsperiode: Rapporteringsperiode; | ||
} | ||
|
||
const Inntektsperiode = ({ rapporteringsperiode, deltakelseId }: Props) => { | ||
const { periode, fristForRapportering, harRapportert, kanEndre } = rapporteringsperiode; | ||
const [visSkjema, setVisSkjema] = useState(false); | ||
|
||
if (!fristForRapportering) { | ||
return <Alert variant="warning">FristForRapportering mangler</Alert>; | ||
} | ||
|
||
const månedNavn = dateFormatter.month(periode.from); | ||
const månedÅrNavn = dateFormatter.monthFullYear(periode.from); | ||
return ( | ||
<Box className="bg-deepblue-50 p-8 rounded-md"> | ||
<VStack gap="4"> | ||
<Heading level="2" size="medium"> | ||
Inntekt {månedÅrNavn} | ||
</Heading> | ||
{harRapportert ? ( | ||
<BodyShort> | ||
For {månedNavn} har du rapportert{' '} | ||
<strong> | ||
<FormattedNumber value={rapporteringsperiode.inntekt || 0} /> kroner | ||
</strong>{' '} | ||
i inntekt. | ||
</BodyShort> | ||
) : ( | ||
<BodyShort> | ||
Hvis du har inntekt i {månedNavn}, må du oppgi denne innen utgangen av{' '} | ||
<strong>{dateFormatter.dayDateMonth(fristForRapportering)}</strong>. Hvis du ikke har noe | ||
inntekt denne måneden, trenger du ikke melde fra. | ||
</BodyShort> | ||
)} | ||
<ReadMore header="Mer om inntekt, hva skal jeg ta med">Kort info</ReadMore> | ||
<Box className="mt-4"> | ||
{visSkjema ? ( | ||
<InntektForm | ||
gjelderEndring={harRapportert} | ||
deltakelseId={deltakelseId} | ||
periode={periode} | ||
onCancel={() => { | ||
setVisSkjema(false); | ||
}} | ||
/> | ||
) : ( | ||
<> | ||
{kanEndre || harRapportert === false ? ( | ||
<Button | ||
variant="primary" | ||
type="button" | ||
onClick={() => { | ||
setVisSkjema(true); | ||
}}> | ||
{harRapportert ? ( | ||
<>Endre inntekt for {månedNavn} </> | ||
) : ( | ||
<>Meld inn inntekt for {månedNavn} </> | ||
)} | ||
</Button> | ||
) : ( | ||
<>Du kan ikke endre inntekten for denne måneden enda</> | ||
)} | ||
</> | ||
)} | ||
</Box> | ||
</VStack> | ||
</Box> | ||
); | ||
}; | ||
|
||
export default Inntektsperiode; |
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
59 changes: 0 additions & 59 deletions
59
apps/ungdomsytelse-deltaker/src/apps/innsyn/components/ÅpenInntektsperiode.tsx
This file was deleted.
Oops, something went wrong.
10 changes: 6 additions & 4 deletions
10
apps/ungdomsytelse-deltaker/src/apps/innsyn/utils/deltakelseUtils.ts
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