Skip to content

Commit

Permalink
feat: [DHIS2-12288] add enrollment section description (#3750)
Browse files Browse the repository at this point in the history
  • Loading branch information
eirikhaugstulen authored Aug 13, 2024
1 parent 09905d7 commit 1b4be20
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,7 @@ const buildSection = async ({
optionSets,
sectionCustomLabel,
sectionCustomId,
sectionDisplayDescription,
querySingleResource,
minorServerVersion,
}: {
Expand All @@ -185,6 +186,7 @@ const buildSection = async ({
optionSets: Array<OptionSet>,
sectionCustomLabel: string,
sectionCustomId: string,
sectionDisplayDescription: string,
querySingleResource: QuerySingleResource,
minorServerVersion: number,
}) => {
Expand All @@ -195,6 +197,7 @@ const buildSection = async ({
const section = new Section((o) => {
o.id = sectionCustomId;
o.name = sectionCustomLabel;
o.displayDescription = sectionDisplayDescription;
});

await buildElementsForSection({
Expand Down Expand Up @@ -281,6 +284,7 @@ export const buildFormFoundation = async (program: any, querySingleResource: Que
programTrackedEntityAttributes: attributes,
sectionCustomLabel: formConfigSection.name ?? sectionMetadata?.displayFormName ?? i18n.t('Profile'),
sectionCustomId: formConfigSection.id,
sectionDisplayDescription: sectionMetadata?.displayDescription ?? '',
minorServerVersion,
trackedEntityAttributes,
optionSets,
Expand All @@ -299,6 +303,7 @@ export const buildFormFoundation = async (program: any, querySingleResource: Que
optionSets,
sectionCustomLabel: programSection.displayFormName,
sectionCustomId: programSection.id,
sectionDisplayDescription: programSection.displayDescription,
querySingleResource,
minorServerVersion,
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ const fields =
'dataEntryForm[id,htmlCode],' +
'categoryCombo[id,displayName,isDefault,categories[id,displayName]],' +
'programIndicators[id,displayName,code,shortName,style,displayInForm,expression,displayDescription,description,filter,program[id]],' +
'programSections[id, displayFormName, sortOrder, trackedEntityAttributes],' +
'programSections[id,displayFormName,displayDescription,sortOrder,trackedEntityAttributes],' +
'programRuleVariables[id,displayName,programRuleVariableSourceType,valueType,program[id],programStage[id],dataElement[id],trackedEntityAttribute[id],useCodeForOptionSet],' +
'programStages[id,access,autoGenerateEvent,openAfterEnrollment,generatedByEnrollmentDate,reportDateToUse,minDaysFromStart,displayName,description,executionDateLabel,formType,featureType,validationStrategy,enableUserAssignment,style,' +
'dataEntryForm[id,htmlCode],' +
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,7 @@ export class EnrollmentFactory {
cachedProgramTrackedEntityAttributes?: Array<CachedProgramTrackedEntityAttribute>,
cachedSectionCustomLabel: string,
cachedSectionCustomId: string,
description: string,
) {
if (!cachedProgramTrackedEntityAttributes?.length) {
return null;
Expand All @@ -189,6 +190,7 @@ export class EnrollmentFactory {
const section = new Section((o) => {
o.id = cachedSectionCustomId;
o.name = cachedSectionCustomLabel;
o.displayDescription = description;
o.group = Section.groups.ENROLLMENT;
});

Expand Down Expand Up @@ -302,6 +304,7 @@ export class EnrollmentFactory {
attributes,
formConfigSection.name ?? sectionMetadata?.displayFormName ?? i18n.t('Profile'),
formConfigSection.id,
sectionMetadata?.displayDescription ?? '',
);
section && enrollmentForm.addSection(section);
});
Expand All @@ -312,6 +315,7 @@ export class EnrollmentFactory {
programSection.trackedEntityAttributes.map(id => trackedEntityAttributeDictionary[id]),
programSection.displayFormName,
programSection.id,
programSection.displayDescription,
);
section && enrollmentForm.addSection(section);
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ const fieldsParam = 'id,displayName,displayShortName,description,programType,sty
'programStageSections[id,displayName,displayDescription,sortOrder,dataElements[id]],' +
// eslint-disable-next-line max-len
'programStageDataElements[compulsory,displayInReports,renderOptionsAsRadio,allowFutureDate,renderType[*],dataElement[id]]]' +
'programSections[id, displayFormName, sortOrder, trackedEntityAttributes],' +
'programSections[id, displayDescription, displayFormName, sortOrder, trackedEntityAttributes],' +
// eslint-disable-next-line max-len
'programTrackedEntityAttributes[trackedEntityAttribute[id],displayInList,searchable,mandatory,renderOptionsAsRadio,allowFutureDate]';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,8 @@ type apiProgramSections = {
id: string,
sortOrder: number,
displayFormName: string,
trackedEntityAttributes: Array<{ id: string }>
trackedEntityAttributes: Array<{ id: string }>,
description: ?string
}

type apiOption = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,8 @@ export type CachedProgramSection = {
id: string,
displayFormName: string,
sortOrder: number,
trackedEntityAttributes: Array<string>
trackedEntityAttributes: Array<string>,
displayDescription: string
}

export type CachedTrackedEntityType = {
Expand Down

0 comments on commit 1b4be20

Please sign in to comment.