Skip to content

Commit

Permalink
Kodeverk: Vise tilbakekreving-tittel riktig (#6589)
Browse files Browse the repository at this point in the history
  • Loading branch information
thomashwi authored Sep 17, 2024
1 parent 74068fe commit dffb221
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 9 deletions.
18 changes: 12 additions & 6 deletions packages/sak-behandling-velger/src/components/BehandlingPicker.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,19 @@ import styles from './behandlingPicker.module.css';
const getBehandlingNavn = (behandlingTypeKode, intl: IntlShape) => {
const { kodeverkNavnFraKode } = useKodeverkContext();

if (
[behandlingType.FORSTEGANGSSOKNAD, behandlingType.KLAGE, behandlingType.TILBAKEKREVING].includes(behandlingTypeKode)
) {
return kodeverkNavnFraKode(behandlingTypeKode, KodeverkType.BEHANDLING_TYPE);
}
switch (behandlingTypeKode) {
case behandlingType.FORSTEGANGSSOKNAD:
return kodeverkNavnFraKode(behandlingTypeKode, KodeverkType.BEHANDLING_TYPE);

case behandlingType.KLAGE:
return kodeverkNavnFraKode(behandlingTypeKode, KodeverkType.BEHANDLING_TYPE, 'kodeverkKlage');

return intl.formatMessage({ id: 'BehandlingPickerItemContent.BehandlingTypeNavn.Viderebehandling' });
case behandlingType.TILBAKEKREVING:
return kodeverkNavnFraKode(behandlingTypeKode, KodeverkType.BEHANDLING_TYPE, 'kodeverkTilbake');

default:
return intl.formatMessage({ id: 'BehandlingPickerItemContent.BehandlingTypeNavn.Viderebehandling' });
}
};

const erAutomatiskBehandlet = (behandling: BehandlingAppKontekst) =>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,9 @@ import {
behandlingType as behandlingTypeK9Klage,
type BehandlingType as BehandlingTypeK9Klage,
} from '../../../k9klage/kodeverk/behandling/BehandlingType.js';
import type { Kodeverk } from '../../../shared/Kodeverk.ts';

export type BehandlingType = BehandlingTypeK9Sak | BehandlingTypeK9Klage;

export type BehandlingTypeKodeverk = Kodeverk<BehandlingType, 'BEHANDLING_TYPE'>;

const values: string[] = [...Object.values(behandlingTypeK9Sak), ...Object.values(behandlingTypeK9Klage)];

export const isBehandlingType = (t: string): t is BehandlingType => values.includes(t);

0 comments on commit dffb221

Please sign in to comment.