Skip to content

Commit

Permalink
Legg til "klar til kontroll" og "Under kontroll" som default filter i…
Browse files Browse the repository at this point in the history
… mine oppgaver. Legg til personnummer i oppgaveliste for "Mine oppgaver"
  • Loading branch information
ssaegrov committed Nov 4, 2024
1 parent f510e7a commit 1ba4d89
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 8 deletions.
4 changes: 2 additions & 2 deletions app/components/oppgave-filter-status/OppgaveFilterStatus.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@ import { useSearchParams } from "@remix-run/react";
import type { IOppgaveTilstand } from "~/models/oppgave.server";

const statuser: { id: IOppgaveTilstand; tekst: string }[] = [
{ id: "KLAR_TIL_KONTROLL", tekst: "Klar til kontroll" },
{ id: "UNDER_KONTROLL", tekst: "Under kontroll" },
{ id: "KLAR_TIL_BEHANDLING", tekst: "Klar til behandling" },
{ id: "UNDER_BEHANDLING", tekst: "Under behandling" },
{ id: "FERDIG_BEHANDLET", tekst: "Ferdig behandlet" },
{ id: "UNDER_KONTROLL", tekst: "Under kontroll" },
{ id: "KLAR_TIL_KONTROLL", tekst: "Til kontroll" },
{ id: "PAA_VENT", tekst: "På vent" },
];

Expand Down
13 changes: 12 additions & 1 deletion app/components/oppgave-liste/OppgaveListe.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,17 @@ import styles from "./OppgaveListe.module.css";
interface IProps {
oppgaver: IListeOppgave[];
lasterOppgaver?: boolean;
visNesteOppgaveKnapp?: boolean;
visPersonIdent?: boolean;
visAntallOppgaver?: boolean;
visNesteOppgaveKnapp?: boolean;
}

export function OppgaveListe({
oppgaver,
visNesteOppgaveKnapp,
visAntallOppgaver,
lasterOppgaver,
visPersonIdent,
}: IProps) {
const { state } = useNavigation();
const location = useLocation();
Expand Down Expand Up @@ -83,6 +85,12 @@ export function OppgaveListe({
<Detail>Emne</Detail>
</Table.ColumnHeader>

{visPersonIdent && (
<Table.ColumnHeader scope="col">
<Detail>Personnummer</Detail>
</Table.ColumnHeader>
)}

<Table.ColumnHeader scope="col">
<Detail>Status</Detail>
</Table.ColumnHeader>
Expand Down Expand Up @@ -190,6 +198,9 @@ export function OppgaveListe({
</>
</Table.DataCell>

{visPersonIdent && (
<Table.DataCell>{<Detail>{oppgave.personIdent}</Detail>}</Table.DataCell>
)}
<Table.DataCell>{<Detail>{getTilstandText(tilstand)}</Detail>}</Table.DataCell>
<Table.DataCell>{<Detail>{oppgave.behandlerIdent}</Detail>}</Table.DataCell>
<Table.DataCell>{<OppgaveListeValg oppgave={oppgave} />}</Table.DataCell>
Expand Down
14 changes: 9 additions & 5 deletions app/routes/_oppgaver._index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,15 @@ export async function loader({ request }: LoaderFunctionArgs) {
const url = new URL(request.url);

if (!url.search) {
const appended = appendSearchParamIfNotExists(
url.searchParams,
"tilstand",
"KLAR_TIL_BEHANDLING",
);
const paramsToAppend = [
{ key: "tilstand", value: "KLAR_TIL_KONTROLL" },
{ key: "tilstand", value: "KLAR_TIL_BEHANDLING" },
];

let appended = false;
for (const { key, value } of paramsToAppend) {
appended = appendSearchParamIfNotExists(url.searchParams, key, value) || appended;
}

if (appended) {
return redirect(url.toString());
Expand Down
3 changes: 3 additions & 0 deletions app/routes/_oppgaver.mine-oppgaver.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,9 @@ export async function loader({ request }: LoaderFunctionArgs) {
if (!url.search) {
const paramsToAppend = [
{ key: "mineOppgaver", value: "true" },
{ key: "tilstand", value: "KLAR_TIL_KONTROLL" },
{ key: "tilstand", value: "KLAR_TIL_BEHANDLING" },
{ key: "tilstand", value: "UNDER_KONTROLL" },
{ key: "tilstand", value: "UNDER_BEHANDLING" },
];

Expand Down Expand Up @@ -73,6 +75,7 @@ export default function Saksbehandling() {
<OppgaveListe
oppgaver={oppgaver}
visAntallOppgaver={true}
visPersonIdent={true}
lasterOppgaver={state !== "idle"}
/>
</main>
Expand Down

0 comments on commit 1ba4d89

Please sign in to comment.