-
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.
* Nytt fullmakt grensesnitt - frontend
#deploy-test-frontend #deploy-proxy
- Loading branch information
Showing
29 changed files
with
658 additions
and
761 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
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
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
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
65 changes: 65 additions & 0 deletions
65
...src/main/js/src/components/bestillingsveileder/stegVelger/steg/steg1/paneler/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,65 @@ | ||
import Panel from '@/components/ui/panel/Panel' | ||
import { | ||
Attributt, | ||
AttributtKategori, | ||
} from '@/components/bestillingsveileder/stegVelger/steg/steg1/Attributt' | ||
import { initialFullmakt } from '@/components/fagsystem/pdlf/form/initialValues' | ||
import { harValgtAttributt } from '@/components/ui/form/formUtils' | ||
import { adresseAttributter } from '@/components/fagsystem/pdlf/form/partials/adresser/Adresser' | ||
import React, { useContext } from 'react' | ||
import { BestillingsveilederContext } from '@/components/bestillingsveileder/BestillingsveilederContext' | ||
|
||
export const FullmaktPanel = ({ stateModifier, formValues }: any) => { | ||
const sm = stateModifier(FullmaktPanel.initialValues) | ||
const opts = useContext(BestillingsveilederContext) | ||
const gruppeId = opts?.gruppeId || opts?.gruppe?.id | ||
|
||
const testNorgePerson = opts?.identMaster === 'PDL' | ||
const ukjentGruppe = !gruppeId | ||
const tekstUkjentGruppe = 'Funksjonen er deaktivert da personer for relasjon er ukjent' | ||
const testNorgeFlere = testNorgePerson && opts?.antall > 1 | ||
const tekstFlerePersoner = 'Funksjonen er kun tilgjengelig per individ, ikke for gruppe' | ||
|
||
return ( | ||
// @ts-ignore | ||
<Panel | ||
heading={FullmaktPanel.heading} | ||
checkAttributeArray={sm.batchAdd} | ||
uncheckAttributeArray={sm.batchRemove} | ||
iconType="fullmakt" | ||
startOpen={harValgtAttributt(formValues, adresseAttributter)} | ||
> | ||
<AttributtKategori title="Fullmakt" attr={sm.attrs}> | ||
<Attributt | ||
attr={sm.attrs.fullmakt} | ||
disabled={ukjentGruppe || testNorgeFlere} | ||
title={ | ||
(ukjentGruppe && tekstUkjentGruppe) || (testNorgeFlere && tekstFlerePersoner) || '' | ||
} | ||
/> | ||
</AttributtKategori> | ||
</Panel> | ||
) | ||
} | ||
|
||
FullmaktPanel.heading = 'Fullmakt' | ||
|
||
FullmaktPanel.initialValues = ({ set, opts, del, has }: any) => { | ||
const { identtype, identMaster } = opts | ||
|
||
const initialMaster = identMaster === 'PDL' || identtype === 'NPID' ? 'PDL' : 'FREG' | ||
const initialValues = { ...initialFullmakt, master: initialMaster } | ||
|
||
return { | ||
fullmakt: { | ||
label: 'Har fullmektig', | ||
checked: has('fullmakt') || has('pdl.person.fullmakt'), | ||
add: () => { | ||
set('fullmakt', [initialValues]) | ||
}, | ||
remove: () => { | ||
del('fullmakt') | ||
}, | ||
}, | ||
} | ||
} |
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
11 changes: 11 additions & 0 deletions
11
apps/dolly-frontend/src/main/js/src/components/fagsystem/fullmakt/FullmaktTypes.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,11 @@ | ||
export type FullmaktTypes = { | ||
gyldigFraOgMed: string | ||
gyldigTilOgMed?: string | ||
fullmaktsgiver: string | ||
omraade: Omraade[] | ||
} | ||
|
||
export type Omraade = { | ||
tema: string | ||
handling: string[] | ||
} |
Oops, something went wrong.