diff --git a/src/core_modules/capture-core/components/WidgetEnrollment/Date/Date.component.js b/src/core_modules/capture-core/components/WidgetEnrollment/Date/Date.component.js index f3c7f36617..0fdba91aea 100644 --- a/src/core_modules/capture-core/components/WidgetEnrollment/Date/Date.component.js +++ b/src/core_modules/capture-core/components/WidgetEnrollment/Date/Date.component.js @@ -17,6 +17,7 @@ import { dataElementTypes } from '../../../metaData'; type Props = { date: string, dateLabel: string, + locale: string, editEnabled: boolean, displayAutoGeneratedEventWarning: boolean, onSave: (string) => void, @@ -66,6 +67,7 @@ const styles = { const DateComponentPlain = ({ date, dateLabel, + locale, editEnabled, displayAutoGeneratedEventWarning, onSave, @@ -103,6 +105,7 @@ const DateComponentPlain = ({ className={classes.calendar} label={dateLabel} date={selectedDate} + locale={locale} onDateSelect={dateChangeHandler} /> diff --git a/src/core_modules/capture-core/components/WidgetEnrollment/WidgetEnrollment.component.js b/src/core_modules/capture-core/components/WidgetEnrollment/WidgetEnrollment.component.js index 15ebdb7c41..78c7f1cb08 100644 --- a/src/core_modules/capture-core/components/WidgetEnrollment/WidgetEnrollment.component.js +++ b/src/core_modules/capture-core/components/WidgetEnrollment/WidgetEnrollment.component.js @@ -42,14 +42,15 @@ const styles = { const getGeometryType = geometryType => (geometryType === 'Point' ? dataElementTypes.COORDINATE : dataElementTypes.POLYGON); -const getEnrollmentDateLabel = program => program.enrollmentDateLabel || i18n.t('Enrollment date'); -const getIncidentDateLabel = program => program.incidentDateLabel || i18n.t('Incident date'); +const getEnrollmentDateLabel = program => program.displayEnrollmentDateLabel || i18n.t('Enrollment date'); +const getIncidentDateLabel = program => program.displayIncidentDateLabel || i18n.t('Incident date'); export const WidgetEnrollmentPlain = ({ classes, enrollment = {}, program = {}, ownerOrgUnit = {}, + locale, refetchEnrollment, refetchTEI, initError, @@ -97,6 +98,7 @@ export const WidgetEnrollmentPlain = ({ item.program === programId) .every(item => item.status !== plainStatus.ACTIVE); const containsAutoGeneratedEvent = program && program.programStages.some(({ autoGenerateEvent }) => autoGenerateEvent); - const error = errorEnrollment || errorProgram || errorOwnerOrgUnit || errorOrgUnit; + const error = errorEnrollment || errorProgram || errorOwnerOrgUnit || errorOrgUnit || errorLocale; if (error) { log.error(errorCreator('Enrollment widget could not be loaded')({ error })); @@ -62,7 +64,8 @@ export const WidgetEnrollment = ({ refetchEnrollment={refetchEnrollment} refetchTEI={refetchTEI} ownerOrgUnit={{ id: ownerOrgUnit, displayName }} - loading={!(enrollment && program && displayName)} + locale={locale} + loading={!(enrollment && program && displayName && locale)} onDelete={onDelete} onAddNew={onAddNew} updateEnrollmentDate={updateEnrollmentDate} diff --git a/src/core_modules/capture-core/components/WidgetEnrollment/enrollment.types.js b/src/core_modules/capture-core/components/WidgetEnrollment/enrollment.types.js index d4e14794b8..42e5188ab4 100644 --- a/src/core_modules/capture-core/components/WidgetEnrollment/enrollment.types.js +++ b/src/core_modules/capture-core/components/WidgetEnrollment/enrollment.types.js @@ -18,6 +18,7 @@ export type PlainProps = {| enrollment: Object, program: Object, ownerOrgUnit: Object, + locale: string, refetchEnrollment: QueryRefetchFunction, refetchTEI: QueryRefetchFunction, initError?: FetchError, diff --git a/src/core_modules/capture-core/components/WidgetEnrollment/hooks/useProgram.js b/src/core_modules/capture-core/components/WidgetEnrollment/hooks/useProgram.js index fec7939f6d..4d643cb140 100644 --- a/src/core_modules/capture-core/components/WidgetEnrollment/hooks/useProgram.js +++ b/src/core_modules/capture-core/components/WidgetEnrollment/hooks/useProgram.js @@ -10,7 +10,7 @@ export const useProgram = (programId: string) => { resource: `programs/${programId}`, params: { fields: [ - 'displayIncidentDate,incidentDateLabel,enrollmentDateLabel,onlyEnrollOnce,trackedEntityType[displayName],programStages[autoGenerateEvent],access', + 'displayIncidentDate,displayIncidentDateLabel,displayEnrollmentDateLabel,onlyEnrollOnce,trackedEntityType[displayName],programStages[autoGenerateEvent],access', ], }, },