Skip to content

Commit

Permalink
Legg til filter for ugyldige janzz
Browse files Browse the repository at this point in the history
  • Loading branch information
joarau committed Nov 7, 2024
1 parent a60555b commit 03946b9
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
1 change: 0 additions & 1 deletion src/stilling/stilling/adValidationReducer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,6 @@ function* validateLocationArea(): Generator<unknown, any, any> {
function* validateYrkestittel(): Generator<unknown, any, any> {
const state = yield select();
const { categoryList } = state.adData;
console.log('validateYrkestittel SET_JANZZ', categoryList);

if (valueIsNotSet(categoryList)) {
yield addValidationError({ field: 'yrkestittel', message: 'Gyldig yrkestittel må velges' });
Expand Down
10 changes: 8 additions & 2 deletions src/stilling/stilling/edit/om-stillingen/janzz/Janzz.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,12 @@ const Janzz: FunctionComponent<Props> = ({ tittel }) => {

const feilmeldingTilBruker = error ? error.message : undefined;

const filteredSuggestions = suggestions
? suggestions
.filter((f) => f.styrk08 && f.styrk08.trim() !== '' && f.styrk08 !== '9999')
.map((f) => f.label)
: [];

return (
<div>
<UnsafeCombobox
Expand All @@ -68,15 +74,15 @@ const Janzz: FunctionComponent<Props> = ({ tittel }) => {
? ''
: input
}
options={suggestions ? suggestions.map((f) => f.label) : []}
options={filteredSuggestions}
onChange={onChange}
onToggleSelected={onToggleSelected}
onBlur={onBlur}
isLoading={isLoading}
error={yrkestittelError || feilmeldingTilBruker}
className={css.typeahead}
aria-labelledby="endre-stilling-styrk"
filteredOptions={suggestions ? suggestions.map((f) => f.label) : []}
filteredOptions={filteredSuggestions}
/>
</div>
);
Expand Down

0 comments on commit 03946b9

Please sign in to comment.