Skip to content

Commit

Permalink
feat: disable manual coordinate by configuration [DHIS2-17632] (#198)
Browse files Browse the repository at this point in the history
* feat: create manual location checkbox component
* feat: add manual location specific program
* feat: regenerate en.pot
  • Loading branch information
Sharmyn28 authored Sep 4, 2024
1 parent c332dd9 commit 5633946
Show file tree
Hide file tree
Showing 6 changed files with 42 additions and 2 deletions.
10 changes: 8 additions & 2 deletions i18n/en.pot
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ msgstr ""
"Content-Type: text/plain; charset=utf-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=2; plural=(n != 1)\n"
"POT-Creation-Date: 2024-05-28T14:13:22.879Z\n"
"PO-Revision-Date: 2024-05-28T14:13:22.879Z\n"
"POT-Creation-Date: 2024-08-29T01:11:26.030Z\n"
"PO-Revision-Date: 2024-08-29T01:11:26.030Z\n"

msgid ""
"The initial configuration of the app has been completed and it is now ready "
Expand Down Expand Up @@ -434,6 +434,9 @@ msgstr "Manual"
msgid "How often should data sync?"
msgstr "How often should data sync?"

msgid "Disable manual location capture"
msgstr "Disable manual location capture"

msgid "Disable TEI referrals"
msgstr "Disable TEI referrals"

Expand Down Expand Up @@ -932,6 +935,9 @@ msgstr "TEI Header"
msgid "Advanced options"
msgstr "Advanced options"

msgid "Capture Coordinates settings"
msgstr "Capture Coordinates settings"

msgid "Filter"
msgstr "Filter"

Expand Down
19 changes: 19 additions & 0 deletions src/components/field/DisableManualLocation.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import i18n from '@dhis2/d2-i18n'
import PropTypes from 'prop-types'
import React from 'react'
import { DISABLE_MANUAL_LOCATION } from '../../constants'
import { CheckboxField } from './CheckboxField'

export const DisableManualLocation = ({ handleChange, settings }) => (
<CheckboxField
name={DISABLE_MANUAL_LOCATION}
label={i18n.t('Disable manual location capture')}
onChange={handleChange}
checked={settings[DISABLE_MANUAL_LOCATION]}
/>
)

DisableManualLocation.propTypes = {
handleChange: PropTypes.func,
settings: PropTypes.object,
}
1 change: 1 addition & 0 deletions src/components/field/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ export * from './ButtonField'
export * from './BypassDHIS2Version'
export * from './CheckboxField'
export * from './DataSync'
export * from './DisableManualLocation'
export * from './DisableReferral'
export * from './EncryptDB'
export * from './FieldSection'
Expand Down
1 change: 1 addition & 0 deletions src/constants/appearance-settings.js
Original file line number Diff line number Diff line change
Expand Up @@ -92,3 +92,4 @@ export const appearanceDefault = {
export const COMPLETION_SPINNER = 'completionSpinner'
export const DISABLE_REFERRALS = 'disableReferrals'
export const COLLAPSIBLE_SECTIONS = 'disableCollapsibleSections'
export const DISABLE_MANUAL_LOCATION = 'disableManualLocation'
9 changes: 9 additions & 0 deletions src/pages/Appearance/Programs/SpecificSettings.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import i18n from '@dhis2/d2-i18n'
import PropTypes from 'prop-types'
import React from 'react'
import {
DisableManualLocation,
DisableReferral,
HideFormSections,
OptionalTEISearch,
Expand Down Expand Up @@ -55,6 +56,14 @@ const SpecificSettings = ({
/>
</>
</Section>
<Section legend={i18n.t('Capture Coordinates settings')}>
<>
<DisableManualLocation
handleChange={handleSettings}
settings={spinnerSettings}
/>
</>
</Section>
<Section legend={i18n.t('Filter')}>
<>
<TableHeader title={i18n.t('Show Filter')} />
Expand Down
4 changes: 4 additions & 0 deletions src/pages/Appearance/Programs/helper.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ export const createInitialSpinnerValue = (prevDetails) => {
disableReferrals: false,
disableCollapsibleSections: false,
programIndicator: '',
disableManualLocation: false,
})

return {
Expand All @@ -43,6 +44,7 @@ export const createInitialSpinnerValue = (prevDetails) => {
programIndicator:
prevDetails.programIndicator ||
prevDetails?.itemHeader?.programIndicator,
disableManualLocation: prevDetails.disableManualLocation,
}
}

Expand Down Expand Up @@ -89,6 +91,7 @@ export const prepareSpinnerPreviousSpinner = (settings) => {
'disableReferrals',
'disableCollapsibleSections',
'programIndicator',
'disableManualLocation',
]
)
}
Expand Down Expand Up @@ -202,6 +205,7 @@ export const isProgramConfiguration = (configurationType) =>
'disableReferrals',
'disableCollapsibleSections',
'programIndicator',
'disableManualLocation',
].includes(configurationType)

export const removeAttributes = (itemList) =>
Expand Down

0 comments on commit 5633946

Please sign in to comment.