Skip to content

Commit

Permalink
Vise filter for dokumentliste alltid (#6607)
Browse files Browse the repository at this point in the history
  • Loading branch information
thomashwi authored Sep 18, 2024
1 parent 10cb5e8 commit f26a317
Showing 1 changed file with 10 additions and 26 deletions.
36 changes: 10 additions & 26 deletions packages/sak-dokumenter/src/components/DocumentList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -119,23 +119,9 @@ const DocumentList = ({
const { data: inntektsmeldingerIBruk } = useQuery({
queryKey: ['kompletthet'],
queryFn: ({ signal }) => getInntektsmeldingerIBruk(signal),
enabled: erStøttetFagsakYtelseType && !!behandlingUuid
enabled: erStøttetFagsakYtelseType && !!behandlingUuid,
});

const harMerEnnEnBehandlingKnyttetTilDokumenter = () => {
const unikeBehandlinger = [];
if (documents.some(document => document.behandlinger?.length > 0)) {
documents.forEach(document =>
document.behandlinger.forEach(behandling => {
if (!unikeBehandlinger.includes(behandling)) {
unikeBehandlinger.push(behandling);
}
}),
);
}
return unikeBehandlinger.length > 1;
};

const getModiaLenke = () => (
<Link target="_blank" className={styles.modiaLink} href={getModiaPath(fagsakPerson?.personnummer)}>
<span>
Expand Down Expand Up @@ -168,17 +154,15 @@ const DocumentList = ({
return (
<>
<div className={styles.controlsContainer}>
{harMerEnnEnBehandlingKnyttetTilDokumenter() && (
<Select
size="small"
onChange={event => setSelectedFilter(event.target.value)}
label="Hvilke behandlinger skal vises?"
hideLabel
>
<option value={alleBehandlinger}>Alle behandlinger</option>
<option value={behandlingId}>Denne behandlingen</option>
</Select>
)}
<Select
size="small"
onChange={event => setSelectedFilter(event.target.value)}
label="Hvilke behandlinger skal vises?"
hideLabel
>
<option value={alleBehandlinger}>Alle behandlinger</option>
<option value={behandlingId}>Denne behandlingen</option>
</Select>
{getModiaLenke()}
</div>
<Table>
Expand Down

0 comments on commit f26a317

Please sign in to comment.