-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Refaktor av fullmakt for gamle bestillinger og ferdigstilt oppsett …
…for nye fullmakt frontend
- Loading branch information
Showing
20 changed files
with
2,262 additions
and
631 deletions.
There are no files selected for viewing
2,446 changes: 2,118 additions & 328 deletions
2,446
apps/dolly-frontend/src/main/js/package-lock.json
Large diffs are not rendered by default.
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
2 changes: 1 addition & 1 deletion
2
...ents/fagsystem/fullmakt/FullmaktTypes.tsx → ...nents/fagsystem/fullmakt/FullmaktType.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
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
29 changes: 29 additions & 0 deletions
29
apps/dolly-frontend/src/main/js/src/components/fagsystem/fullmakt/visning/Fullmakt.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,29 @@ | ||
import { TitleValue } from '@/components/ui/titleValue/TitleValue' | ||
import { formatDate, oversettBoolean } from '@/utils/DataFormatter' | ||
import { FullmaktType } from '@/components/fagsystem/fullmakt/FullmaktType' | ||
import { Fragment } from 'react' | ||
|
||
type FullmaktProps = { | ||
idx: number | ||
fullmakt: FullmaktType | ||
} | ||
|
||
export const Fullmakt = ({ fullmakt, idx }: FullmaktProps) => { | ||
return ( | ||
<Fragment key={idx}> | ||
<TitleValue title="Fullmektig" value={fullmakt?.fullmektig} /> | ||
<TitleValue title="Fullmektigs navn" value={fullmakt?.fullmektigsNavn} /> | ||
<TitleValue title="Gyldig fra" value={formatDate(fullmakt?.gyldigFraOgMed)} /> | ||
<TitleValue title="Gyldig til" value={formatDate(fullmakt?.gyldigTilOgMed)} /> | ||
{fullmakt?.omraade?.map((omraade, index) => ( | ||
<TitleValue key={index} title={omraade?.tema} value={omraade?.handling.join(', ')} /> | ||
))} | ||
<TitleValue | ||
title="Registrert" | ||
value={fullmakt?.registrert && formatDate(fullmakt.registrert)} | ||
/> | ||
<TitleValue title="Kilde" value={fullmakt?.kilde} /> | ||
<TitleValue title="Opphørt" value={oversettBoolean(fullmakt?.opphoert)} /> | ||
</Fragment> | ||
) | ||
} |
45 changes: 27 additions & 18 deletions
45
.../dolly-frontend/src/main/js/src/components/fagsystem/fullmakt/visning/FullmaktVisning.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,30 +1,39 @@ | ||
import { TitleValue } from '@/components/ui/titleValue/TitleValue' | ||
import { formatDate, oversettBoolean } from '@/utils/DataFormatter' | ||
import { FullmaktTypes } from '@/components/fagsystem/fullmakt/FullmaktTypes' | ||
import { FullmaktType } from '@/components/fagsystem/fullmakt/FullmaktType' | ||
import { useFullmektig } from '@/utils/hooks/useFullmakt' | ||
import React, { useEffect, useState } from 'react' | ||
import { DollyFieldArray } from '@/components/ui/form/fieldArray/DollyFieldArray' | ||
import { Fullmakt } from '@/components/fagsystem/fullmakt/visning/Fullmakt' | ||
import { ErrorBoundary } from '@/components/ui/appError/ErrorBoundary' | ||
import SubOverskrift from '@/components/ui/subOverskrift/SubOverskrift' | ||
|
||
type FullmaktProps = { | ||
ident: string | ||
data: FullmaktTypes | ||
} | ||
|
||
export const FullmaktVisning = ({ ident, data }: FullmaktProps) => { | ||
export const FullmaktVisning = ({ ident }: FullmaktProps) => { | ||
const { fullmektig } = useFullmektig(ident) | ||
if (!data?.fullmaktsgiver && fullmektig?.size === 0) { | ||
const [fullmaktData, setFullmaktData] = useState([]) | ||
|
||
useEffect(() => { | ||
if (fullmektig?.length > 0) { | ||
setFullmaktData(fullmektig) | ||
} | ||
}, [fullmektig]) | ||
|
||
if (!fullmektig || fullmektig.length === 0) { | ||
return null | ||
} | ||
console.log('fullmektig: ', fullmektig) //TODO - SLETT MEG | ||
|
||
return ( | ||
<> | ||
<TitleValue title="Fullmaktsgiver" value={data?.fullmaktsgiver} /> | ||
<TitleValue title="Gyldig fra" value={formatDate(data?.gyldigFraOgMed)} /> | ||
<TitleValue title="Gyldig til" value={formatDate(data?.gyldigTilOgMed)} /> | ||
{data?.omraade?.map((omraade, index) => ( | ||
<TitleValue key={index} title={omraade.tema} value={omraade.handling.join(', ')} /> | ||
))} | ||
<TitleValue title="Registrert" value={data?.registrert && formatDate(data.registrert)} /> | ||
<TitleValue title="Kilde" value={data?.kilde} /> | ||
<TitleValue title="Opphørt" value={oversettBoolean(data?.opphoert)} /> | ||
</> | ||
<ErrorBoundary> | ||
<div> | ||
<SubOverskrift label="Fullmakt" iconKind="fullmakt" /> | ||
<div className="person-visning_content"> | ||
<DollyFieldArray data={fullmaktData} header="" nested> | ||
{(item: FullmaktType, idx: number) => <Fullmakt fullmakt={item} idx={idx} />} | ||
</DollyFieldArray> | ||
</div> | ||
</div> | ||
</ErrorBoundary> | ||
) | ||
} |
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
57 changes: 0 additions & 57 deletions
57
.../dolly-frontend/src/main/js/src/components/fagsystem/pdl/visning/partials/PdlFullmakt.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
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
Oops, something went wrong.