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 1 commit
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 @@ -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 @@ -24,6 +24,8 @@ const convert = (() => {
(apiProgramSections || [])
.map(apiProgramSection => ({
...apiProgramSection,
description: undefined,
displayDescription: apiProgramSection.description || '',
simonadomnisoru marked this conversation as resolved.
Show resolved Hide resolved
trackedEntityAttributes: apiProgramSection.trackedEntityAttributes.map(te => te.id),
}))
.sort((a, b) => a.sortOrder - b.sortOrder);
Expand Down Expand Up @@ -93,7 +95,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, description, 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