-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add dynamic attributes to data & event import page (#68) (DHIS2…
…-7495) Fixes DHIS2-7495
- Loading branch information
Showing
9 changed files
with
288 additions
and
58 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,43 @@ | ||
import i18n from '@dhis2/d2-i18n' | ||
import React from 'react' | ||
import { RadioGroup } from '../FinalFormComponents/RadioGroup' | ||
import { | ||
RadioGroup, | ||
RadioGroupContainer, | ||
RadioGroupLabel, | ||
} from '../FinalFormComponents/RadioGroup' | ||
|
||
export const OPTION_UID = { value: 'UID', label: i18n.t('Uid') } | ||
export const OPTION_CODE = { value: 'CODE', label: i18n.t('Code') } | ||
export const OPTION_NAME = { value: 'NAME', label: i18n.t('Name') } | ||
|
||
export const DATA_ELEMENT_ID_SCHEME_DEFAULT_OPTIONS = [ | ||
OPTION_UID, | ||
OPTION_CODE, | ||
OPTION_NAME, | ||
] | ||
export const DATA_ELEMENT_ID_SCHEME_KEY = 'dataElementIdScheme' | ||
export const DATA_ELEMENT_ID_SCHEME_DEFAULT_VALUE = OPTION_UID.value | ||
|
||
export const DataElementIdScheme = () => ( | ||
const dataElementIdSchemeLabel = i18n.t('Data element id scheme') | ||
export const DataElementIdScheme = ({ options }) => ( | ||
<RadioGroup | ||
name={DATA_ELEMENT_ID_SCHEME_KEY} | ||
label={i18n.t('Data element id scheme')} | ||
options={[OPTION_UID, OPTION_CODE, OPTION_NAME]} | ||
label={dataElementIdSchemeLabel} | ||
options={options} | ||
/> | ||
) | ||
|
||
DataElementIdScheme.propTypes = { | ||
options: RadioGroup.propTypes.options, | ||
} | ||
|
||
DataElementIdScheme.defaultProps = { | ||
options: DATA_ELEMENT_ID_SCHEME_DEFAULT_OPTIONS, | ||
} | ||
|
||
export const DataElementIdSchemeLoading = () => ( | ||
<RadioGroupContainer> | ||
<RadioGroupLabel>{dataElementIdSchemeLabel}</RadioGroupLabel> | ||
{i18n.t('Loading data element id scheme options...')} | ||
</RadioGroupContainer> | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,43 @@ | ||
import i18n from '@dhis2/d2-i18n' | ||
import React from 'react' | ||
import { RadioGroup } from '../FinalFormComponents/RadioGroup' | ||
import { | ||
RadioGroup, | ||
RadioGroupContainer, | ||
RadioGroupLabel, | ||
} from '../FinalFormComponents/RadioGroup' | ||
|
||
export const OPTION_UID = { value: 'UID', label: i18n.t('Uid') } | ||
export const OPTION_CODE = { value: 'CODE', label: i18n.t('Code') } | ||
export const OPTION_NAME = { value: 'NAME', label: i18n.t('Name') } | ||
export const OPTION_HR_IDENTIFIER = { | ||
value: 'ATTRIBUTE:UKNKz1H10EE', | ||
label: i18n.t('HR Identifier'), | ||
} | ||
|
||
export const ORG_UNIT_ID_SCHEME_DEFAULT_OPTIONS = [ | ||
OPTION_UID, | ||
OPTION_CODE, | ||
OPTION_NAME, | ||
] | ||
export const ORG_UNIT_ID_SCHEME_KEY = 'orgUnitIdScheme' | ||
export const ORG_UNIT_ID_SCHEME_DEFAULT_VALUE = OPTION_UID.value | ||
|
||
export const OrgUnitIdScheme = () => ( | ||
const orgUnitIdSchemeLabel = i18n.t('Org unit id scheme') | ||
export const OrgUnitIdScheme = ({ options }) => ( | ||
<RadioGroup | ||
name={ORG_UNIT_ID_SCHEME_KEY} | ||
label={i18n.t('Org unit id scheme')} | ||
options={[OPTION_UID, OPTION_CODE, OPTION_NAME]} | ||
label={orgUnitIdSchemeLabel} | ||
options={options} | ||
/> | ||
) | ||
|
||
OrgUnitIdScheme.propTypes = { | ||
options: RadioGroup.propTypes.options, | ||
} | ||
|
||
OrgUnitIdScheme.defaultProps = { | ||
options: ORG_UNIT_ID_SCHEME_DEFAULT_OPTIONS, | ||
} | ||
|
||
export const OrgUnitIdSchemeLoading = () => ( | ||
<RadioGroupContainer> | ||
<RadioGroupLabel>{orgUnitIdSchemeLabel}</RadioGroupLabel> | ||
{i18n.t('Loading organisation unit id scheme options...')} | ||
</RadioGroupContainer> | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.