Skip to content

Commit 64530a3

Browse files
authored
Checkbox for å oppgi om man skal søke også i lukkede (#3667)
1 parent 0c9dc3c commit 64530a3

File tree

2 files changed

+17
-7
lines changed

2 files changed

+17
-7
lines changed

src/client/app/api/queries/saksbehandlerQueries.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,6 @@ export const useOpphevReservasjoner = (onSuccess?: () => void) => {
126126

127127
export const useSøkOppgaveV3 = () =>
128128
useMutation({
129-
mutationFn: (searchString: string): Promise<SøkeboksOppgaveDto[]> =>
130-
axiosInstance.post(apiPaths.sokV3, { searchString }).then((response) => response.data),
129+
mutationFn: (params: { searchString: string; fraAktiv: boolean }): Promise<SøkeboksOppgaveDto[]> =>
130+
axiosInstance.post(apiPaths.sokV3, params).then((response) => response.data),
131131
});
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,38 @@
11
import React, { useState } from 'react';
2-
import { Search } from '@navikt/ds-react';
2+
import { Checkbox, HStack, HelpText, Search } from '@navikt/ds-react';
3+
import VerticalSpacer from 'sharedComponents/VerticalSpacer';
34

4-
export function SøkForm(props: { loading: boolean; utførSøk: (søkeord: string) => void; nullstillSøk: () => void }) {
5-
const [søkeord, setSøkeord] = useState('');
5+
export function SøkForm(props: {
6+
loading: boolean;
7+
utførSøk: (søk: { searchString: string; fraAktiv: boolean }) => void;
8+
nullstillSøk: () => void;
9+
}) {
10+
const [searchString, setSearchString] = useState('');
11+
const [inkluderLukkede, setInkluderLukkede] = useState(false);
612
return (
713
<form
814
role="search"
915
onSubmit={(e) => {
1016
e.preventDefault();
11-
props.utførSøk(søkeord);
17+
props.utførSøk({ searchString, fraAktiv: !inkluderLukkede });
1218
}}
1319
>
1420
<Search
1521
label="Søk på saksnummer, personnummer eller journalpost-id"
1622
variant="primary"
1723
hideLabel={false}
18-
onChange={setSøkeord}
24+
onChange={setSearchString}
1925
htmlSize={40}
2026
maxLength={11}
2127
onClear={props.nullstillSøk}
2228
clearButton
2329
>
2430
<Search.Button loading={props.loading}>Søk</Search.Button>
2531
</Search>
32+
<VerticalSpacer eightPx />
33+
<Checkbox size="small" value={inkluderLukkede} onChange={() => setInkluderLukkede(!inkluderLukkede)}>
34+
Søk også i lukkede saker
35+
</Checkbox>
2636
</form>
2737
);
2838
}

0 commit comments

Comments
 (0)