Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: [DHIS2-12288] add enrollment section description #3750

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading