-
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.
Sende brev uten fagsak/journalpost (#2779)
* La til brev i behandlet jp * valg av tema fix
- Loading branch information
1 parent
9f013cb
commit 469ee97
Showing
7 changed files
with
128 additions
and
2 deletions.
There are no files selected for viewing
63 changes: 63 additions & 0 deletions
63
src/app/brev-behandlet-journalpost/SendBrevBehandletJp.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,63 @@ | ||
import React, { useEffect } from 'react'; | ||
|
||
import { FormattedMessage } from 'react-intl'; | ||
import { useSelector } from 'react-redux'; | ||
import { useLocation, useNavigate } from 'react-router-dom'; | ||
import { Heading } from '@navikt/ds-react'; | ||
|
||
import { RootStateType } from 'app/state/RootState'; | ||
import { ROUTES } from 'app/constants/routes'; | ||
import BrevComponent from 'app/components/brev/BrevComponent'; | ||
import { getForkortelseFraFordelingDokumenttype } from 'app/utils'; | ||
|
||
import './sendBrevBehandletJp.less'; | ||
|
||
const SendBrevBehandletJp: React.FC = () => { | ||
const navigate = useNavigate(); | ||
|
||
const location = useLocation(); | ||
|
||
const journalpost = useSelector((state: RootStateType) => state.felles.journalpost); | ||
const fordelingState = useSelector((state: RootStateType) => state.fordelingState); | ||
|
||
// Redirect tilbake ved side reload | ||
useEffect(() => { | ||
if (!journalpost) { | ||
navigate(location.pathname.replace(ROUTES.BREV_BEHANDLET_JP, '')); | ||
} | ||
}, []); | ||
|
||
if (!journalpost) { | ||
return null; | ||
} | ||
|
||
const { journalpostId, sak, norskIdent } = journalpost; | ||
|
||
const forkortelseFraFordelingDokumenttype = fordelingState.dokumenttype | ||
? getForkortelseFraFordelingDokumenttype(fordelingState.dokumenttype) | ||
: undefined; | ||
|
||
const sakstype = sak?.sakstype || forkortelseFraFordelingDokumenttype; | ||
|
||
if (!norskIdent || !sakstype) { | ||
return null; | ||
} | ||
|
||
return ( | ||
<div className="sendBrevBehandletJp"> | ||
<Heading size="small" level="1"> | ||
<FormattedMessage id="sendBrevBehandletJournalpost.header" /> | ||
</Heading> | ||
|
||
<BrevComponent | ||
søkerId={norskIdent} | ||
sakstype={sakstype} | ||
fagsakId={sak?.fagsakId || 'GENERELL_SAK'} | ||
journalpostId={journalpostId} | ||
tilbake={true} | ||
/> | ||
</div> | ||
); | ||
}; | ||
|
||
export default SendBrevBehandletJp; |
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,7 @@ | ||
.sendBrevBehandletJp { | ||
margin-top: 2.5rem; | ||
|
||
.submitButton.navds-button { | ||
margin-top: 0.5rem; | ||
} | ||
} |
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
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