diff --git a/src/pages/dataElements/form/CustomAttributes.tsx b/src/pages/dataElements/form/CustomAttributes.tsx index 2eaf1bd9..80cb7cc3 100644 --- a/src/pages/dataElements/form/CustomAttributes.tsx +++ b/src/pages/dataElements/form/CustomAttributes.tsx @@ -1,3 +1,4 @@ +import i18n from '@dhis2/d2-i18n' import { InputFieldFF, SingleSelectFieldFF, TextAreaFieldFF } from '@dhis2/ui' import * as React from 'react' import { Field as FieldRFF } from 'react-final-form' @@ -11,16 +12,25 @@ type CustomAttributeProps = { index: number } +type DisplayOptions = Array<{ + value: string | undefined + label: string +}> + function CustomAttribute({ attribute, index }: CustomAttributeProps) { const name = `attributeValues[${index}].value` if (attribute.optionSet?.options) { - const options = attribute.optionSet?.options.map( + let options: DisplayOptions = [ + { value: undefined, label: i18n.t('') }, + ] + const mappedOptions = attribute.optionSet.options.map( ({ code, displayName }) => ({ value: code, label: displayName, }) ) + options = options.concat(mappedOptions) return (