openchs-models 1.12.0 → 1.13.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/Schema.js +1 -1
- package/dist/SubjectType.js +6 -0
- package/dist/application/Form.js +19 -5
- package/package.json +1 -1
package/dist/Schema.js
CHANGED
|
@@ -168,7 +168,7 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
|
|
|
168
168
|
var _default = {
|
|
169
169
|
//order is important, should be arranged according to the dependency
|
|
170
170
|
schema: [_LocaleMapping.default, _Settings.default, _Concept.ConceptAnswer, _Concept.default, _EncounterType.default, _Gender.default, _UserDefinedIndividualProperty.default, _AddressLevel.LocationMapping, _AddressLevel.default, _KeyValue.default, _Form.default, _FormMapping.default, _FormElementGroup.default, _FormElement.default, _SubjectType.default, _Individual.default, _ProgramOutcome.default, _Program.default, _ProgramEnrolment.default, _Observation.default, _ProgramEncounter.default, _Encounter.default, _EntitySyncStatus.default, _EntityQueue.default, _ConfigFile.default, _Checklist.default, _ChecklistItem.default, _Format.default, _UserInfo.default, _StringKeyNumericValue.default, _VisitScheduleInterval.default, _VisitScheduleConfig.default, _ProgramConfig.default, _Family.default, _IndividualRelation.default, _IndividualRelationGenderMapping.default, _IndividualRelationshipType.default, _IndividualRelationship.default, _RuleDependency.default, _Rule.default, _ChecklistItemStatus.default, _ChecklistDetail.default, _ChecklistItemDetail.default, _VideoTelemetric.default, _Video.default, _MediaQueue.default, _Point.default, _SyncTelemetry.default, _IdentifierSource.default, _IdentifierAssignment.default, _RuleFailureTelemetry.default, _BeneficiaryModePin.default, _OrganisationConfig.default, _PlatformTranslation.default, _Translation.default, _Groups.default, _MyGroups.default, _GroupPrivileges.default, _Privilege.default, _GroupRole.default, _GroupSubject.default, _DashboardCache.default, _LocationHierarchy.default, _ReportCard.default, _Dashboard.default, _DashboardSectionCardMapping.default, _DraftSubject.default, _StandardReportCardType.default, _ApprovalStatus.default, _EntityApprovalStatus.default, _GroupDashboard.default, _DashboardSection.default, _News.default, _Comment.default, _CommentThread.default, _Extension.default, _SubjectMigration.default],
|
|
171
|
-
schemaVersion:
|
|
171
|
+
schemaVersion: 151,
|
|
172
172
|
migration: function (oldDB, newDB) {
|
|
173
173
|
if (oldDB.schemaVersion < 10) {
|
|
174
174
|
var oldObjects = oldDB.objects("DecisionConfig");
|
package/dist/SubjectType.js
CHANGED
|
@@ -63,6 +63,7 @@ class SubjectType extends _ReferenceEntity.default {
|
|
|
63
63
|
subjectType.iconFileS3Key = operationalSubjectType.iconFileS3Key;
|
|
64
64
|
subjectType.syncRegistrationConcept1 = _ResourceUtil.default.getUUIDFor(operationalSubjectType, 'syncRegistrationConcept1');
|
|
65
65
|
subjectType.syncRegistrationConcept2 = _ResourceUtil.default.getUUIDFor(operationalSubjectType, 'syncRegistrationConcept2');
|
|
66
|
+
subjectType.nameHelpText = _ResourceUtil.default.getUUIDFor(operationalSubjectType, 'nameHelpText');
|
|
66
67
|
return subjectType;
|
|
67
68
|
}
|
|
68
69
|
|
|
@@ -83,6 +84,7 @@ class SubjectType extends _ReferenceEntity.default {
|
|
|
83
84
|
cloned.iconFileS3Key = this.iconFileS3Key;
|
|
84
85
|
cloned.syncRegistrationConcept1 = this.syncRegistrationConcept1;
|
|
85
86
|
cloned.syncRegistrationConcept2 = this.syncRegistrationConcept2;
|
|
87
|
+
cloned.nameHelpText = this.nameHelpText;
|
|
86
88
|
return cloned;
|
|
87
89
|
}
|
|
88
90
|
|
|
@@ -162,6 +164,10 @@ _defineProperty(SubjectType, "schema", {
|
|
|
162
164
|
syncRegistrationConcept2: {
|
|
163
165
|
type: "string",
|
|
164
166
|
optional: true
|
|
167
|
+
},
|
|
168
|
+
nameHelpText: {
|
|
169
|
+
type: "string",
|
|
170
|
+
optional: true
|
|
165
171
|
}
|
|
166
172
|
}
|
|
167
173
|
});
|
package/dist/application/Form.js
CHANGED
|
@@ -180,17 +180,31 @@ class Form {
|
|
|
180
180
|
return sections;
|
|
181
181
|
}
|
|
182
182
|
|
|
183
|
+
orderQuestionGroupObservations(observations, groupUuid) {
|
|
184
|
+
const childFormElements = [];
|
|
185
|
+
const orderedChildObs = [];
|
|
186
|
+
|
|
187
|
+
_lodash.default.forEach(this.formElementGroups, feg => _lodash.default.forEach(feg.getFormElements(), fe => {
|
|
188
|
+
if (fe.groupUuid === groupUuid) {
|
|
189
|
+
childFormElements.push(fe);
|
|
190
|
+
}
|
|
191
|
+
}));
|
|
192
|
+
|
|
193
|
+
const orderedFormElements = _lodash.default.sortBy(childFormElements, fe => fe.displayOrder);
|
|
194
|
+
|
|
195
|
+
_lodash.default.forEach(orderedFormElements, formElement => this.addSortedObservations(formElement, observations, orderedChildObs));
|
|
196
|
+
|
|
197
|
+
return orderedChildObs;
|
|
198
|
+
}
|
|
199
|
+
|
|
183
200
|
addSortedObservations(formElement, observations, orderedObservations) {
|
|
184
201
|
const concept = formElement.concept;
|
|
185
202
|
const foundObs = observations.find(obs => obs.concept.uuid === concept.uuid);
|
|
186
203
|
|
|
187
204
|
if (!_lodash.default.isNil(foundObs) && concept.isQuestionGroup()) {
|
|
188
205
|
const clonedObs = foundObs.cloneForEdit();
|
|
189
|
-
const sortedChildObs = this.
|
|
190
|
-
|
|
191
|
-
const uniqueObs = _lodash.default.uniqBy(sortedChildObs, obs => obs.concept.uuid);
|
|
192
|
-
|
|
193
|
-
clonedObs.valueJSON = JSON.stringify(new _QuestionGroup.default(uniqueObs));
|
|
206
|
+
const sortedChildObs = this.orderQuestionGroupObservations(clonedObs.getValueWrapper().getValue(), formElement.uuid);
|
|
207
|
+
clonedObs.valueJSON = JSON.stringify(new _QuestionGroup.default(sortedChildObs));
|
|
194
208
|
if (!_lodash.default.isEmpty(sortedChildObs)) orderedObservations.push(clonedObs);
|
|
195
209
|
} else {
|
|
196
210
|
if (!_lodash.default.isNil(foundObs)) orderedObservations.push(foundObs);
|