openchs-models 1.32.8 → 1.32.10

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.
@@ -165,7 +165,8 @@ const refData = (clazz, {
165
165
  syncWeight,
166
166
  resUrl,
167
167
  syncPushRequired = true,
168
- syncPullRequired = true
168
+ syncPullRequired = true,
169
+ apiVersion
169
170
  } = {}) => ({
170
171
  schemaName: clazz.schema.name,
171
172
  entityName: clazz.schema.name,
@@ -178,7 +179,8 @@ const refData = (clazz, {
178
179
  syncWeight: syncWeight,
179
180
  resourceUrl: resUrl,
180
181
  syncPushRequired,
181
- syncPullRequired
182
+ syncPullRequired,
183
+ apiVersion
182
184
  });
183
185
 
184
186
  const refDataNameTranslated = (clazz, attrs = {}) => refData(clazz, _objectSpread({}, attrs, {
@@ -395,7 +397,7 @@ const identifierAssignment = txData(_IdentifierAssignment.default, {
395
397
  const ruleFailureTelemetry = txData(_RuleFailureTelemetry.default, {
396
398
  resUrl: "ruleFailureTelemetry",
397
399
  syncWeight: 0,
398
- syncPullRequired: false
400
+ syncPullFRequired: false
399
401
  });
400
402
  const groups = refData(_Groups.default, {
401
403
  res: "groups",
@@ -429,28 +431,34 @@ const locationHierarchy = refData(_LocationHierarchy.default, {
429
431
  });
430
432
  const reportCard = refData(_ReportCard.default, {
431
433
  res: "card",
432
- syncWeight: 0
434
+ syncWeight: 0,
435
+ apiVersion: "v2"
433
436
  });
434
437
  const dashboard = refData(_Dashboard.default, {
435
438
  res: "dashboard",
436
- syncWeight: 0
439
+ syncWeight: 0,
440
+ apiVersion: "v2"
437
441
  });
438
442
  const dashboardFilter = refData(_DashboardFilter.default, {
439
443
  res: 'dashboardFilter',
440
444
  parent: dashboard,
441
- syncWeight: 0
445
+ syncWeight: 0,
446
+ apiVersion: "v2"
442
447
  });
443
448
  const dashboardSection = refData(_DashboardSection.default, {
444
449
  res: "dashboardSection",
445
- syncWeight: 0
450
+ syncWeight: 0,
451
+ apiVersion: "v2"
446
452
  });
447
453
  const dashboardSectionCardMapping = refData(_DashboardSectionCardMapping.default, {
448
454
  res: "dashboardSectionCardMapping",
449
- syncWeight: 0
455
+ syncWeight: 0,
456
+ apiVersion: "v2"
450
457
  });
451
458
  const standardReportCardType = refData(_StandardReportCardType.default, {
452
459
  res: "standardReportCardType",
453
- syncWeight: 0
460
+ syncWeight: 0,
461
+ apiVersion: "v2"
454
462
  });
455
463
  const approvalStatus = refData(_ApprovalStatus.default, {
456
464
  res: "approvalStatus",
package/dist/Schema.js CHANGED
@@ -921,21 +921,6 @@ function createRealmConfig() {
921
921
  if (oldDB.schemaVersion < 191) {
922
922
  newDB.delete(newDB.objects("CustomDashboardCache"));
923
923
  }
924
-
925
- if (oldDB.schemaVersion < 197) {
926
- const oldObjects = oldDB.objects(_FormElementGroup.default.schema.name);
927
- const newObjects = newDB.objects(_FormElementGroup.default.schema.name); // loop through all objects and set the name property in the
928
- // new schema to display property
929
-
930
- for (const objectIndex in oldObjects) {
931
- const oldObject = oldObjects[objectIndex];
932
- const newObject = newObjects[objectIndex];
933
-
934
- if (!_lodash.default.isEmpty(oldObject.display) && oldObject.name !== oldObject.display) {
935
- newObject.name = oldObject.display;
936
- }
937
- }
938
- }
939
924
  }
940
925
  };
941
926
  }
@@ -42,28 +42,36 @@ class StandardReportCardType extends _BaseEntity.default {
42
42
  this.that.description = x;
43
43
  }
44
44
 
45
+ get type() {
46
+ return this.that.type;
47
+ }
48
+
49
+ set type(x) {
50
+ this.that.type = x;
51
+ }
52
+
45
53
  get iconName() {
46
54
  const typeIcon = {
47
- [StandardReportCardType.type.Approved]: 'check-circle',
48
- [StandardReportCardType.type.Rejected]: 'cancel',
49
- [StandardReportCardType.type.PendingApproval]: 'av-timer',
50
- [StandardReportCardType.type.Comments]: 'message',
51
- [StandardReportCardType.type.CallTasks]: 'call',
52
- [StandardReportCardType.type.OpenSubjectTasks]: 'sticky-note-2'
55
+ [StandardReportCardType.types.Approved]: 'check-circle',
56
+ [StandardReportCardType.types.Rejected]: 'cancel',
57
+ [StandardReportCardType.types.PendingApproval]: 'av-timer',
58
+ [StandardReportCardType.types.Comments]: 'message',
59
+ [StandardReportCardType.types.CallTasks]: 'call',
60
+ [StandardReportCardType.types.OpenSubjectTasks]: 'sticky-note-2'
53
61
  };
54
- return typeIcon[this.name];
62
+ return typeIcon[this.type];
55
63
  }
56
64
 
57
65
  get cardColor() {
58
66
  const typeCardColor = {
59
- [StandardReportCardType.type.Approved]: '#00897b',
60
- [StandardReportCardType.type.Rejected]: '#bf360c',
61
- [StandardReportCardType.type.PendingApproval]: '#6a1b9a',
62
- [StandardReportCardType.type.Comments]: '#3949ab',
63
- [StandardReportCardType.type.CallTasks]: '#69a672',
64
- [StandardReportCardType.type.OpenSubjectTasks]: '#717cac'
67
+ [StandardReportCardType.types.Approved]: '#00897b',
68
+ [StandardReportCardType.types.Rejected]: '#bf360c',
69
+ [StandardReportCardType.types.PendingApproval]: '#6a1b9a',
70
+ [StandardReportCardType.types.Comments]: '#3949ab',
71
+ [StandardReportCardType.types.CallTasks]: '#69a672',
72
+ [StandardReportCardType.types.OpenSubjectTasks]: '#717cac'
65
73
  };
66
- return typeCardColor[this.name];
74
+ return typeCardColor[this.type];
67
75
  }
68
76
 
69
77
  get textColor() {
@@ -71,61 +79,61 @@ class StandardReportCardType extends _BaseEntity.default {
71
79
  }
72
80
 
73
81
  static fromResource(resource) {
74
- return _General.default.assignFields(resource, new StandardReportCardType(), ["uuid", "name", "description", "voided"]);
82
+ return _General.default.assignFields(resource, new StandardReportCardType(), ["uuid", "name", "description", "voided", "type"]);
75
83
  }
76
84
 
77
85
  isStandardCard() {
78
- return _lodash.default.includes([...this.approvalTypes(), StandardReportCardType.type.Comments, StandardReportCardType.type.CallTasks, StandardReportCardType.type.OpenSubjectTasks], this.name);
86
+ return _lodash.default.includes([...this.approvalTypes(), StandardReportCardType.types.Comments, StandardReportCardType.types.CallTasks, StandardReportCardType.types.OpenSubjectTasks], this.type);
79
87
  }
80
88
 
81
89
  approvalTypes() {
82
- return [StandardReportCardType.type.PendingApproval, StandardReportCardType.type.Approved, StandardReportCardType.type.Rejected];
90
+ return [StandardReportCardType.types.PendingApproval, StandardReportCardType.types.Approved, StandardReportCardType.types.Rejected];
83
91
  }
84
92
 
85
93
  defaultTypes() {
86
- return [StandardReportCardType.type.ScheduledVisits, StandardReportCardType.type.OverdueVisits, StandardReportCardType.type.RecentRegistrations, StandardReportCardType.type.RecentEnrolments, StandardReportCardType.type.RecentVisits, StandardReportCardType.type.Total];
94
+ return [StandardReportCardType.types.ScheduledVisits, StandardReportCardType.types.OverdueVisits, StandardReportCardType.types.RecentRegistrations, StandardReportCardType.types.RecentEnrolments, StandardReportCardType.types.RecentVisits, StandardReportCardType.types.Total];
87
95
  }
88
96
 
89
97
  isApprovalType() {
90
- return _lodash.default.includes(this.approvalTypes(), this.name);
98
+ return _lodash.default.includes(this.approvalTypes(), this.type);
91
99
  }
92
100
 
93
101
  isCommentType() {
94
- return this.name === StandardReportCardType.type.Comments;
102
+ return this.type === StandardReportCardType.types.Comments;
95
103
  }
96
104
 
97
105
  isTaskType() {
98
- return _lodash.default.includes([StandardReportCardType.type.CallTasks, StandardReportCardType.type.OpenSubjectTasks], this.name);
106
+ return _lodash.default.includes([StandardReportCardType.types.CallTasks, StandardReportCardType.types.OpenSubjectTasks], this.type);
99
107
  }
100
108
 
101
109
  isChecklistType() {
102
- return this.name === StandardReportCardType.type.DueChecklist;
110
+ return this.type === StandardReportCardType.types.DueChecklist;
103
111
  }
104
112
 
105
113
  getTaskTypeType() {
106
- switch (this.name) {
107
- case StandardReportCardType.type.CallTasks:
114
+ switch (this.type) {
115
+ case StandardReportCardType.types.CallTasks:
108
116
  return _TaskType.default.TaskTypeName.Call;
109
117
 
110
- case StandardReportCardType.type.OpenSubjectTasks:
118
+ case StandardReportCardType.types.OpenSubjectTasks:
111
119
  return _TaskType.default.TaskTypeName.OpenSubject;
112
120
  }
113
121
  }
114
122
 
115
123
  isDefaultType() {
116
- return _lodash.default.includes(this.defaultTypes(), this.name);
124
+ return _lodash.default.includes(this.defaultTypes(), this.type);
117
125
  }
118
126
 
119
127
  getApprovalStatusForType() {
120
- return typeToStatusMap[this.name];
128
+ return typeToStatusMap[this.type];
121
129
  }
122
130
 
123
131
  isSubjectTypeFilterSupported() {
124
- return [StandardReportCardType.type.ScheduledVisits, StandardReportCardType.type.OverdueVisits, StandardReportCardType.type.RecentRegistrations, StandardReportCardType.type.RecentEnrolments, StandardReportCardType.type.RecentVisits, StandardReportCardType.type.Total].includes(this.name);
132
+ return [StandardReportCardType.types.ScheduledVisits, StandardReportCardType.types.OverdueVisits, StandardReportCardType.types.RecentRegistrations, StandardReportCardType.types.RecentEnrolments, StandardReportCardType.types.RecentVisits, StandardReportCardType.types.Total].includes(this.type);
125
133
  }
126
134
 
127
135
  isRecentType() {
128
- return [StandardReportCardType.type.RecentRegistrations, StandardReportCardType.type.RecentEnrolments, StandardReportCardType.type.RecentVisits].includes(this.name);
136
+ return [StandardReportCardType.types.RecentRegistrations, StandardReportCardType.types.RecentEnrolments, StandardReportCardType.types.RecentVisits].includes(this.type);
129
137
  }
130
138
 
131
139
  }
@@ -140,6 +148,10 @@ _defineProperty(StandardReportCardType, "schema", {
140
148
  type: "string",
141
149
  optional: true
142
150
  },
151
+ type: {
152
+ type: "string",
153
+ optional: true
154
+ },
143
155
  voided: {
144
156
  type: "bool",
145
157
  default: false
@@ -147,28 +159,28 @@ _defineProperty(StandardReportCardType, "schema", {
147
159
  }
148
160
  });
149
161
 
150
- _defineProperty(StandardReportCardType, "type", {
151
- PendingApproval: "Pending approval",
162
+ _defineProperty(StandardReportCardType, "types", {
163
+ PendingApproval: "PendingApproval",
152
164
  Approved: "Approved",
153
165
  Rejected: "Rejected",
154
- ScheduledVisits: "Scheduled visits",
155
- OverdueVisits: "Overdue visits",
156
- RecentRegistrations: "Recent registrations",
157
- RecentEnrolments: "Recent enrolments",
158
- RecentVisits: "Recent visits",
166
+ ScheduledVisits: "ScheduledVisits",
167
+ OverdueVisits: "OverdueVisits",
168
+ RecentRegistrations: "RecentRegistrations",
169
+ RecentEnrolments: "RecentEnrolments",
170
+ RecentVisits: "RecentVisits",
159
171
  Total: "Total",
160
172
  Comments: "Comments",
161
- CallTasks: "Call tasks",
162
- OpenSubjectTasks: "Open subject tasks",
163
- DueChecklist: "Due checklist"
173
+ CallTasks: "CallTasks",
174
+ OpenSubjectTasks: "OpenSubjectTasks",
175
+ DueChecklist: "DueChecklist"
164
176
  });
165
177
 
166
178
  _defineProperty(StandardReportCardType, "recentCardDurationUnits", [_Duration.default.Day, _Duration.default.Week, _Duration.default.Month]);
167
179
 
168
180
  const typeToStatusMap = {
169
- [StandardReportCardType.type.PendingApproval]: _ApprovalStatus.default.statuses.Pending,
170
- [StandardReportCardType.type.Approved]: _ApprovalStatus.default.statuses.Approved,
171
- [StandardReportCardType.type.Rejected]: _ApprovalStatus.default.statuses.Rejected
181
+ [StandardReportCardType.types.PendingApproval]: _ApprovalStatus.default.statuses.Pending,
182
+ [StandardReportCardType.types.Approved]: _ApprovalStatus.default.statuses.Approved,
183
+ [StandardReportCardType.types.Rejected]: _ApprovalStatus.default.statuses.Rejected
172
184
  };
173
185
  var _default = StandardReportCardType;
174
186
  exports.default = _default;
@@ -48,6 +48,14 @@ class FormElementGroup extends _BaseEntity.default {
48
48
  this.that.displayOrder = x;
49
49
  }
50
50
 
51
+ get display() {
52
+ return this.that.display;
53
+ }
54
+
55
+ set display(x) {
56
+ this.that.display = x;
57
+ }
58
+
51
59
  get formElements() {
52
60
  return this.toEntityList("formElements", _FormElement.default);
53
61
  }
@@ -113,7 +121,7 @@ class FormElementGroup extends _BaseEntity.default {
113
121
  }
114
122
 
115
123
  static fromResource(resource, entityService) {
116
- const formElementGroup = _General.default.assignFields(resource, new FormElementGroup(), ["uuid", "name", "displayOrder", "voided", "rule", "startTime", "stayTime", "timed", "textColour", "backgroundColour"]);
124
+ const formElementGroup = _General.default.assignFields(resource, new FormElementGroup(), ["uuid", "name", "displayOrder", "display", "voided", "rule", "startTime", "stayTime", "timed", "textColour", "backgroundColour"]);
117
125
 
118
126
  formElementGroup.form = entityService.findByKey("uuid", _ResourceUtil.default.getUUIDFor(resource, "formUUID"), _Form.default.schema.name);
119
127
  return formElementGroup;
@@ -234,7 +242,7 @@ class FormElementGroup extends _BaseEntity.default {
234
242
  }
235
243
 
236
244
  get translatedFieldValue() {
237
- return this.name;
245
+ return this.display;
238
246
  }
239
247
 
240
248
  removeFormElement(formElementName) {
@@ -283,6 +291,7 @@ class FormElementGroup extends _BaseEntity.default {
283
291
  uuid: this.uuid,
284
292
  name: this.name,
285
293
  displayOrder: this.displayOrder,
294
+ display: this.display,
286
295
  formElements: this.formElements,
287
296
  formUUID: this.form.uuid,
288
297
  startTime: this.startTime,
@@ -302,6 +311,10 @@ _defineProperty(FormElementGroup, "schema", {
302
311
  uuid: "string",
303
312
  name: "string",
304
313
  displayOrder: "double",
314
+ display: {
315
+ type: "string",
316
+ optional: true
317
+ },
305
318
  formElements: {
306
319
  type: "list",
307
320
  objectType: "FormElement"
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "openchs-models",
3
3
  "description": "OpenCHS data model to be used by front end clients",
4
- "version": "1.32.8",
4
+ "version": "1.32.10",
5
5
  "private": false,
6
6
  "repository": {
7
7
  "type": "git",