-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[TPO-67] Dato velger for oppfølging tab (#2303)
* [TPO-67] Dato velger for oppfølging tab * [TPO-67] Dato velger for oppfølging tab
- Loading branch information
Showing
14 changed files
with
2,056 additions
and
650 deletions.
There are no files selected for viewing
49 changes: 38 additions & 11 deletions
49
src/app/personside/infotabs/oppfolging/OppfolgingContainer.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 |
---|---|---|
@@ -1,19 +1,46 @@ | ||
import * as React from 'react'; | ||
import OppfolgingVisning from './OppfolgingVisningKomponent'; | ||
import { BigCenteredLazySpinner } from '../../../../components/BigCenteredLazySpinner'; | ||
import oppfolgingResource from '../../../../rest/resources/oppfolgingResource'; | ||
import AlertStripe from 'nav-frontend-alertstriper'; | ||
import { useAppState } from '../../../../utils/customHooks'; | ||
import OppfolgingFilter from './OppfolgingFilter'; | ||
import VisOppfolgingDetaljer from './OppfolgingDetaljerKomponent'; | ||
import SykefraversoppfolgingEkspanderbartPanel from './SykefraversoppfolgingEkspanderbartPanel'; | ||
import OppfolgingYtelserEkspanderbartPanel from './OppfolgingYtelserEkspanderbartPanel'; | ||
import styled from 'styled-components'; | ||
import theme from '../../../../styles/personOversiktTheme'; | ||
import { DetaljertOppfolging } from '../../../../models/oppfolging'; | ||
|
||
function OppfolgingContainer() { | ||
const oppfolging = oppfolgingResource.useFetch(); | ||
const OppfolgingStyle = styled.div` | ||
> *:not(:last-child) { | ||
margin-bottom: ${theme.margin.layout}; | ||
} | ||
padding: ${theme.margin.layout}; | ||
`; | ||
|
||
if (oppfolging.isLoading) { | ||
return BigCenteredLazySpinner; | ||
} else if (oppfolging.isError) { | ||
return <AlertStripe type="advarsel">Kunne ikke laste inn informasjon om brukers oppfølging</AlertStripe>; | ||
} else { | ||
return <OppfolgingVisning detaljertOppfolging={oppfolging.data} />; | ||
const DetaljertInfoWrapper = styled.div` | ||
display: flex; | ||
flex-direction: row; | ||
> *:last-child { | ||
margin-left: ${theme.margin.layout}; | ||
flex-basis: 75%; | ||
} | ||
`; | ||
|
||
function OppfolgingContainer() { | ||
const periode = useAppState((appState) => appState.oppfolging.periode); | ||
const fraTilDato = periode.egendefinertPeriode; | ||
const oppfolgingResponse = oppfolgingResource.useFetch(fraTilDato.fra, fraTilDato.til); | ||
const oppfolging = oppfolgingResponse.data as DetaljertOppfolging; | ||
|
||
return ( | ||
<OppfolgingStyle> | ||
<DetaljertInfoWrapper> | ||
<OppfolgingFilter /> | ||
<VisOppfolgingDetaljer detaljertOppfolging={oppfolging ?? {}} isError={oppfolgingResponse.isError} /> | ||
</DetaljertInfoWrapper> | ||
<SykefraversoppfolgingEkspanderbartPanel syfoPunkter={oppfolging?.sykefraværsoppfølging ?? []} /> | ||
<OppfolgingYtelserEkspanderbartPanel ytelser={oppfolging?.ytelser ?? []} /> | ||
</OppfolgingStyle> | ||
); | ||
} | ||
|
||
export default OppfolgingContainer; |
184 changes: 0 additions & 184 deletions
184
src/app/personside/infotabs/oppfolging/OppfolgingDatoKomponent.tsx
This file was deleted.
Oops, something went wrong.
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
70 changes: 70 additions & 0 deletions
70
src/app/personside/infotabs/oppfolging/OppfolgingFilter.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,70 @@ | ||
import * as React from 'react'; | ||
import styled from 'styled-components'; | ||
import { Undertittel } from 'nav-frontend-typografi'; | ||
import theme, { pxToRem } from '../../../../styles/personOversiktTheme'; | ||
import { settValgtPeriode } from '../../../../redux/oppfolging/actions'; | ||
import { useDispatch } from 'react-redux'; | ||
import { useCallback, useRef } from 'react'; | ||
import { guid } from 'nav-frontend-js-utils'; | ||
import Panel from 'nav-frontend-paneler'; | ||
import { useAppState } from '../../../../utils/customHooks'; | ||
import FiltreringPeriode from '../utbetalinger/filter/FilterPeriode'; | ||
import { PeriodeOptions } from '../../../../redux/utbetalinger/types'; | ||
|
||
const StyledPanel = styled(Panel)` | ||
padding: ${pxToRem(15)}; | ||
`; | ||
|
||
const TittelWrapper = styled.div` | ||
&:focus { | ||
outline: none; | ||
} | ||
margin-bottom: ${theme.margin.layout}; | ||
`; | ||
|
||
const InputPanel = styled.form` | ||
display: flex; | ||
flex-direction: column; | ||
margin-top: 1.5rem; | ||
> *:first-child { | ||
margin-bottom: 0.5rem; | ||
} | ||
> * { | ||
margin-top: 0.5rem; | ||
} | ||
.skjemaelement--horisontal { | ||
margin-bottom: 0.4rem; | ||
} | ||
`; | ||
|
||
function OppfolgingFilter() { | ||
const headerId = useRef(guid()); | ||
const dispatch = useDispatch(); | ||
const periode = useAppState((appState) => appState.oppfolging.periode); | ||
const updateFilter = useCallback( | ||
(change: PeriodeOptions) => { | ||
dispatch(settValgtPeriode(change)); | ||
}, | ||
[dispatch] | ||
); | ||
|
||
return ( | ||
<StyledPanel aria-labelledby={headerId.current}> | ||
<article> | ||
<TittelWrapper> | ||
<Undertittel id={headerId.current}>Oppfølging og ytelser vises for perioden:</Undertittel> | ||
</TittelWrapper> | ||
<InputPanel> | ||
<FiltreringPeriode | ||
periode={periode} | ||
updatePeriod={(change) => { | ||
updateFilter(change); | ||
}} | ||
/> | ||
</InputPanel> | ||
</article> | ||
</StyledPanel> | ||
); | ||
} | ||
|
||
export default OppfolgingFilter; |
43 changes: 0 additions & 43 deletions
43
src/app/personside/infotabs/oppfolging/OppfolgingVisningKomponent.tsx
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.