Skip to content

Commit 772ee97

Browse files
committed
UPDATE: sist redigert av page
1 parent c517089 commit 772ee97

File tree

3 files changed

+69
-1
lines changed

3 files changed

+69
-1
lines changed

apps/frontend/src/components/PvkDokument/PvoTabs.tsx

+2-1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import { Label, Tabs } from '@navikt/ds-react'
22
import { useEffect, useState } from 'react'
33
import { NavigateFunction, useNavigate, useParams } from 'react-router-dom'
44
import { EPVO, IPvkDokumentListItem } from '../../constants'
5+
import PvoSistRedigertView from '../PvoTilbakemelding/PvoSistRedigertView'
56
import { PvoTilbakemeldingsList } from './PvoTilbakemeldingsList'
67

78
type TSection = 'siste' | 'alle'
@@ -37,7 +38,7 @@ const PvoTabs = ({ allPvkDocumentListItem, isLoading }: IProps) => {
3738
<Tabs.Tab value='alle' label='Alle PVKer' />
3839
</Tabs.List>
3940
<Tabs.Panel value='siste'>
40-
HER SKAL DET VÆRE SISTE REDIGERTE {/* <SistRedigertKrav /> */}
41+
<PvoSistRedigertView />
4142
</Tabs.Panel>
4243
<Tabs.Panel value='alle'>
4344
<div className='w-full justify-center my-4'>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
import { useQuery } from '@apollo/client'
2+
import { Label, List, Loader } from '@navikt/ds-react'
3+
import moment from 'moment'
4+
import { EPVO, EPvkDokumentStatus, IPageResponse, TPvoTilbakemeldingQL } from '../../constants'
5+
import { TPvoVariables, getPvoTilbakemeldingListQuery } from '../../query/PvoTilbakemeldingQuery'
6+
import { ListLayout } from '../common/ListLayout'
7+
import PvoStatusView from './common/PvoStatusView'
8+
9+
export const PvoSistRedigertView = () => {
10+
const { data, loading: isLoading } = useQuery<
11+
{ pvoTilbakemeldinger: IPageResponse<TPvoTilbakemeldingQL> },
12+
TPvoVariables
13+
>(getPvoTilbakemeldingListQuery, {
14+
variables: { sistRedigert: 20 },
15+
})
16+
17+
return (
18+
<div>
19+
{isLoading && (
20+
<div className='flex w-full justify-center items-center mt-5'>
21+
<Loader size='3xlarge' className='flex justify-self-center' />
22+
</div>
23+
)}
24+
25+
{!isLoading && (
26+
<div>
27+
<div className='w-full justify-center my-4'>
28+
<div className='flex justify-center content-center w-full'>
29+
<div className='flex justify-start align-middle w-full'>
30+
<Label size='medium'>
31+
{data?.pvoTilbakemeldinger.numberOfElements} PVK dokumenter
32+
</Label>
33+
</div>
34+
</div>
35+
</div>
36+
<List className='mb-2.5 flex flex-col gap-2'>
37+
{data &&
38+
data.pvoTilbakemeldinger &&
39+
data.pvoTilbakemeldinger.content.map((pvoTilbakemelding: TPvoTilbakemeldingQL) => (
40+
<ListLayout
41+
key={pvoTilbakemelding.id}
42+
id={pvoTilbakemelding.id}
43+
url={`/pvkdokument/${pvoTilbakemelding.pvkDokumentId}${EPVO.tilbakemelding}/1`}
44+
documentNumber={`E${pvoTilbakemelding.etterlevelseDokumentasjonData.etterlevelseNummer}`}
45+
title={pvoTilbakemelding.etterlevelseDokumentasjonData.title}
46+
status={
47+
<PvoStatusView
48+
status={pvoTilbakemelding.pvkDokumentStatus as EPvkDokumentStatus}
49+
/>
50+
}
51+
upperRightField='PVK dokument ble'
52+
changeStamp={`sist endret av meg: ${moment(pvoTilbakemelding.sistEndretAvMeg).format('ll')}`}
53+
/>
54+
))}
55+
</List>
56+
</div>
57+
)}
58+
</div>
59+
)
60+
}
61+
export default PvoSistRedigertView

apps/frontend/src/query/PvoTilbakemeldingQuery.ts

+6
Original file line numberDiff line numberDiff line change
@@ -36,3 +36,9 @@ export const getPvoTilbakemeldingListQuery = gql`
3636
}
3737
}
3838
`
39+
40+
export type TPvoVariables = {
41+
pageNumber?: number
42+
pageSize?: number
43+
sistRedigert?: number
44+
}

0 commit comments

Comments
 (0)