From 47744f526ea723815161f7fc85dfbe9844e5423b Mon Sep 17 00:00:00 2001 From: henrikmv Date: Thu, 14 Nov 2024 09:58:55 +0100 Subject: [PATCH 1/6] feat: add field and label to view event page --- .../ViewEventDataEntry.component.js | 24 ++++++++++++++++++- .../programStage/ProgramStageFactory.js | 1 + .../quickStoreOperations/storePrograms.js | 2 +- .../types/apiPrograms.types.js | 1 + .../storageControllers/cache.types.js | 1 + 5 files changed, 27 insertions(+), 2 deletions(-) diff --git a/src/core_modules/capture-core/components/WidgetEventEdit/ViewEventDataEntry/ViewEventDataEntry.component.js b/src/core_modules/capture-core/components/WidgetEventEdit/ViewEventDataEntry/ViewEventDataEntry.component.js index 550f589dc4..b37a6c9943 100644 --- a/src/core_modules/capture-core/components/WidgetEventEdit/ViewEventDataEntry/ViewEventDataEntry.component.js +++ b/src/core_modules/capture-core/components/WidgetEventEdit/ViewEventDataEntry/ViewEventDataEntry.component.js @@ -139,6 +139,27 @@ const buildReportDateSettingsFn = () => { return reportDateSettings; }; +const buildOrgUnitSettingsFn = () => { + const dataElement = new DataElement((o) => { + o.type = dataElementTypes.ORGANISATION_UNIT; + }); + + const orgUnitSettings = { + getComponent: () => viewModeComponent, + getComponentProps: (props: Object) => createComponentProps(props, { + label: `${props.formFoundation.getLabel('orgUnit')}`, + valueConverter: value => dataElement.convertValue(value, valueConvertFn), + }), + getPropName: () => 'orgUnit', + getMeta: () => ({ + placement: placements.TOP, + section: dataEntrySectionNames.BASICINFO, + }), + }; + + return orgUnitSettings; +}; + const buildScheduleDateSettingsFn = () => { const dataElement = new DataElement((o) => { o.type = dataElementTypes.DATE; @@ -245,7 +266,8 @@ const AOCFieldBuilderHOC = withAOCFieldBuilder({})(withDataEntryFields(getCatego const CleanUpHOC = withCleanUp()(AOCFieldBuilderHOC); const GeometryField = withDataEntryFieldIfApplicable(buildGeometrySettingsFn())(CleanUpHOC); const ScheduleDateField = withDataEntryField(buildScheduleDateSettingsFn())(GeometryField); -const ReportDateField = withDataEntryField(buildReportDateSettingsFn())(ScheduleDateField); +const OrgUnitField = withDataEntryField(buildOrgUnitSettingsFn())(ScheduleDateField); +const ReportDateField = withDataEntryField(buildReportDateSettingsFn())(OrgUnitField); const CompletableDataEntry = withDataEntryField(buildCompleteFieldSettingsFn())(ReportDateField); const DataEntryWrapper = withBrowserBackWarning()(CompletableDataEntry); diff --git a/src/core_modules/capture-core/metaDataMemoryStoreBuilders/programs/factory/programStage/ProgramStageFactory.js b/src/core_modules/capture-core/metaDataMemoryStoreBuilders/programs/factory/programStage/ProgramStageFactory.js index 4241f27b2d..a5d4122722 100644 --- a/src/core_modules/capture-core/metaDataMemoryStoreBuilders/programs/factory/programStage/ProgramStageFactory.js +++ b/src/core_modules/capture-core/metaDataMemoryStoreBuilders/programs/factory/programStage/ProgramStageFactory.js @@ -205,6 +205,7 @@ export class ProgramStageFactory { _form.featureType = ProgramStageFactory._getFeatureType(cachedProgramStage); _form.access = cachedProgramStage.access; _form.addLabel({ id: 'occurredAt', label: cachedProgramStage.displayExecutionDateLabel || 'Report date' }); + _form.addLabel({ id: 'orgUnit', label: cachedProgramStage.displayOrgUnitLabel || 'Organisation unit' }); _form.addLabel({ id: 'scheduledAt', label: cachedProgramStage.displayDueDateLabel || 'Scheduled date' }); _form.validationStrategy = cachedProgramStage.validationStrategy && diff --git a/src/core_modules/capture-core/metaDataStoreLoaders/programs/quickStoreOperations/storePrograms.js b/src/core_modules/capture-core/metaDataStoreLoaders/programs/quickStoreOperations/storePrograms.js index 080f4fcbb3..16a1a06052 100644 --- a/src/core_modules/capture-core/metaDataStoreLoaders/programs/quickStoreOperations/storePrograms.js +++ b/src/core_modules/capture-core/metaDataStoreLoaders/programs/quickStoreOperations/storePrograms.js @@ -89,7 +89,7 @@ const fieldsParam = 'id,displayName,displayShortName,description,programType,sty 'categoryCombo[id,displayName,isDefault,categories[id,displayName]],' + 'userRoles[id,displayName],' + // eslint-disable-next-line max-len -'programStages[id,access,autoGenerateEvent,openAfterEnrollment,hideDueDate,allowGenerateNextVisit,remindCompleted,repeatable,generatedByEnrollmentDate,reportDateToUse,blockEntryForm,minDaysFromStart,name,displayName,description,displayExecutionDateLabel,displayDueDateLabel,formType,featureType,validationStrategy,enableUserAssignment,style,dataEntryForm[id,htmlCode]' + +'programStages[id,access,autoGenerateEvent,openAfterEnrollment,hideDueDate,allowGenerateNextVisit,remindCompleted,repeatable,generatedByEnrollmentDate,reportDateToUse,blockEntryForm,minDaysFromStart,name,displayName,description,displayExecutionDateLabel,displayOrgUnitLabel,displayDueDateLabel,formType,featureType,validationStrategy,enableUserAssignment,style,dataEntryForm[id,htmlCode]' + 'programStageSections[id,displayName,displayDescription,sortOrder,dataElements[id]],' + // eslint-disable-next-line max-len 'programStageDataElements[compulsory,displayInReports,renderOptionsAsRadio,allowFutureDate,renderType[*],dataElement[id]]]' + diff --git a/src/core_modules/capture-core/metaDataStoreLoaders/programs/quickStoreOperations/types/apiPrograms.types.js b/src/core_modules/capture-core/metaDataStoreLoaders/programs/quickStoreOperations/types/apiPrograms.types.js index 1112031950..009c098979 100644 --- a/src/core_modules/capture-core/metaDataStoreLoaders/programs/quickStoreOperations/types/apiPrograms.types.js +++ b/src/core_modules/capture-core/metaDataStoreLoaders/programs/quickStoreOperations/types/apiPrograms.types.js @@ -103,6 +103,7 @@ export type apiProgramStage = { displayName: string, description?: ?string, displayExecutionDateLabel?: ?string, + displayOrgUnitLabel?: ?string, displayDueDateLabel?: ?string, formType: string, featureType: string, diff --git a/src/core_modules/capture-core/storageControllers/cache.types.js b/src/core_modules/capture-core/storageControllers/cache.types.js index d41cb0fa9e..63a8bb95fd 100644 --- a/src/core_modules/capture-core/storageControllers/cache.types.js +++ b/src/core_modules/capture-core/storageControllers/cache.types.js @@ -107,6 +107,7 @@ export type CachedProgramStage = { displayName: string, description: ?string, displayExecutionDateLabel?: ?string, + displayOrgUnitLabel?: ?string, displayDueDateLabel?: ?string, programStageSections: ?Array, programStageDataElements: Array, From 5d512f3e2e183ce98140ea6b3cce95493b30909d Mon Sep 17 00:00:00 2001 From: henrikmv Date: Fri, 15 Nov 2024 11:36:12 +0100 Subject: [PATCH 2/6] feat: add field and label to view event page --- .../ViewEventDataEntry.component.js | 24 ++++++++++++++++++- .../programStage/ProgramStageFactory.js | 1 + .../quickStoreOperations/storePrograms.js | 2 +- .../types/apiPrograms.types.js | 1 + .../storageControllers/cache.types.js | 1 + 5 files changed, 27 insertions(+), 2 deletions(-) diff --git a/src/core_modules/capture-core/components/WidgetEventEdit/ViewEventDataEntry/ViewEventDataEntry.component.js b/src/core_modules/capture-core/components/WidgetEventEdit/ViewEventDataEntry/ViewEventDataEntry.component.js index 550f589dc4..b37a6c9943 100644 --- a/src/core_modules/capture-core/components/WidgetEventEdit/ViewEventDataEntry/ViewEventDataEntry.component.js +++ b/src/core_modules/capture-core/components/WidgetEventEdit/ViewEventDataEntry/ViewEventDataEntry.component.js @@ -139,6 +139,27 @@ const buildReportDateSettingsFn = () => { return reportDateSettings; }; +const buildOrgUnitSettingsFn = () => { + const dataElement = new DataElement((o) => { + o.type = dataElementTypes.ORGANISATION_UNIT; + }); + + const orgUnitSettings = { + getComponent: () => viewModeComponent, + getComponentProps: (props: Object) => createComponentProps(props, { + label: `${props.formFoundation.getLabel('orgUnit')}`, + valueConverter: value => dataElement.convertValue(value, valueConvertFn), + }), + getPropName: () => 'orgUnit', + getMeta: () => ({ + placement: placements.TOP, + section: dataEntrySectionNames.BASICINFO, + }), + }; + + return orgUnitSettings; +}; + const buildScheduleDateSettingsFn = () => { const dataElement = new DataElement((o) => { o.type = dataElementTypes.DATE; @@ -245,7 +266,8 @@ const AOCFieldBuilderHOC = withAOCFieldBuilder({})(withDataEntryFields(getCatego const CleanUpHOC = withCleanUp()(AOCFieldBuilderHOC); const GeometryField = withDataEntryFieldIfApplicable(buildGeometrySettingsFn())(CleanUpHOC); const ScheduleDateField = withDataEntryField(buildScheduleDateSettingsFn())(GeometryField); -const ReportDateField = withDataEntryField(buildReportDateSettingsFn())(ScheduleDateField); +const OrgUnitField = withDataEntryField(buildOrgUnitSettingsFn())(ScheduleDateField); +const ReportDateField = withDataEntryField(buildReportDateSettingsFn())(OrgUnitField); const CompletableDataEntry = withDataEntryField(buildCompleteFieldSettingsFn())(ReportDateField); const DataEntryWrapper = withBrowserBackWarning()(CompletableDataEntry); diff --git a/src/core_modules/capture-core/metaDataMemoryStoreBuilders/programs/factory/programStage/ProgramStageFactory.js b/src/core_modules/capture-core/metaDataMemoryStoreBuilders/programs/factory/programStage/ProgramStageFactory.js index 4241f27b2d..a5d4122722 100644 --- a/src/core_modules/capture-core/metaDataMemoryStoreBuilders/programs/factory/programStage/ProgramStageFactory.js +++ b/src/core_modules/capture-core/metaDataMemoryStoreBuilders/programs/factory/programStage/ProgramStageFactory.js @@ -205,6 +205,7 @@ export class ProgramStageFactory { _form.featureType = ProgramStageFactory._getFeatureType(cachedProgramStage); _form.access = cachedProgramStage.access; _form.addLabel({ id: 'occurredAt', label: cachedProgramStage.displayExecutionDateLabel || 'Report date' }); + _form.addLabel({ id: 'orgUnit', label: cachedProgramStage.displayOrgUnitLabel || 'Organisation unit' }); _form.addLabel({ id: 'scheduledAt', label: cachedProgramStage.displayDueDateLabel || 'Scheduled date' }); _form.validationStrategy = cachedProgramStage.validationStrategy && diff --git a/src/core_modules/capture-core/metaDataStoreLoaders/programs/quickStoreOperations/storePrograms.js b/src/core_modules/capture-core/metaDataStoreLoaders/programs/quickStoreOperations/storePrograms.js index 080f4fcbb3..16a1a06052 100644 --- a/src/core_modules/capture-core/metaDataStoreLoaders/programs/quickStoreOperations/storePrograms.js +++ b/src/core_modules/capture-core/metaDataStoreLoaders/programs/quickStoreOperations/storePrograms.js @@ -89,7 +89,7 @@ const fieldsParam = 'id,displayName,displayShortName,description,programType,sty 'categoryCombo[id,displayName,isDefault,categories[id,displayName]],' + 'userRoles[id,displayName],' + // eslint-disable-next-line max-len -'programStages[id,access,autoGenerateEvent,openAfterEnrollment,hideDueDate,allowGenerateNextVisit,remindCompleted,repeatable,generatedByEnrollmentDate,reportDateToUse,blockEntryForm,minDaysFromStart,name,displayName,description,displayExecutionDateLabel,displayDueDateLabel,formType,featureType,validationStrategy,enableUserAssignment,style,dataEntryForm[id,htmlCode]' + +'programStages[id,access,autoGenerateEvent,openAfterEnrollment,hideDueDate,allowGenerateNextVisit,remindCompleted,repeatable,generatedByEnrollmentDate,reportDateToUse,blockEntryForm,minDaysFromStart,name,displayName,description,displayExecutionDateLabel,displayOrgUnitLabel,displayDueDateLabel,formType,featureType,validationStrategy,enableUserAssignment,style,dataEntryForm[id,htmlCode]' + 'programStageSections[id,displayName,displayDescription,sortOrder,dataElements[id]],' + // eslint-disable-next-line max-len 'programStageDataElements[compulsory,displayInReports,renderOptionsAsRadio,allowFutureDate,renderType[*],dataElement[id]]]' + diff --git a/src/core_modules/capture-core/metaDataStoreLoaders/programs/quickStoreOperations/types/apiPrograms.types.js b/src/core_modules/capture-core/metaDataStoreLoaders/programs/quickStoreOperations/types/apiPrograms.types.js index 1112031950..009c098979 100644 --- a/src/core_modules/capture-core/metaDataStoreLoaders/programs/quickStoreOperations/types/apiPrograms.types.js +++ b/src/core_modules/capture-core/metaDataStoreLoaders/programs/quickStoreOperations/types/apiPrograms.types.js @@ -103,6 +103,7 @@ export type apiProgramStage = { displayName: string, description?: ?string, displayExecutionDateLabel?: ?string, + displayOrgUnitLabel?: ?string, displayDueDateLabel?: ?string, formType: string, featureType: string, diff --git a/src/core_modules/capture-core/storageControllers/cache.types.js b/src/core_modules/capture-core/storageControllers/cache.types.js index d41cb0fa9e..63a8bb95fd 100644 --- a/src/core_modules/capture-core/storageControllers/cache.types.js +++ b/src/core_modules/capture-core/storageControllers/cache.types.js @@ -107,6 +107,7 @@ export type CachedProgramStage = { displayName: string, description: ?string, displayExecutionDateLabel?: ?string, + displayOrgUnitLabel?: ?string, displayDueDateLabel?: ?string, programStageSections: ?Array, programStageDataElements: Array, From 2ac4899516b249dbbcf5b9150a6b75b805f83442 Mon Sep 17 00:00:00 2001 From: henrikmv Date: Thu, 21 Nov 2024 13:47:03 +0100 Subject: [PATCH 3/6] feat: add orgunit id to redux --- .../ViewEventDataEntry/ViewEventDataEntry.component.js | 2 +- .../ViewEventDataEntry/viewEventDataEntry.actions.js | 7 +++++++ src/core_modules/capture-core/converters/clientToView.js | 8 +++----- 3 files changed, 11 insertions(+), 6 deletions(-) diff --git a/src/core_modules/capture-core/components/WidgetEventEdit/ViewEventDataEntry/ViewEventDataEntry.component.js b/src/core_modules/capture-core/components/WidgetEventEdit/ViewEventDataEntry/ViewEventDataEntry.component.js index b37a6c9943..fb4cdc4bf0 100644 --- a/src/core_modules/capture-core/components/WidgetEventEdit/ViewEventDataEntry/ViewEventDataEntry.component.js +++ b/src/core_modules/capture-core/components/WidgetEventEdit/ViewEventDataEntry/ViewEventDataEntry.component.js @@ -150,7 +150,7 @@ const buildOrgUnitSettingsFn = () => { label: `${props.formFoundation.getLabel('orgUnit')}`, valueConverter: value => dataElement.convertValue(value, valueConvertFn), }), - getPropName: () => 'orgUnit', + getPropName: () => 'orgUnitId', getMeta: () => ({ placement: placements.TOP, section: dataEntrySectionNames.BASICINFO, diff --git a/src/core_modules/capture-core/components/WidgetEventEdit/ViewEventDataEntry/viewEventDataEntry.actions.js b/src/core_modules/capture-core/components/WidgetEventEdit/ViewEventDataEntry/viewEventDataEntry.actions.js index a3252ab790..4209221602 100644 --- a/src/core_modules/capture-core/components/WidgetEventEdit/ViewEventDataEntry/viewEventDataEntry.actions.js +++ b/src/core_modules/capture-core/components/WidgetEventEdit/ViewEventDataEntry/viewEventDataEntry.actions.js @@ -67,6 +67,11 @@ export const loadViewEventDataEntry = type: 'DATE', validatorContainers: getEventDateValidatorContainers(), }, + { + id: 'orgUnitId', + type: 'ORGANISATION_UNIT', + validatorContainers: [], + }, { id: 'scheduledAt', type: 'DATE', @@ -117,6 +122,8 @@ export const loadViewEventDataEntry = eventId: eventContainer.event.eventId, }; + console.log('eventContainer', eventContainer); + const { actions: dataEntryActions, dataEntryValues, formValues } = await loadEditDataEntryAsync( dataEntryId, diff --git a/src/core_modules/capture-core/converters/clientToView.js b/src/core_modules/capture-core/converters/clientToView.js index 2849a02b01..fb7728f723 100644 --- a/src/core_modules/capture-core/converters/clientToView.js +++ b/src/core_modules/capture-core/converters/clientToView.js @@ -52,13 +52,11 @@ function convertImageForDisplay(clientValue: ImageClientValue) { return ; } -function convertOrgUnitForDisplay(clientValue: { id: string }) { - return ( - - ); +function convertOrgUnitForDisplay(clientValue: { id: string } | string) { + const orgUnitId = typeof clientValue === 'string' ? clientValue : clientValue.id; + return ; } - const valueConvertersForType = { [dataElementTypes.NUMBER]: stringifyNumber, [dataElementTypes.INTEGER]: stringifyNumber, From 6f3b78007840a595636711357028a0b447dbd5d8 Mon Sep 17 00:00:00 2001 From: henrikmv Date: Thu, 21 Nov 2024 14:07:09 +0100 Subject: [PATCH 4/6] feat: add validator --- i18n/en.pot | 16 +++++----------- .../DataEntry/fieldValidators/index.js | 5 +++++ .../orgUnit.validatorContainersGetter.js | 15 +++++++++++++++ .../viewEventDataEntry.actions.js | 4 ++-- 4 files changed, 27 insertions(+), 13 deletions(-) create mode 100644 src/core_modules/capture-core/components/WidgetEventEdit/DataEntry/fieldValidators/index.js create mode 100644 src/core_modules/capture-core/components/WidgetEventEdit/DataEntry/fieldValidators/orgUnit.validatorContainersGetter.js diff --git a/i18n/en.pot b/i18n/en.pot index 9abb22fa99..c11030a729 100644 --- a/i18n/en.pot +++ b/i18n/en.pot @@ -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-11-04T18:45:47.626Z\n" -"PO-Revision-Date: 2024-11-04T18:45:47.626Z\n" +"POT-Creation-Date: 2024-11-21T13:04:21.389Z\n" +"PO-Revision-Date: 2024-11-21T13:04:21.389Z\n" msgid "Choose one or more dates..." msgstr "Choose one or more dates..." @@ -1288,6 +1288,9 @@ msgstr "Warning" msgid "stage not found in rules execution" msgstr "stage not found in rules execution" +msgid "Please provide an valid organisation unit" +msgstr "Please provide an valid organisation unit" + msgid "Delete event" msgstr "Delete event" @@ -1662,15 +1665,6 @@ msgstr "Follow up" msgid "Choose a program stage to filter by {{label}}" msgstr "Choose a program stage to filter by {{label}}" -msgid "Active enrollments" -msgstr "Active enrollments" - -msgid "Completed enrollments" -msgstr "Completed enrollments" - -msgid "Cancelled enrollments" -msgstr "Cancelled enrollments" - msgid "" "Some enrollments were completed successfully, but there was an error while " "completing the rest. Please see the details below." diff --git a/src/core_modules/capture-core/components/WidgetEventEdit/DataEntry/fieldValidators/index.js b/src/core_modules/capture-core/components/WidgetEventEdit/DataEntry/fieldValidators/index.js new file mode 100644 index 0000000000..1d1e26c9a9 --- /dev/null +++ b/src/core_modules/capture-core/components/WidgetEventEdit/DataEntry/fieldValidators/index.js @@ -0,0 +1,5 @@ +// @flow +export { getCategoryOptionsValidatorContainers } from './categoryOptions.validatorContainersGetter'; +export { getEventDateValidatorContainers } from './eventDate.validatorContainersGetter'; +export { getNoteValidatorContainers } from './note.validatorContainersGetter'; +export { getOrgUnitValidatorContainers } from './orgUnit.validatorContainersGetter'; diff --git a/src/core_modules/capture-core/components/WidgetEventEdit/DataEntry/fieldValidators/orgUnit.validatorContainersGetter.js b/src/core_modules/capture-core/components/WidgetEventEdit/DataEntry/fieldValidators/orgUnit.validatorContainersGetter.js new file mode 100644 index 0000000000..b438a4a494 --- /dev/null +++ b/src/core_modules/capture-core/components/WidgetEventEdit/DataEntry/fieldValidators/orgUnit.validatorContainersGetter.js @@ -0,0 +1,15 @@ +// @flow +import { isValidOrgUnit } from 'capture-core-utils/validators/form'; +import i18n from '@dhis2/d2-i18n'; + +const validateOrgUnit = (value?: ?Object) => isValidOrgUnit(value); + +export const getOrgUnitValidatorContainers = () => { + const validatorContainers = [ + { + validator: validateOrgUnit, + message: i18n.t('Please provide an valid organisation unit'), + }, + ]; + return validatorContainers; +}; diff --git a/src/core_modules/capture-core/components/WidgetEventEdit/ViewEventDataEntry/viewEventDataEntry.actions.js b/src/core_modules/capture-core/components/WidgetEventEdit/ViewEventDataEntry/viewEventDataEntry.actions.js index 4209221602..72e7ee2393 100644 --- a/src/core_modules/capture-core/components/WidgetEventEdit/ViewEventDataEntry/viewEventDataEntry.actions.js +++ b/src/core_modules/capture-core/components/WidgetEventEdit/ViewEventDataEntry/viewEventDataEntry.actions.js @@ -23,7 +23,7 @@ import type { EnrollmentData, AttributeValue, } from '../../Pages/common/EnrollmentOverviewDomain/useCommonEnrollmentDomainData'; -import { getEventDateValidatorContainers } from '../DataEntry/fieldValidators/eventDate.validatorContainersGetter'; +import { getEventDateValidatorContainers, getOrgUnitValidatorContainers } from '../DataEntry/fieldValidators'; import { getCachedSingleResourceFromKeyAsync } from '../../../metaDataMemoryStoreBuilders/baseBuilder/singleResourceFromKeyGetter'; import { userStores } from '../../../storageControllers/stores'; import { FEATURES, hasAPISupportForFeature } from '../../../../capture-core-utils'; @@ -70,7 +70,7 @@ export const loadViewEventDataEntry = { id: 'orgUnitId', type: 'ORGANISATION_UNIT', - validatorContainers: [], + validatorContainers: getOrgUnitValidatorContainers(), }, { id: 'scheduledAt', From 8f4649bba0c9e175d1b597ac29c5305d90d2c454 Mon Sep 17 00:00:00 2001 From: henrikmv Date: Thu, 21 Nov 2024 14:28:09 +0100 Subject: [PATCH 5/6] fix: remove console log --- .../ViewEventDataEntry/viewEventDataEntry.actions.js | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/core_modules/capture-core/components/WidgetEventEdit/ViewEventDataEntry/viewEventDataEntry.actions.js b/src/core_modules/capture-core/components/WidgetEventEdit/ViewEventDataEntry/viewEventDataEntry.actions.js index 72e7ee2393..65b90ecf13 100644 --- a/src/core_modules/capture-core/components/WidgetEventEdit/ViewEventDataEntry/viewEventDataEntry.actions.js +++ b/src/core_modules/capture-core/components/WidgetEventEdit/ViewEventDataEntry/viewEventDataEntry.actions.js @@ -122,8 +122,6 @@ export const loadViewEventDataEntry = eventId: eventContainer.event.eventId, }; - console.log('eventContainer', eventContainer); - const { actions: dataEntryActions, dataEntryValues, formValues } = await loadEditDataEntryAsync( dataEntryId, From 8447356d1ad1be7c6c6511fb463b884c751b5d63 Mon Sep 17 00:00:00 2001 From: henrikmv Date: Fri, 22 Nov 2024 12:08:02 +0100 Subject: [PATCH 6/6] feat: label improvement --- .../ViewEventDataEntry/ViewEventDataEntry.component.js | 2 +- .../programs/factory/programStage/ProgramStageFactory.js | 1 - .../programs/quickStoreOperations/storePrograms.js | 2 +- .../programs/quickStoreOperations/types/apiPrograms.types.js | 1 - src/core_modules/capture-core/storageControllers/cache.types.js | 1 - 5 files changed, 2 insertions(+), 5 deletions(-) diff --git a/src/core_modules/capture-core/components/WidgetEventEdit/ViewEventDataEntry/ViewEventDataEntry.component.js b/src/core_modules/capture-core/components/WidgetEventEdit/ViewEventDataEntry/ViewEventDataEntry.component.js index fb4cdc4bf0..eed050d621 100644 --- a/src/core_modules/capture-core/components/WidgetEventEdit/ViewEventDataEntry/ViewEventDataEntry.component.js +++ b/src/core_modules/capture-core/components/WidgetEventEdit/ViewEventDataEntry/ViewEventDataEntry.component.js @@ -147,7 +147,7 @@ const buildOrgUnitSettingsFn = () => { const orgUnitSettings = { getComponent: () => viewModeComponent, getComponentProps: (props: Object) => createComponentProps(props, { - label: `${props.formFoundation.getLabel('orgUnit')}`, + label: i18n.t('Organisation unit'), valueConverter: value => dataElement.convertValue(value, valueConvertFn), }), getPropName: () => 'orgUnitId', diff --git a/src/core_modules/capture-core/metaDataMemoryStoreBuilders/programs/factory/programStage/ProgramStageFactory.js b/src/core_modules/capture-core/metaDataMemoryStoreBuilders/programs/factory/programStage/ProgramStageFactory.js index a5d4122722..4241f27b2d 100644 --- a/src/core_modules/capture-core/metaDataMemoryStoreBuilders/programs/factory/programStage/ProgramStageFactory.js +++ b/src/core_modules/capture-core/metaDataMemoryStoreBuilders/programs/factory/programStage/ProgramStageFactory.js @@ -205,7 +205,6 @@ export class ProgramStageFactory { _form.featureType = ProgramStageFactory._getFeatureType(cachedProgramStage); _form.access = cachedProgramStage.access; _form.addLabel({ id: 'occurredAt', label: cachedProgramStage.displayExecutionDateLabel || 'Report date' }); - _form.addLabel({ id: 'orgUnit', label: cachedProgramStage.displayOrgUnitLabel || 'Organisation unit' }); _form.addLabel({ id: 'scheduledAt', label: cachedProgramStage.displayDueDateLabel || 'Scheduled date' }); _form.validationStrategy = cachedProgramStage.validationStrategy && diff --git a/src/core_modules/capture-core/metaDataStoreLoaders/programs/quickStoreOperations/storePrograms.js b/src/core_modules/capture-core/metaDataStoreLoaders/programs/quickStoreOperations/storePrograms.js index 16a1a06052..080f4fcbb3 100644 --- a/src/core_modules/capture-core/metaDataStoreLoaders/programs/quickStoreOperations/storePrograms.js +++ b/src/core_modules/capture-core/metaDataStoreLoaders/programs/quickStoreOperations/storePrograms.js @@ -89,7 +89,7 @@ const fieldsParam = 'id,displayName,displayShortName,description,programType,sty 'categoryCombo[id,displayName,isDefault,categories[id,displayName]],' + 'userRoles[id,displayName],' + // eslint-disable-next-line max-len -'programStages[id,access,autoGenerateEvent,openAfterEnrollment,hideDueDate,allowGenerateNextVisit,remindCompleted,repeatable,generatedByEnrollmentDate,reportDateToUse,blockEntryForm,minDaysFromStart,name,displayName,description,displayExecutionDateLabel,displayOrgUnitLabel,displayDueDateLabel,formType,featureType,validationStrategy,enableUserAssignment,style,dataEntryForm[id,htmlCode]' + +'programStages[id,access,autoGenerateEvent,openAfterEnrollment,hideDueDate,allowGenerateNextVisit,remindCompleted,repeatable,generatedByEnrollmentDate,reportDateToUse,blockEntryForm,minDaysFromStart,name,displayName,description,displayExecutionDateLabel,displayDueDateLabel,formType,featureType,validationStrategy,enableUserAssignment,style,dataEntryForm[id,htmlCode]' + 'programStageSections[id,displayName,displayDescription,sortOrder,dataElements[id]],' + // eslint-disable-next-line max-len 'programStageDataElements[compulsory,displayInReports,renderOptionsAsRadio,allowFutureDate,renderType[*],dataElement[id]]]' + diff --git a/src/core_modules/capture-core/metaDataStoreLoaders/programs/quickStoreOperations/types/apiPrograms.types.js b/src/core_modules/capture-core/metaDataStoreLoaders/programs/quickStoreOperations/types/apiPrograms.types.js index 009c098979..1112031950 100644 --- a/src/core_modules/capture-core/metaDataStoreLoaders/programs/quickStoreOperations/types/apiPrograms.types.js +++ b/src/core_modules/capture-core/metaDataStoreLoaders/programs/quickStoreOperations/types/apiPrograms.types.js @@ -103,7 +103,6 @@ export type apiProgramStage = { displayName: string, description?: ?string, displayExecutionDateLabel?: ?string, - displayOrgUnitLabel?: ?string, displayDueDateLabel?: ?string, formType: string, featureType: string, diff --git a/src/core_modules/capture-core/storageControllers/cache.types.js b/src/core_modules/capture-core/storageControllers/cache.types.js index 63a8bb95fd..d41cb0fa9e 100644 --- a/src/core_modules/capture-core/storageControllers/cache.types.js +++ b/src/core_modules/capture-core/storageControllers/cache.types.js @@ -107,7 +107,6 @@ export type CachedProgramStage = { displayName: string, description: ?string, displayExecutionDateLabel?: ?string, - displayOrgUnitLabel?: ?string, displayDueDateLabel?: ?string, programStageSections: ?Array, programStageDataElements: Array,