Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/yrkesskade frontend #3649

Merged
merged 20 commits into from
Oct 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions apps/dolly-frontend/config.idporten.yml
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ spec:
- application: testnav-varslinger-service
- application: testnorge-profil-api
- application: testnorge-tilbakemelding-api
- application: testnav-yrkesskade-proxy
external:
- host: testnav-pensjon-testdata-facade-proxy.dev-fss-pub.nais.io
- host: testnav-sigrunstub-proxy.dev-fss-pub.nais.io
Expand Down
1 change: 1 addition & 0 deletions apps/dolly-frontend/config.test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ spec:
- application: testnav-levende-arbeidsforhold-ansettelse
- application: testnav-levende-arbeidsforhold-scheduler
- application: testnav-skattekort-service
- application: testnav-yrkesskade-proxy
external:
- host: testnav-pensjon-testdata-facade-proxy.dev-fss-pub.nais.io
- host: testnav-sigrunstub-proxy.dev-fss-pub.nais.io
Expand Down
1 change: 1 addition & 0 deletions apps/dolly-frontend/config.unstable.yml
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ spec:
- application: testnorge-profil-api-dev
- application: testnorge-tilbakemelding-api
- application: testnav-skattekort-service
- application: testnav-yrkesskade-proxy
external:
- host: testnav-pensjon-testdata-facade-proxy.dev-fss-pub.nais.io
- host: testnav-sigrunstub-proxy.dev-fss-pub.nais.io
Expand Down
1 change: 1 addition & 0 deletions apps/dolly-frontend/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ spec:
- application: testnorge-tilbakemelding-api
- application: testnav-levende-arbeidsforhold-ansettelse
- application: testnav-levende-arbeidsforhold-scheduler
- application: testnav-yrkesskade-proxy

external:
- host: testnav-pensjon-testdata-facade-proxy.dev-fss-pub.nais.io
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ public RouteLocator customRouteLocator(RouteLocatorBuilder builder) {
.route(createRoute(consumers.getTestnavSkattekortService()))
.route(createRoute(consumers.getTestnavLevendeArbeidsforholdAnsettelse(), "testnav-levende-arbeidsforhold-ansettelse"))
.route(createRoute(consumers.getTestnavLevendeArbeidsforholdScheduler(), "testnav-levende-arbeidsforhold-scheduler"))
.route(createRoute(consumers.getTestnavYrkesskadeProxy()))
.build();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,5 +65,6 @@ public class Consumers {
private ServerProperties testnavSkattekortService;
private ServerProperties testnavLevendeArbeidsforholdAnsettelse;
private ServerProperties testnavLevendeArbeidsforholdScheduler;
private ServerProperties testnavYrkesskadeProxy;

}
5 changes: 5 additions & 0 deletions apps/dolly-frontend/src/main/js/proxy-routes.json
Original file line number Diff line number Diff line change
Expand Up @@ -243,5 +243,10 @@
"target": "http://localhost:8020",
"changeOrigin": true,
"secure": false
},
"/testnav-yrkesskade-proxy": {
"target": "http://localhost:8020",
"changeOrigin": true,
"secure": false
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import {
arrayToString,
codeToNorskLabel,
formatDate,
formatDateTime,
formatDateTimeWithSeconds,
formatDateToYear,
omraaderArrayToString,
Expand Down Expand Up @@ -1270,7 +1271,7 @@ const mapInntektStub = (bestillingData, data) => {
inntektStub.itemRows.push([
{ numberHeader: `Inntektsinformasjon ${i + 1}` },
obj('År/måned', inntektsinfo.sisteAarMaaned),
obj('Rapporteringstidspunkt', inntektsinfo.rapporteringsdato),
obj('Rapporteringstidspunkt', formatDateTime(inntektsinfo.rapporteringsdato)),
obj('Generer antall måneder', inntektsinfo.antallMaaneder),
obj('Virksomhet (orgnr/id)', inntektsinfo.virksomhet),
obj('Opplysningspliktig (orgnr/id)', inntektsinfo.opplysningspliktig),
Expand Down Expand Up @@ -1572,6 +1573,30 @@ const mapSykemelding = (bestillingData, data) => {
}
}

const mapYrkesskader = (bestillingData, data) => {
const yrkesskadeKriterier = bestillingData.yrkesskader

if (yrkesskadeKriterier) {
const mapYrkesskadeKriterier = () => ({
header: 'Yrkesskader',
itemRows: yrkesskadeKriterier.map((yrkesskade, i) => [
{
numberHeader: `Yrkesskade ${i + 1}`,
},
obj('Rolletype', codeToNorskLabel(yrkesskade.rolletype)),
obj('Innmelderrolle', codeToNorskLabel(yrkesskade.innmelderrolle)),
obj('Klassifisering', showLabel('klassifisering', yrkesskade.klassifisering)),
obj('Referanse', yrkesskade.referanse),
obj('Ferdigstill sak', showLabel('ferdigstillSak', yrkesskade.ferdigstillSak)),
obj('Tidstype', showLabel('tidstype', yrkesskade.tidstype)),
obj('Skadetidspunkt', formatDateTime(yrkesskade.skadetidspunkt)),
obj('Antall perioder', yrkesskade.perioder?.length),
]),
})
data.push(mapYrkesskadeKriterier())
}
}

const mapBrregstub = (bestillingData, data) => {
const brregstubKriterier = bestillingData.brregstub

Expand Down Expand Up @@ -2431,6 +2456,7 @@ export function mapBestillingData(bestillingData, bestillingsinformasjon, firstI
mapPensjon(bestillingData, data, navEnheter)
mapArena(bestillingData, data)
mapSykemelding(bestillingData, data)
mapYrkesskader(bestillingData, data)
mapBrregstub(bestillingData, data)
mapInst(bestillingData, data)
mapKrr(bestillingData, data)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,18 @@ import { harValgtAttributt } from '@/components/ui/form/formUtils'
import { sykdomAttributt } from '@/components/fagsystem/sykdom/form/Form'
import { useContext } from 'react'
import { BestillingsveilederContext } from '@/components/bestillingsveileder/BestillingsveilederContext'
import { initialYrkesskade } from '@/components/fagsystem/yrkesskader/initialValues'
import { yrkesskaderAttributt } from '@/components/fagsystem/yrkesskader/form/Form'

export const SykdomPanel = ({ stateModifier, formValues }: any) => {
const sm = stateModifier(SykdomPanel.initialValues)
const opts = useContext(BestillingsveilederContext)

const harGyldigSykemeldingBestilling = opts?.tidligereBestillinger?.some(
(bestilling) =>
bestilling.status?.some(
(status) =>
status.id === 'SYKEMELDING' && status.statuser?.some((item) => item?.melding === 'OK'),
),
const harGyldigSykemeldingBestilling = opts?.tidligereBestillinger?.some((bestilling) =>
bestilling.status?.some(
(status) =>
status.id === 'SYKEMELDING' && status.statuser?.some((item) => item?.melding === 'OK'),
),
)

return (
Expand All @@ -24,20 +25,21 @@ export const SykdomPanel = ({ stateModifier, formValues }: any) => {
checkAttributeArray={() => sm.batchAdd(harGyldigSykemeldingBestilling ? ['sykemelding'] : [])}
uncheckAttributeArray={sm.batchRemove}
iconType="sykdom"
startOpen={harValgtAttributt(formValues, [sykdomAttributt])}
startOpen={harValgtAttributt(formValues, [sykdomAttributt, yrkesskaderAttributt])}
>
<AttributtKategori title={null} attr={sm.attrs}>
<Attributt
attr={sm.attrs.sykemelding}
disabled={harGyldigSykemeldingBestilling}
title={harGyldigSykemeldingBestilling ? 'Personen har allerede sykemelding' : null}
/>
<Attributt attr={sm.attrs.yrkesskader} />
</AttributtKategori>
</Panel>
)
}

SykdomPanel.heading = 'Sykdom'
SykdomPanel.heading = 'Sykdom og skade'

SykdomPanel.initialValues = ({ set, del, has }: any) => ({
sykemelding: {
Expand All @@ -56,4 +58,14 @@ SykdomPanel.initialValues = ({ set, del, has }: any) => ({
del('sykemelding')
},
},
yrkesskader: {
label: 'Har yrkesskader',
checked: has('yrkesskader'),
add() {
set('yrkesskader', [initialYrkesskade])
},
remove() {
del('yrkesskader')
},
},
})
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import { MiljoVelger } from '@/components/miljoVelger/MiljoVelger'
import { MalForm } from '@/components/bestillingsveileder/stegVelger/steg/steg3/MalForm'
import { VelgGruppe } from '@/components/bestillingsveileder/stegVelger/steg/steg3/VelgGruppe'
import { SkattekortForm } from '@/components/fagsystem/skattekort/form/Form'
import { YrkesskaderForm } from '@/components/fagsystem/yrkesskader/form/Form'

export const DollyValidation = Yup.object({
...PdlfForm.validation,
Expand All @@ -33,6 +34,7 @@ export const DollyValidation = Yup.object({
...InntektsmeldingForm.validation,
...SkattekortForm.validation,
...SykdomForm.validation,
...YrkesskaderForm.validation,
...BrregstubForm.validation,
...InstForm.validation,
...KrrstubForm.validation,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ import { useFormContext } from 'react-hook-form'
import { SkattekortForm } from '@/components/fagsystem/skattekort/form/Form'
import { PensjonsavtaleForm } from '@/components/fagsystem/pensjonsavtale/form/Form'
import { AfpOffentligForm } from '@/components/fagsystem/afpOffentlig/form/Form'
import { YrkesskaderForm } from '@/components/fagsystem/yrkesskader/form/Form'

const gruppeNavn = (gruppe) => <span style={{ fontWeight: 'bold' }}>{gruppe.navn}</span>

Expand Down Expand Up @@ -81,6 +82,7 @@ export const Steg2 = () => {
<AfpOffentligForm />
<ArenaForm />
<SykdomForm />
<YrkesskaderForm />
<BrregstubForm />
<InstForm />
<KrrstubForm />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ export const rootPaths = [
'dokarkiv',
'medl',
'sykemelding',
'yrkesskader',
'organisasjon',
'skattekort',
]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,14 @@ import { ORGANISASJONSTYPE_TOGGLE } from '@/components/fagsystem/inntektstub/for
interface OrgnrToggleProps {
path: string
formMethods: UseFormReturn
label?: string
}

export const OrgnrToggle = ({ path, formMethods }: OrgnrToggleProps) => {
export const OrgnrToggle = ({
path,
formMethods,
label = 'Arbeidsgiver (orgnr)',
}: OrgnrToggleProps) => {
const [inputType, setInputType] = useState(
sessionStorage.getItem(ORGANISASJONSTYPE_TOGGLE) || inputValg.fraFellesListe,
)
Expand All @@ -40,23 +45,23 @@ export const OrgnrToggle = ({ path, formMethods }: OrgnrToggleProps) => {
{inputType === inputValg.fraFellesListe && (
<OrganisasjonMedArbeidsforholdSelect
path={path}
label="Arbeidsgiver (orgnr)"
label={label}
//@ts-ignore
isClearable={false}
/>
)}
{inputType === inputValg.fraEgenListe && (
<EgneOrganisasjoner
path={path}
label="Arbeidsgiver (orgnr)"
label={label}
formMethods={formMethods}
filterValidEnhetstyper={true}
// @ts-ignore
handleChange={handleChangeEgne}
/>
)}
{inputType === inputValg.skrivSelv && (
<FormTextInput type="number" name={path} label="Arbeidsgiver (orgnr)" size="xlarge" />
<FormTextInput type="number" name={path} label={label} size="xlarge" />
)}
</div>
)
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
export type YrkesskadePeriodeTypes = {
fra: string
til: string
}

export type YrkesskadeTypes = {
rolletype: string
innmelderrolle: string
innmelderIdentifikator: string
paaVegneAv: string
klassifisering?: string
tidstype?: string
skadetidspunkt?: string
perioder: Array<YrkesskadePeriodeTypes>
referanse?: string
ferdigstillSak?: string
}

export type YrkesskaderTypes = {
yrkesskader: Array<YrkesskadeTypes>
}
Loading
Loading