diff --git a/libs/portals/admin/regulations-admin/src/components/EditBasics.tsx b/libs/portals/admin/regulations-admin/src/components/EditBasics.tsx index 8cba7f4fa0af..e22666a41997 100644 --- a/libs/portals/admin/regulations-admin/src/components/EditBasics.tsx +++ b/libs/portals/admin/regulations-admin/src/components/EditBasics.tsx @@ -11,7 +11,7 @@ import { Select, } from '@island.is/island-ui/core' import { EditorInput } from './EditorInput' -import { editorMsgs as msg, errorMsgs, m } from '../lib/messages' +import { editorMsgs as msg, errorMsgs, m, editorMsgs } from '../lib/messages' import { useLocale } from '@island.is/localization' import { Appendixes } from './Appendixes' import { MagicTextarea } from './MagicTextarea' @@ -238,34 +238,43 @@ export const EditBasics = () => { /> ) : ( - ({ + value: ministry.name, + label: ministry.name, + })), + ]} + required={false} + onChange={(option) => actions.setMinistry(option?.value)} + backgroundColor="white" + hasError={ + draft.ministry.showError && + !!draft.ministry.error && + !!draft.ministry.value + } + errorMessage={draft.ministry.error && t(draft.ministry.error)} + /> + ) )} diff --git a/libs/portals/admin/regulations-admin/src/lib/messages.ts b/libs/portals/admin/regulations-admin/src/lib/messages.ts index 5b41c6c6b044..76e22c1e038b 100644 --- a/libs/portals/admin/regulations-admin/src/lib/messages.ts +++ b/libs/portals/admin/regulations-admin/src/lib/messages.ts @@ -350,6 +350,10 @@ export const editorMsgs = defineMessages({ defaultMessage: 'Vakin er athygli á því að kerfið útbýr tillögu að breytingareglugerð sem starfsmaður þarf að rýna gaumgæfilega áður en haldið er áfram. Ekki er öruggt að inngangsliðir og efnisákvæði færist réttilega inn í breytingareglugerðina.', }, + selectMinistry: { + id: 'ap.regulations-admin:select-ministry', + defaultMessage: 'Veldu ráðuneyti', + }, }) export const impactMsgs = defineMessages({ diff --git a/libs/portals/admin/regulations-admin/src/state/actionHandlers.ts b/libs/portals/admin/regulations-admin/src/state/actionHandlers.ts index 62de5cf1ba6e..2f87e7279e5a 100644 --- a/libs/portals/admin/regulations-admin/src/state/actionHandlers.ts +++ b/libs/portals/admin/regulations-admin/src/state/actionHandlers.ts @@ -136,11 +136,7 @@ export const actionHandlers: { }, SET_MINISTRY: (state, { value }) => { - if (value) { - updateFieldValue(state.draft.ministry, value) - } else { - updateFieldValue(state.draft.ministry, undefined) - } + updateFieldValue(state.draft.ministry, value ?? undefined) }, SET_IMPACT: (state, { impactId }) => {