diff --git a/apps/frontend/src/AppRoutes.tsx b/apps/frontend/src/AppRoutes.tsx
index f14953127..c22fcdc6c 100644
--- a/apps/frontend/src/AppRoutes.tsx
+++ b/apps/frontend/src/AppRoutes.tsx
@@ -28,6 +28,7 @@ import { MainPage } from './pages/MainPage'
import { MyEtterlevelseDokumentasjonerPage } from './pages/MyEtterlevelseDokumentasjonerPage'
import NotFound from './pages/NotFound'
import PvkBehovPage from './pages/PvkBehovPage'
+import PvkDokumentPage from './pages/PvkDokumentPage'
import QuestionAndAnswerLogPage from './pages/QuestionAndAnswerLogPage'
import { RelasjonsOversikt } from './pages/RelasjonsOversikt'
import { TemaPage } from './pages/TemaPage'
@@ -147,6 +148,13 @@ const AppRoutes = (): JSX.Element => {
element={}
caseSensitive={true}
/>
+
+ } caseSensitive={true} />
+ }
+ caseSensitive={true}
+ />
}
@@ -172,8 +180,7 @@ const AppRoutes = (): JSX.Element => {
element={}
caseSensitive={true}
/>
- } caseSensitive={true} />
- PvkBehovPage
+
} adminPage />}
diff --git a/apps/frontend/src/api/PvkDokumentApi.ts b/apps/frontend/src/api/PvkDokumentApi.ts
index cf3baed70..9c32d061b 100644
--- a/apps/frontend/src/api/PvkDokumentApi.ts
+++ b/apps/frontend/src/api/PvkDokumentApi.ts
@@ -1,5 +1,6 @@
import axios from 'axios'
import { env } from 'process'
+import { useEffect, useState } from 'react'
import { EPvkDokumentStatus, IPageResponse, IPvkDokument } from '../constants'
export const getAllPvkDokument = async () => {
@@ -54,7 +55,33 @@ export const deletePvkDokument = async (id: string) => {
return (await axios.delete(`${env.backendBaseUrl}/pvkdokument/${id}`)).data
}
-function pvkDokumentToPvkDokumentDto(pvkDokument: IPvkDokument) {
+export const usePvkDokument = (pvkDokumentId?: string) => {
+ const isCreateNew = pvkDokumentId === 'ny'
+ const [data, setData] = useState(
+ isCreateNew ? mapPvkDokumentToFormValue({}) : undefined
+ )
+ const [isLoading, setIsLoading] = useState(false)
+
+ useEffect(() => {
+ setIsLoading(true)
+ if (pvkDokumentId && !isCreateNew) {
+ ;(async () => {
+ await getPvkDokument(pvkDokumentId).then(async (pvkDokument) => {
+ setData(pvkDokument)
+ setIsLoading(false)
+ })
+ })()
+ }
+ }, [pvkDokumentId])
+
+ return [data, setData, isLoading] as [
+ IPvkDokument | undefined,
+ (e: IPvkDokument) => void,
+ boolean,
+ ]
+}
+
+const pvkDokumentToPvkDokumentDto = (pvkDokument: IPvkDokument) => {
const dto = {
...pvkDokument,
ytterligereEgenskaper: pvkDokument.ytterligereEgenskaper.map((egenskap) => egenskap.code),
diff --git a/apps/frontend/src/pages/PvkDokumentPage.tsx b/apps/frontend/src/pages/PvkDokumentPage.tsx
new file mode 100644
index 000000000..a91376f6e
--- /dev/null
+++ b/apps/frontend/src/pages/PvkDokumentPage.tsx
@@ -0,0 +1,33 @@
+import { useState } from 'react'
+import { useParams } from 'react-router-dom'
+import { useEtterlevelseDokumentasjon } from '../api/EtterlevelseDokumentasjonApi'
+import { usePvkDokument } from '../api/PvkDokumentApi'
+import { PageLayout } from '../components/scaffold/Page'
+import { IBreadCrumbPath } from '../constants'
+import { dokumentasjonerBreadCrumbPath } from './util/BreadCrumbPath'
+
+export const PvkDokumentPage = () => {
+ const params: Readonly<
+ Partial<{
+ id?: string
+ pvkdokumentId?: string
+ }>
+ > = useParams<{ id?: string }>()
+ const breadcrumbPaths: IBreadCrumbPath[] = [dokumentasjonerBreadCrumbPath]
+ const [currentPage] = useState('Oversikt')
+ const [etterlevelseDokumentasjon] = useEtterlevelseDokumentasjon(params.id)
+ const [pvkDokument] = usePvkDokument(params.pvkdokumentId)
+
+ return (
+
+ {etterlevelseDokumentasjon && pvkDokument && WIP
}
+
+ )
+}
+
+export default PvkDokumentPage