-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Gjort en del refaktorering. Tatt ut kode til komponenter. Komponenten…
… HistorikkIEfKort er tenkt at skal være generell og utvides i fremtiden med f.eks. skolepenger og barnetilsyn.
- Loading branch information
1 parent
2e81aa6
commit 28f652f
Showing
8 changed files
with
211 additions
and
170 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
67 changes: 67 additions & 0 deletions
67
src/frontend/Komponenter/Behandling/TidligereVedtaksperioder/HistorikkIEfKort.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,67 @@ | ||
import React from 'react'; | ||
import { IGrunnlagsdataPeriodeHistorikk } from './typer'; | ||
import styled from 'styled-components'; | ||
import { BodyShort, Heading, Label } from '@navikt/ds-react'; | ||
import HistorikkRad from './HistorikkRad'; | ||
import { Stønadstype } from '../../../App/typer/behandlingstema'; | ||
|
||
const Container = styled.div` | ||
display: flex; | ||
flex-direction: column; | ||
gap: 1rem; | ||
background: #f3fcf5; | ||
padding: 1rem; | ||
border: 1px solid rgba(0, 0, 0, 0.19); | ||
border-radius: 6px; | ||
text-align: left; | ||
`; | ||
|
||
const Tittel = styled(Heading)` | ||
text-decoration: underline; | ||
`; | ||
|
||
const Grid = styled.div` | ||
display: grid; | ||
grid-template-columns: auto auto auto auto; | ||
gap: 0.2rem; | ||
`; | ||
|
||
const Row = styled.div` | ||
display: contents; | ||
`; | ||
|
||
const HistorikkIEfKort: React.FC<{ | ||
historikkISak: IGrunnlagsdataPeriodeHistorikk[] | undefined; | ||
stønadstype: string; | ||
}> = ({ historikkISak, stønadstype }) => { | ||
const erOvergansstønad = stønadstype === Stønadstype.OVERGANGSSTØNAD; | ||
|
||
return ( | ||
<> | ||
{historikkISak && ( | ||
<Container> | ||
<Tittel level="3" size="small"> | ||
Historikk i EF Sak | ||
</Tittel> | ||
{erOvergansstønad && historikkISak?.length > 0 ? ( | ||
<Grid> | ||
<Row> | ||
<Label>Periode</Label> | ||
<Label>Periodetype</Label> | ||
<Label>Måneder innvilget</Label> | ||
<Label>Har 0 beløp</Label> | ||
</Row> | ||
{historikkISak?.map((rad, i) => ( | ||
<HistorikkRad key={i} rad={rad} index={i} /> | ||
))} | ||
</Grid> | ||
) : ( | ||
<BodyShort size="small">Kan ikke vise tidligere historikk.</BodyShort> | ||
)} | ||
</Container> | ||
)} | ||
</> | ||
); | ||
}; | ||
|
||
export default HistorikkIEfKort; |
33 changes: 33 additions & 0 deletions
33
src/frontend/Komponenter/Behandling/TidligereVedtaksperioder/HistorikkIInfotrygdKort.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,33 @@ | ||
import React from 'react'; | ||
import { BodyShort, Heading } from '@navikt/ds-react'; | ||
import styled from 'styled-components'; | ||
|
||
const Tittel = styled(Heading)` | ||
text-decoration: underline; | ||
`; | ||
|
||
const Container = styled.div` | ||
display: flex; | ||
flex-direction: column; | ||
gap: 1rem; | ||
background: #f3fcf5; | ||
padding: 1rem; | ||
border: 1px solid rgba(0, 0, 0, 0.19); | ||
border-radius: 6px; | ||
text-align: left; | ||
`; | ||
|
||
const HistorikkIInfotrygdKort: React.FC = () => { | ||
return ( | ||
<Container> | ||
<Tittel level="3" size="small"> | ||
Historikk i Infotrygd | ||
</Tittel> | ||
<BodyShort size="small"> | ||
Bruker har historikk i Infotrygd som må sjekkes manuelt. | ||
</BodyShort> | ||
</Container> | ||
); | ||
}; | ||
|
||
export default HistorikkIInfotrygdKort; |
41 changes: 41 additions & 0 deletions
41
src/frontend/Komponenter/Behandling/TidligereVedtaksperioder/HistorikkRad.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,41 @@ | ||
import React from 'react'; | ||
import { BodyShort, Tag } from '@navikt/ds-react'; | ||
import { periodetypeTilTekst, EPeriodetype } from '../../../App/typer/vedtak'; | ||
import { formaterIsoDato } from '../../../App/utils/formatter'; | ||
import { etikettTypeOvergangsstønad } from '../../Personoversikt/HistorikkVedtaksperioder/vedtakshistorikkUtil'; | ||
import { IGrunnlagsdataPeriodeHistorikk } from './typer'; | ||
import styled from 'styled-components'; | ||
|
||
interface HistorikkRadProps { | ||
rad: IGrunnlagsdataPeriodeHistorikk; | ||
index: number; | ||
} | ||
|
||
const Row = styled.div` | ||
display: contents; | ||
`; | ||
|
||
const HistorikkRad: React.FC<HistorikkRadProps> = ({ rad, index }) => { | ||
return ( | ||
<Row key={index}> | ||
<BodyShort size="small"> | ||
{`${formaterIsoDato(rad.fom)} | ||
- | ||
${formaterIsoDato(rad.tom)}`} | ||
</BodyShort> | ||
<div> | ||
<Tag variant={etikettTypeOvergangsstønad(rad.vedtaksperiodeType)} size={'small'}> | ||
{periodetypeTilTekst[rad.vedtaksperiodeType || '']} | ||
</Tag> | ||
</div> | ||
<BodyShort size="small">{rad.antallMåneder}</BodyShort> | ||
<BodyShort size="small"> | ||
{rad.antallMånederUtenBeløp >= 1 && rad.vedtaksperiodeType !== EPeriodetype.SANKSJON | ||
? `ja (${rad.antallMånederUtenBeløp})` | ||
: '-'} | ||
</BodyShort> | ||
</Row> | ||
); | ||
}; | ||
|
||
export default HistorikkRad; |
97 changes: 0 additions & 97 deletions
97
src/frontend/Komponenter/Behandling/TidligereVedtaksperioder/OSHistorikKort.tsx
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.