-
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.
Det skal være mulig å kun gjenbruke ett bestemt inngangsvilkår i stedet for alle sammen. Når en vilkårsvurdering er tom skal gjenbruk automatisk lagre. Hvis en vilkårsvurdering har innhold skal en modal vises hvor man må bekrefte gjenbruk. Skal ikke å vise hvilken behandling som blir gjenbrukt. Skal kun vises kanpp for gjenbruk hvis det finnes noe å gjenbruke. --------- Co-authored-by: throndi <[email protected]>
- Loading branch information
1 parent
1efe893
commit 99929b5
Showing
13 changed files
with
243 additions
and
287 deletions.
There are no files selected for viewing
37 changes: 37 additions & 0 deletions
37
src/frontend/App/hooks/useHentGjenbrukbareVilkårsvurderinger.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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
import { useCallback, useState } from 'react'; | ||
import { RessursStatus } from '../typer/ressurs'; | ||
import { useApp } from '../context/AppContext'; | ||
|
||
interface Props { | ||
gjenbrukbareVilkårsvurderinger: string[]; | ||
hentAlleGjenbrukbareVilkårsvurderinger: (behandlingId: string) => void; | ||
} | ||
|
||
export const useHentGjenbrukbareVilkårsvurderinger = (): Props => { | ||
const [gjenbrukbareVilkårsvurderinger, settGjenbrukbareVilkårsvurderinger] = useState<string[]>( | ||
[] | ||
); | ||
|
||
const { axiosRequest } = useApp(); | ||
|
||
const hentAlleGjenbrukbareVilkårsvurderinger = useCallback( | ||
(behandlingId: string): void => { | ||
axiosRequest<string[], void>({ | ||
method: 'GET', | ||
url: `/familie-ef-sak/api/vurdering/${behandlingId}/gjenbrukbare-vilkar`, | ||
}).then((respons) => { | ||
if (respons.status === RessursStatus.SUKSESS) { | ||
settGjenbrukbareVilkårsvurderinger(respons.data); | ||
} else { | ||
settGjenbrukbareVilkårsvurderinger([]); | ||
} | ||
}); | ||
}, | ||
[axiosRequest] | ||
); | ||
|
||
return { | ||
gjenbrukbareVilkårsvurderinger, | ||
hentAlleGjenbrukbareVilkårsvurderinger, | ||
}; | ||
}; |
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
59 changes: 59 additions & 0 deletions
59
src/frontend/Komponenter/Behandling/Inngangsvilkår/InngangsvilkårHeader.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,59 @@ | ||
import React from 'react'; | ||
import styled from 'styled-components'; | ||
import { OppdaterOpplysninger } from './OppdaterOpplysninger'; | ||
import { ÅpneOgLukkePanelKnapper } from './ÅpneOgLukkePanelKnapper'; | ||
import { | ||
EVilkårstyper, | ||
useEkspanderbareVilkårpanelContext, | ||
} from '../../../App/context/EkspanderbareVilkårpanelContext'; | ||
|
||
const FlexRow = styled.div` | ||
margin: 2rem; | ||
display: flex; | ||
justify-content: space-between; | ||
`; | ||
|
||
const FlexColumn = styled.div` | ||
display: flex; | ||
flex-direction: column; | ||
gap: 1rem; | ||
`; | ||
|
||
const AlignBottom = styled.div` | ||
align-self: end; | ||
`; | ||
|
||
interface Props { | ||
oppdatertDato: string; | ||
behandlingErRedigerbar: boolean; | ||
oppdaterGrunnlagsdata: (behandlingId: string) => Promise<void>; | ||
behandlingId: string; | ||
} | ||
|
||
export const InngangsvilkårHeader: React.FC<Props> = ({ | ||
oppdatertDato, | ||
behandlingErRedigerbar, | ||
oppdaterGrunnlagsdata, | ||
behandlingId, | ||
}) => { | ||
const { lukkAlle, åpneAlle } = useEkspanderbareVilkårpanelContext(); | ||
|
||
return ( | ||
<FlexRow> | ||
<FlexColumn> | ||
<OppdaterOpplysninger | ||
oppdatertDato={oppdatertDato} | ||
behandlingErRedigerbar={behandlingErRedigerbar} | ||
oppdaterGrunnlagsdata={oppdaterGrunnlagsdata} | ||
behandlingId={behandlingId} | ||
/> | ||
</FlexColumn> | ||
<AlignBottom> | ||
<ÅpneOgLukkePanelKnapper | ||
lukkAlle={() => lukkAlle(EVilkårstyper.INNGANGSVILKÅR)} | ||
åpneAlle={() => åpneAlle(EVilkårstyper.INNGANGSVILKÅR)} | ||
/> | ||
</AlignBottom> | ||
</FlexRow> | ||
); | ||
}; |
101 changes: 0 additions & 101 deletions
101
...ntend/Komponenter/Behandling/Inngangsvilkår/InngangsvilkårHeader/InngangsvilkårHeader.tsx
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.