diff --git a/apps/backend/src/main/java/no/nav/data/etterlevelse/arkivering/domain/EtterlevelseArkiv.java b/apps/backend/src/main/java/no/nav/data/etterlevelse/arkivering/domain/EtterlevelseArkiv.java index 3b3037a40..5e6102044 100644 --- a/apps/backend/src/main/java/no/nav/data/etterlevelse/arkivering/domain/EtterlevelseArkiv.java +++ b/apps/backend/src/main/java/no/nav/data/etterlevelse/arkivering/domain/EtterlevelseArkiv.java @@ -61,6 +61,6 @@ public EtterlevelseArkivResponse toResponse() { } public InstanceId convertToInstanceId() { - return new InstanceId(id.toString(), behandlingId + "-" + webSakNummer); + return new InstanceId(id.toString(), behandlingId + "-" + webSakNummer, ""); } } diff --git a/apps/backend/src/main/java/no/nav/data/etterlevelse/codelist/codeusage/dto/InstanceId.java b/apps/backend/src/main/java/no/nav/data/etterlevelse/codelist/codeusage/dto/InstanceId.java index 32763b26f..72dcb9867 100644 --- a/apps/backend/src/main/java/no/nav/data/etterlevelse/codelist/codeusage/dto/InstanceId.java +++ b/apps/backend/src/main/java/no/nav/data/etterlevelse/codelist/codeusage/dto/InstanceId.java @@ -18,6 +18,7 @@ public class InstanceId { private String id; private String name; + private String number; @JsonIgnore public UUID getIdAsUUID() { diff --git a/apps/backend/src/main/java/no/nav/data/etterlevelse/etterlevelse/domain/Etterlevelse.java b/apps/backend/src/main/java/no/nav/data/etterlevelse/etterlevelse/domain/Etterlevelse.java index 53f4a0e3b..baefbd579 100644 --- a/apps/backend/src/main/java/no/nav/data/etterlevelse/etterlevelse/domain/Etterlevelse.java +++ b/apps/backend/src/main/java/no/nav/data/etterlevelse/etterlevelse/domain/Etterlevelse.java @@ -78,6 +78,6 @@ public EtterlevelseResponse toResponse() { } public InstanceId convertToInstanceId() { - return new InstanceId(id.toString(), behandlingId + "-" + kravId()); + return new InstanceId(id.toString(), behandlingId + "-" + kravId(), ""); } } diff --git a/apps/backend/src/main/java/no/nav/data/etterlevelse/etterlevelseDokumentasjon/domain/EtterlevelseDokumentasjon.java b/apps/backend/src/main/java/no/nav/data/etterlevelse/etterlevelseDokumentasjon/domain/EtterlevelseDokumentasjon.java index e7d285529..f9a757e6f 100644 --- a/apps/backend/src/main/java/no/nav/data/etterlevelse/etterlevelseDokumentasjon/domain/EtterlevelseDokumentasjon.java +++ b/apps/backend/src/main/java/no/nav/data/etterlevelse/etterlevelseDokumentasjon/domain/EtterlevelseDokumentasjon.java @@ -78,6 +78,6 @@ public EtterlevelseDokumentasjonResponse toResponse() { } public InstanceId convertToInstanceId() { - return new InstanceId(id.toString(), title); + return new InstanceId(id.toString(), title, "E" + etterlevelseNummer); } } diff --git a/apps/backend/src/main/java/no/nav/data/etterlevelse/krav/domain/Krav.java b/apps/backend/src/main/java/no/nav/data/etterlevelse/krav/domain/Krav.java index e38f3298a..4708c112c 100644 --- a/apps/backend/src/main/java/no/nav/data/etterlevelse/krav/domain/Krav.java +++ b/apps/backend/src/main/java/no/nav/data/etterlevelse/krav/domain/Krav.java @@ -137,6 +137,6 @@ public KravResponse toResponse() { } public InstanceId convertToInstanceId() { - return new InstanceId(id.toString(), navn); + return new InstanceId(id.toString(), navn, "K" + kravNummer + "." + kravVersjon); } } diff --git a/apps/backend/src/main/java/no/nav/data/etterlevelse/kravprioritering/domain/KravPrioritering.java b/apps/backend/src/main/java/no/nav/data/etterlevelse/kravprioritering/domain/KravPrioritering.java index 7c96804ea..e5e91ff25 100644 --- a/apps/backend/src/main/java/no/nav/data/etterlevelse/kravprioritering/domain/KravPrioritering.java +++ b/apps/backend/src/main/java/no/nav/data/etterlevelse/kravprioritering/domain/KravPrioritering.java @@ -46,6 +46,6 @@ public KravPrioriteringResponse toResponse() { } public InstanceId convertToInstanceId() { - return new InstanceId(id.toString(), kravId()); + return new InstanceId(id.toString(), kravId(), ""); } } diff --git a/apps/backend/src/main/java/no/nav/data/etterlevelse/virkemiddel/domain/Virkemiddel.java b/apps/backend/src/main/java/no/nav/data/etterlevelse/virkemiddel/domain/Virkemiddel.java index cefb1db88..0e2285a84 100644 --- a/apps/backend/src/main/java/no/nav/data/etterlevelse/virkemiddel/domain/Virkemiddel.java +++ b/apps/backend/src/main/java/no/nav/data/etterlevelse/virkemiddel/domain/Virkemiddel.java @@ -57,7 +57,7 @@ public VirkemiddelResponse toResponse() { } public InstanceId convertToInstanceId() { - return new InstanceId(id.toString(), navn); + return new InstanceId(id.toString(), navn, ""); } } diff --git a/apps/frontend/src/components/Header.tsx b/apps/frontend/src/components/Header.tsx index 46c2d3fa8..92d3cf597 100644 --- a/apps/frontend/src/components/Header.tsx +++ b/apps/frontend/src/components/Header.tsx @@ -26,11 +26,9 @@ export const LoginButton = () => { // updates window.location on navigation const location = useLocation() return ( - - - Logg inn - - + + Logg inn + ) } @@ -54,7 +52,7 @@ const LoggedInHeader = () => { const kravPages = user.isKraveier() ? [{ label: 'Forvalte og opprette krav', href: '/kravliste' }, - //{ label: 'Forvalte og opprette virkemiddel', href: '/virkemiddelliste' } + //{ label: 'Forvalte og opprette virkemiddel', href: '/virkemiddelliste' } ] : [] const adminPages = user.isAdmin() @@ -186,14 +184,14 @@ const Header = (props: { noSearchBar?: boolean; noLoginButton?: boolean }) => {
-
- + +
Etterlevelse {!props.noSearchBar && ( -
+
)} @@ -204,8 +202,8 @@ const Header = (props: { noSearchBar?: boolean; noLoginButton?: boolean }) => { {user.isLoggedIn() && }
)} - -
+
+
{systemVarsel && systemVarsel.meldingStatus === MeldingStatus.ACTIVE && (
{ const [errorOnResponse, setErrorOnResponse] = React.useState(null) const [usage, setUsage] = useState() + const [sort, setSort] = useState() + useEffect(() => { if (showUsage && selectedCode) { - ;(async () => { + ; (async () => { setUsage(undefined) const usage = await getCodelistUsage(selectedCode.list, selectedCode.code) setUsage(usage) @@ -60,81 +58,93 @@ const CodeListTable = ({ tableData, refresh }: TableCodelistProps) => { } } + let sortedData = tableData + + const comparator = (a: Code, b: Code, orderBy: string) => { + switch (orderBy) { + case 'code': + return a.code.localeCompare(b.code) + case 'navn': + return (a.shortName || '').localeCompare(b.shortName || '') + default: + return 0 + } + } + + sortedData = sortedData.sort((a, b) => { + if (sort) { + return sort.direction === 'ascending' + ? comparator(b, a, sort.orderBy) + : comparator(a, b, sort.orderBy) + } + return 1 + }) + return ( <> - - table.data.map((row, index) => ( - - - {row.code} - - {row.shortName} - - - {row.description} - - {row.data && JSON.stringify(row.data, null, 1)} - - - - - - - - - - - - - )) - } - /> +
handleSort(sort, setSort, sortKey)}> + + + Code + Navn + Beskrivelse + + + + + {sortedData.map((code: Code, i) => { + return ( + + {code.code} + {code.shortName} + +
+ {code.description} +
+ {code.data && JSON.stringify(code.data, null, 1)} +
+
+
+ +
+ +
+
+
+ ) + })} +
+
{showEditModal && selectedCode && ( { code: selectedCode.code ?? '', shortName: selectedCode.shortName ?? '', description: selectedCode.description ?? '', - data: selectedCode.data || {}, + data: selectedCode.data ? selectedCode.data.relevantFor ? selectedCode.data : { ...selectedCode.data, relevantFor: LovCodeRelevans.KRAV_OG_VIRKEMIDDEL } : { relevantFor: LovCodeRelevans.KRAV_OG_VIRKEMIDDEL }, }} isOpen={showEditModal} onClose={() => { diff --git a/apps/frontend/src/components/admin/CodeList/CodeListUsage.tsx b/apps/frontend/src/components/admin/CodeList/CodeListUsage.tsx index d9cf7d2b4..2d65f8055 100644 --- a/apps/frontend/src/components/admin/CodeList/CodeListUsage.tsx +++ b/apps/frontend/src/components/admin/CodeList/CodeListUsage.tsx @@ -1,20 +1,10 @@ import * as React from 'react' import { useEffect, useState } from 'react' -import { Block } from 'baseui/block' -import { LabelMedium } from 'baseui/typography' -import { Value } from 'baseui/select' -import { Button } from 'baseui/button' - -import { Spinner } from 'baseui/spinner' -import { Cell, Row, Table } from '../../common/Table' -import { theme } from '../../../util' import { codelist, CodeUsage } from '../../../services/Codelist' import { ObjectLink } from '../../common/RouteLink' import { ObjectType } from '../audit/AuditTypes' import { replaceCodelistUsage } from '../../../api/CodelistApi' -import CustomizedSelect from '../../common/CustomizedSelect' -import { ettlevColors } from '../../../util/theme' -import { buttonContentStyle } from '../../common/Button' +import { Button, Label, Loader, Select, Table } from '@navikt/ds-react' const UsageTable = (props: { usage: CodeUsage }) => { const { usage } = props @@ -25,60 +15,56 @@ const UsageTable = (props: { usage: CodeUsage }) => { const rows = usage ? Math.max(usage.krav.length, usage.etterlevelseDokumentasjoner.length, usage.codelist.length) : -1 return ( - !!v)} - render={(table) => - Array.from(Array(rows).keys()).map((index) => { +
+ + + {krav && Krav} + {etterlevelseDokumentasjoner && Etterlevelse Dokumentasjoner} + {codelist && Codelist} + + + + {Array.from(Array(rows).keys()).map((index) => { const kr = usage.krav[index] const ed = usage.etterlevelseDokumentasjoner[index] const cl = usage.codelist[index] return ( - - {krav && ( - + + {krav && + {kr && ( - {kr.name} + {kr.number} {kr.name} )} - - )} - {etterlevelseDokumentasjoner && ( - + } + {etterlevelseDokumentasjoner && + {ed && ( - {ed.name} + {ed.number} {ed.name} )} - - )} - {codelist && ( - + } + {codelist && + {cl && ( {cl.list} - {cl.code} )} - - )} - + } + ) - }) - } - /> + })} + +
) } export const Usage = (props: { usage?: CodeUsage; refresh: () => void }) => { const [showReplace, setShowReplace] = useState(false) - const [newValue, setNewValue] = useState([]) + const [newValue, setNewValue] = useState() const ref = React.createRef() const { usage, refresh } = props @@ -89,64 +75,52 @@ export const Usage = (props: { usage?: CodeUsage; refresh: () => void }) => { }, [usage]) const replace = async () => { - await replaceCodelistUsage(usage!.listName, usage!.code, newValue[0].id as string) - refresh() + if (newValue) { + await replaceCodelistUsage(usage!.listName, usage!.code, newValue).then(() => refresh()) + } } return ( - - - Bruk +
+
+ {!!usage?.inUse && ( )} - +
{showReplace && usage && usage.listName && ( - - + - +
)} {usage && } - {!usage && } -
+ {!usage && } +
) } diff --git a/apps/frontend/src/components/admin/CodeList/CodelistPage.tsx b/apps/frontend/src/components/admin/CodeList/CodelistPage.tsx index adf06aba0..0ec669b4e 100644 --- a/apps/frontend/src/components/admin/CodeList/CodelistPage.tsx +++ b/apps/frontend/src/components/admin/CodeList/CodelistPage.tsx @@ -1,23 +1,16 @@ import * as React from 'react' import { useEffect } from 'react' -import { StatefulSelect } from 'baseui/select' -import { Block } from 'baseui/block' -import { KIND, SIZE as ButtonSize } from 'baseui/button' import { useNavigate, useParams } from 'react-router-dom' -import { HeadingXXLarge } from 'baseui/typography' -import { Spinner } from 'baseui/spinner' -import Button from '../../common/Button' -import { faPlus } from '@fortawesome/free-solid-svg-icons' import { useAwait, useForceUpdate } from '../../../util/hooks' import { Code, codelist, CodeListFormValues } from '../../../services/Codelist' import { createCodelist } from '../../../api/CodelistApi' -import { theme } from '../../../util' import { user } from '../../../services/User' import CreateCodeListModal from './ModalCreateCodeList' import CodeListTable from './CodeListStyledTable' -import { ettlevColors, responsivePaddingSmall, responsiveWidthSmall } from '../../../util/theme' import { Helmet } from 'react-helmet' +import { Button, Heading, Loader, Select } from '@navikt/ds-react' +import { PlusIcon } from '@navikt/aksel-icons' const CodeListPage = () => { const params = useParams<{ listname?: string }>() @@ -58,47 +51,46 @@ const CodeListPage = () => { if (!user.isAdmin() || !lists) { return ( - - - +
+ +
) } return ( - +
{listname ? listname : 'Velg kodeverk'} - Administrering av kodeverk + Administrering av kodeverk {loading ? ( - + ) : ( - - - setListname(value[0].id as string)} - clearable={false} - placeholder="Velg kodeverk" - initialState={{ value: listname ? [{ id: listname, label: listname }] : [] }} - /> - +
+ {listname && ( - - - + )} - +
)} {!loading && currentCodelist && ( - +
- +
)} { isOpen={createCodeListModal} errorOnCreate={errorOnResponse} onClose={() => { - setCreateCodeListModal(!createCodeListModal) + setCreateCodeListModal(false) setErrorOnResponse(null) }} submit={handleCreateCodelist} /> -
+
) } diff --git a/apps/frontend/src/components/admin/CodeList/LovCode.tsx b/apps/frontend/src/components/admin/CodeList/LovCode.tsx index e6c107dc0..a1e6e8079 100644 --- a/apps/frontend/src/components/admin/CodeList/LovCode.tsx +++ b/apps/frontend/src/components/admin/CodeList/LovCode.tsx @@ -1,35 +1,21 @@ -import { Block, BlockProps } from 'baseui/block' -import { LabelMedium } from 'baseui/typography' +import { Block } from 'baseui/block' import { Field, FieldProps } from 'formik' -import { Code, codelist, CodeListFormValues, ListName, LovCodeData, LovCodeRelevans, lovCodeRelevansToOptions, TemaCodeData } from '../../../services/Codelist' -import { SIZE as InputSIZE } from 'baseui/input' +import { codelist, CodeListFormValues, ListName, LovCodeData, LovCodeRelevans, lovCodeRelevansToOptions, TemaCodeData } from '../../../services/Codelist' import { OptionList } from '../../common/Inputs' import { temaBilder } from '../../Images' -import { StatefulTooltip } from 'baseui/tooltip' -import { faQuestionCircle } from '@fortawesome/free-solid-svg-icons' -import { FontAwesomeIcon } from '@fortawesome/react-fontawesome' import { theme } from '../../../util' import Button from '../../common/Button' -import CustomizedInput from '../../common/CustomizedInput' -import CustomizedSelect from '../../common/CustomizedSelect' -import CustomizedTextarea from '../../common/CustomizedTextarea' import { Error } from '../../common/ModalSchema' - -const rowBlockProps: BlockProps = { - display: 'flex', - width: '100%', - marginTop: '1rem', - alignItems: 'center', -} +import { Label, Select, TextField, Textarea } from '@navikt/ds-react' export const LovCodeDataForm = () => { return ( - - - +
+
+ +
{({ field, form }: FieldProps) => { const data = field.value @@ -42,61 +28,56 @@ export const LovCodeDataForm = () => { if (!data.lovId && form.values.description) { set({ lovId: form.values.description }) } - // Migrate old - if (!data.relevantFor) { - set({ relevantFor: LovCodeRelevans.KRAV_OG_VIRKEMIDDEL }) - } return ( <> - - +
+ + set({ lovId: e.target.value })} className="w-full" label="Lov ID" hideLabel /> +
- - - {' '} - Underavdeling:{' '} - +
+ set({ underavdeling: val.code })} - label={'Underavdeling'} + label={'underavdeling'} /> - +
- - - Tema:{' '} - +
+ set({ tema: val.code })} - label={'Tema'} + label={'tema'} /> - +
- - - Relevant for:{' '} - +
+ set({ relevantFor: val })} - label={'Relevant for'} + label={'relevant for'} /> - +
) }}
- +
) } @@ -108,12 +89,12 @@ export const TemaCodeDataForm = () => { })) return ( - - - +
+
+ +
{({ field, form }: FieldProps) => { const data = field.value @@ -123,42 +104,40 @@ export const TemaCodeDataForm = () => { } return ( <> - - +
+ + +
+
+