-
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.
Merge pull request #2544 from navikt/ny-kontaktinfo
Personlinje: Kontaktinfo seksjon
- Loading branch information
Showing
18 changed files
with
758 additions
and
17 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,141 @@ | ||
import { Chat2Icon, GlassesIcon, PencilIcon, PersonEnvelopeIcon } from '@navikt/aksel-icons'; | ||
import { BodyShort, HelpText, ReadMore, Table } from '@navikt/ds-react'; | ||
import { Feilmelding, Normaltekst, Undertekst } from 'nav-frontend-typografi'; | ||
import { usePersonData } from 'src/lib/clients/modiapersonoversikt-api'; | ||
import type { OmraadeMedHandling, PersonData } from 'src/lib/types/modiapersonoversikt-api'; | ||
import { formaterMobiltelefonnummer } from 'src/utils/telefon-utils'; | ||
import ValidPeriod from '../common/ValidPeriod'; | ||
import { hentNavn } from '../utils'; | ||
import { harFeilendeSystemer } from '../utils'; | ||
import { Group, InfoElement } from './components'; | ||
|
||
type Fullmakt = PersonData['fullmakt'][number]; | ||
type DigitalKontaktTredjepart = PersonData['fullmakt'][0]['digitalKontaktinformasjonTredjepartsperson']; | ||
|
||
function KontaktinformasjonFullmakt(props: { | ||
kontaktinformasjon?: DigitalKontaktTredjepart; | ||
}) { | ||
if (!props.kontaktinformasjon) { | ||
return null; | ||
} | ||
|
||
const erReservert = props.kontaktinformasjon.reservasjon === 'true'; | ||
const mobilnummer = formaterMobiltelefonnummer( | ||
props.kontaktinformasjon.mobiltelefonnummer ?? 'Fant ikke telefonnummer' | ||
); | ||
|
||
return ( | ||
<> | ||
<BodyShort>Telefon: {erReservert ? 'Reservert' : mobilnummer}</BodyShort> | ||
<BodyShort size="small" textColor="subtle"> | ||
<Undertekst>I Kontakt- og reservasjonsregisteret</Undertekst> | ||
</BodyShort> | ||
</> | ||
); | ||
} | ||
const FullmaktTilgangerTabell = ({ | ||
omraader | ||
}: { | ||
omraader: OmraadeMedHandling[]; | ||
}) => { | ||
if (omraader.map((omrade) => omrade.omraade.kode).includes('*')) { | ||
return 'Gjelder alle statlige ytelser'; | ||
} | ||
|
||
return ( | ||
<Table size="small"> | ||
<Table.Header> | ||
<Table.Row> | ||
<Table.HeaderCell scope="col">Område</Table.HeaderCell> | ||
<Table.HeaderCell scope="col"> | ||
<HelpText title="Hva betyr lese/innsyn?"> | ||
Fullmektig kan lese dokumenter på de områdene det er gitt fullmakt til | ||
</HelpText> | ||
</Table.HeaderCell> | ||
<Table.HeaderCell scope="col"> | ||
<HelpText title="Hva betyr snakke/kommunisere?"> | ||
Fullmektig kan snakke med NAV og hjelpe til i kontakten med NAV, både på telefon, nav.no og | ||
NAV-kontor. Tilgangen innebærer at fullmektig også kan lese dokumenter i sakene | ||
</HelpText> | ||
</Table.HeaderCell> | ||
<Table.HeaderCell scope="col"> | ||
<HelpText title="Hva betyr Søke/klage?"> | ||
Fullmektig kan søke og klage. Tilgangen innebærer at fullmektig også kan lese dokumenter og | ||
snakke med NAV | ||
</HelpText> | ||
</Table.HeaderCell> | ||
</Table.Row> | ||
</Table.Header> | ||
<Table.Body> | ||
{omraader.map((o) => { | ||
const les = o.handling.find((h) => h === 'LES'); | ||
const kommuniser = o.handling.find((h) => h === 'KOMMUNISER'); | ||
const skriv = o.handling.find((h) => h === 'SKRIV'); | ||
return ( | ||
<Table.Row key={o.omraade.kode}> | ||
<Table.DataCell>{o.omraade.beskrivelse}</Table.DataCell> | ||
<Table.DataCell>{les && <GlassesIcon title="Lese/innsyn" />}</Table.DataCell> | ||
<Table.DataCell>{kommuniser && <Chat2Icon title="Snakke/kommunisere" />}</Table.DataCell> | ||
<Table.DataCell>{skriv && <PencilIcon title="Søke/klage" />}</Table.DataCell> | ||
</Table.Row> | ||
); | ||
})} | ||
</Table.Body> | ||
</Table> | ||
); | ||
}; | ||
|
||
function Fullmakt(props: { fullmakt: Fullmakt; harFeilendeSystem: boolean }) { | ||
const motpartsPersonNavn = hentNavn(props.fullmakt.motpartsPersonNavn); | ||
const beskrivelse = props.fullmakt.motpartsRolle === 'FULLMEKTIG' ? 'Fullmektig' : 'Fullmaktsgiver'; | ||
const harFeilendeSystem = props.harFeilendeSystem ? <Feilmelding>Feilet ved uthenting av navn</Feilmelding> : null; | ||
|
||
return ( | ||
<InfoElement title={beskrivelse}> | ||
{harFeilendeSystem} | ||
<Normaltekst> | ||
{motpartsPersonNavn} {`(${props.fullmakt.motpartsPersonident})`} | ||
</Normaltekst> | ||
<KontaktinformasjonFullmakt | ||
kontaktinformasjon={props.fullmakt.digitalKontaktinformasjonTredjepartsperson} | ||
/> | ||
<ValidPeriod | ||
from={props.fullmakt.gyldighetsPeriode?.gyldigFraOgMed} | ||
to={props.fullmakt.gyldighetsPeriode?.gyldigTilOgMed} | ||
/> | ||
<ReadMore header="Detaljer"> | ||
<FullmaktTilgangerTabell omraader={props.fullmakt.omrade} /> | ||
</ReadMore> | ||
</InfoElement> | ||
); | ||
} | ||
|
||
function Fullmakter() { | ||
const { | ||
data: { person, feilendeSystemer } | ||
} = usePersonData(); | ||
const fullmakter = person.fullmakt; | ||
|
||
if (fullmakter.isEmpty()) { | ||
return null; | ||
} | ||
|
||
return ( | ||
<Group> | ||
<InfoElement title="Fullmakter" icon={<PersonEnvelopeIcon />}> | ||
{fullmakter.map((fullmakt) => ( | ||
<Fullmakt | ||
key={fullmakt.motpartsPersonident} | ||
fullmakt={fullmakt} | ||
harFeilendeSystem={ | ||
harFeilendeSystemer(feilendeSystemer, 'PDL_TREDJEPARTSPERSONER') || | ||
harFeilendeSystemer(feilendeSystemer, 'FULLMAKT') | ||
} | ||
/> | ||
))} | ||
</InfoElement> | ||
</Group> | ||
); | ||
} | ||
|
||
export default Fullmakter; |
56 changes: 56 additions & 0 deletions
56
src/components/PersonLinje/Details/KontaktInfo/Adresse.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,56 @@ | ||
import { LocationPinIcon } from '@navikt/aksel-icons'; | ||
import { BodyShort } from '@navikt/ds-react'; | ||
import type { PersonData } from 'src/lib/types/modiapersonoversikt-api'; | ||
import ValidPeriod from '../../common/ValidPeriod'; | ||
import { Adresseinfo, InfoElement, LastChanged } from '../components'; | ||
|
||
interface Props { | ||
person: PersonData; | ||
} | ||
|
||
interface AdresseElementProps { | ||
adresse: PersonData['oppholdsAdresse'][0] | null; | ||
beskrivelse: string; | ||
erOppholdsadresse?: boolean; | ||
} | ||
|
||
function AdresseElement({ adresse, beskrivelse, erOppholdsadresse }: AdresseElementProps) { | ||
if (!adresse) { | ||
return ( | ||
<InfoElement title={beskrivelse} icon={<LocationPinIcon />}> | ||
<BodyShort size="small">Ikke registrert</BodyShort> | ||
</InfoElement> | ||
); | ||
} | ||
|
||
const skalViseGyldighetsPeriode = | ||
erOppholdsadresse || (!erOppholdsadresse && adresse.gyldighetsPeriode?.gyldigTilOgMed); | ||
|
||
return ( | ||
<InfoElement title={beskrivelse} icon={<LocationPinIcon />}> | ||
{skalViseGyldighetsPeriode && ( | ||
<ValidPeriod | ||
from={adresse.gyldighetsPeriode?.gyldigFraOgMed} | ||
to={adresse.gyldighetsPeriode?.gyldigTilOgMed} | ||
/> | ||
)} | ||
<Adresseinfo adresse={adresse} /> | ||
<LastChanged sistEndret={adresse.sistEndret} /> | ||
</InfoElement> | ||
); | ||
} | ||
|
||
function Adresse({ person }: Props) { | ||
const oppholdsAdresse = person.oppholdsAdresse.firstOrNull(); | ||
return ( | ||
<> | ||
<AdresseElement adresse={person.bostedAdresse.firstOrNull()} beskrivelse={'Bostedsadresse'} /> | ||
<AdresseElement adresse={person.kontaktAdresse.firstOrNull()} beskrivelse={'Kontaktadresse'} /> | ||
{oppholdsAdresse && ( | ||
<AdresseElement adresse={oppholdsAdresse} beskrivelse={'Oppholdsadresse'} erOppholdsadresse={true} /> | ||
)} | ||
</> | ||
); | ||
} | ||
|
||
export default Adresse; |
40 changes: 40 additions & 0 deletions
40
src/components/PersonLinje/Details/KontaktInfo/Bankkonto.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,40 @@ | ||
import { BankNoteIcon } from '@navikt/aksel-icons'; | ||
import { Alert, BodyShort } from '@navikt/ds-react'; | ||
import type { PersonData } from 'src/lib/types/modiapersonoversikt-api'; | ||
import { FormatertKontonummer } from 'src/utils/FormatertKontonummer'; | ||
import { InfoElement, LastChanged } from '../components'; | ||
|
||
interface Props { | ||
harFeilendeSystem: boolean; | ||
bankkonto: PersonData['bankkonto']; | ||
} | ||
|
||
function BankkontoBody({ harFeilendeSystem, bankkonto }: Props) { | ||
if (harFeilendeSystem) { | ||
return <Alert variant="warning">Feilet ved uthenting av kontonummer</Alert>; | ||
} | ||
|
||
if (!bankkonto) { | ||
return <BodyShort size="small">Ikke registrert</BodyShort>; | ||
} | ||
|
||
return ( | ||
<> | ||
<BodyShort size="small"> | ||
<FormatertKontonummer kontonummer={bankkonto.kontonummer} /> | ||
</BodyShort> | ||
<LastChanged sistEndret={bankkonto.sistEndret} /> | ||
</> | ||
); | ||
} | ||
|
||
function Bankkonto({ bankkonto, harFeilendeSystem }: Props) { | ||
const title = bankkonto?.landkode && bankkonto.landkode.kode !== 'NOR' ? 'Kontonummer utland' : 'Kontonummer'; | ||
return ( | ||
<InfoElement title={title} icon={<BankNoteIcon />}> | ||
<BankkontoBody bankkonto={bankkonto} harFeilendeSystem={harFeilendeSystem} /> | ||
</InfoElement> | ||
); | ||
} | ||
|
||
export default Bankkonto; |
127 changes: 127 additions & 0 deletions
127
src/components/PersonLinje/Details/KontaktInfo/Dodsbo.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,127 @@ | ||
import { LocationPinIcon } from '@navikt/aksel-icons'; | ||
import { Alert, BodyShort, Box } from '@navikt/ds-react'; | ||
import type { PersonData } from 'src/lib/types/modiapersonoversikt-api'; | ||
import { formaterDato } from 'src/utils/string-utils'; | ||
import { hentNavn } from '../../utils'; | ||
import { Adresseinfo, InfoElement, LastChanged } from '../components'; | ||
|
||
type Dodsbo = PersonData['dodsbo'][number]; | ||
type Adressat = Dodsbo['adressat']; | ||
|
||
function Adressatinfo({ | ||
harFeilendeSystem, | ||
adressat | ||
}: { | ||
harFeilendeSystem: boolean; | ||
adressat: Adressat; | ||
}) { | ||
if (adressat.advokatSomAdressat) { | ||
return <AdvokatSomAdressatInfo adressat={adressat.advokatSomAdressat} />; | ||
} | ||
if (adressat.organisasjonSomAdressat) { | ||
return <OrganisasjonSomAdressatInfo adressat={adressat.organisasjonSomAdressat} />; | ||
} | ||
if (adressat.personSomAdressat) { | ||
return <PersonSomAdressatInfo harFeilendeSystem={harFeilendeSystem} adressat={adressat.personSomAdressat} />; | ||
} | ||
return <Alert variant="warning">Ingen adressat funnet</Alert>; | ||
} | ||
|
||
function AdvokatSomAdressatInfo({ | ||
adressat | ||
}: { | ||
adressat: NonNullable<Adressat['advokatSomAdressat']>; | ||
}) { | ||
const firma = adressat.organisasjonsnavn ? ( | ||
<BodyShort size="small">Advokatfirma {adressat.organisasjonsnavn}</BodyShort> | ||
) : null; | ||
const orgnr = adressat.organisasjonsnummer ? ( | ||
<BodyShort size="small">Org. nr: {adressat.organisasjonsnummer}</BodyShort> | ||
) : null; | ||
|
||
return ( | ||
<> | ||
<BodyShort size="small">{hentNavn(adressat.kontaktperson)}</BodyShort> | ||
{firma} | ||
{orgnr} | ||
</> | ||
); | ||
} | ||
|
||
function OrganisasjonSomAdressatInfo({ | ||
adressat | ||
}: { | ||
adressat: NonNullable<Adressat['organisasjonSomAdressat']>; | ||
}) { | ||
const orgnr = adressat.organisasjonsnummer ? ( | ||
<BodyShort size="small">Org. nr: {adressat.organisasjonsnummer}</BodyShort> | ||
) : null; | ||
const kontakt = adressat.kontaktperson ? ( | ||
<BodyShort size="small">{hentNavn(adressat.kontaktperson)}</BodyShort> | ||
) : null; | ||
|
||
return ( | ||
<> | ||
<BodyShort size="small">{adressat.organisasjonsnavn}</BodyShort> | ||
{orgnr} | ||
{kontakt} | ||
</> | ||
); | ||
} | ||
|
||
function PersonSomAdressatInfo({ | ||
harFeilendeSystem, | ||
adressat | ||
}: { | ||
harFeilendeSystem: boolean; | ||
adressat: NonNullable<Adressat['personSomAdressat']>; | ||
}) { | ||
const manglerData = harFeilendeSystem ? <Alert variant="warning">Feilet ved uthenting av navn</Alert> : null; | ||
const fnr = adressat.fnr ? <BodyShort size="small">{adressat.fnr}</BodyShort> : null; | ||
const fodselsdato = adressat.fodselsdato ? ( | ||
<BodyShort size="small">{formaterDato(adressat.fodselsdato)}</BodyShort> | ||
) : null; | ||
const navn = adressat.navn ? ( | ||
<BodyShort size="small">{hentNavn(adressat.navn.firstOrNull() ?? undefined)}</BodyShort> | ||
) : null; | ||
|
||
return ( | ||
<> | ||
{manglerData} | ||
{navn} | ||
{fnr} | ||
{fodselsdato} | ||
</> | ||
); | ||
} | ||
|
||
function KontaktinformasjonDodsbo({ | ||
harFeilendeSystem, | ||
dodsbo | ||
}: { | ||
dodsbo: Dodsbo[]; | ||
harFeilendeSystem: boolean; | ||
}) { | ||
return ( | ||
<> | ||
{dodsbo.map((dodsbo, index) => { | ||
return ( | ||
<InfoElement | ||
key={`${dodsbo.adresse}-${index}`} | ||
title="Kontaktinformasjon for dødsbo" | ||
icon={<LocationPinIcon />} | ||
> | ||
<Adressatinfo harFeilendeSystem={harFeilendeSystem} adressat={dodsbo.adressat} /> | ||
<Box marginBlock="2"> | ||
<Adresseinfo adresse={dodsbo.adresse} /> | ||
{/* TODO: Her ble det tidligere brukt dodsbo.registrert. Hva ønsker vi å bruke? */} | ||
<LastChanged sistEndret={dodsbo.sistEndret} /> | ||
</Box> | ||
</InfoElement> | ||
); | ||
})} | ||
</> | ||
); | ||
} | ||
|
||
export default KontaktinformasjonDodsbo; |
Oops, something went wrong.