openchs-models 1.33.28 → 1.33.30

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.
@@ -140,6 +140,18 @@ class ReportCard extends _BaseEntity.default {
140
140
  });
141
141
  reportCard.setStandardReportCardInputRecentDurationJSON(resource.standardReportCardInputRecentDuration);
142
142
  reportCard.action = resource.action || null;
143
+ if (resource.actionDetail) {
144
+ if (resource.actionDetail.subjectTypeUUID) {
145
+ reportCard.actionDetailSubjectType = entityService.findByUUID(resource.actionDetail.subjectTypeUUID, _SubjectType.default.schema.name);
146
+ }
147
+ if (resource.actionDetail.programUUID) {
148
+ reportCard.actionDetailProgram = entityService.findByUUID(resource.actionDetail.programUUID, _Program.default.schema.name);
149
+ }
150
+ if (resource.actionDetail.encounterTypeUUID) {
151
+ reportCard.actionDetailEncounterType = entityService.findByUUID(resource.actionDetail.encounterTypeUUID, _EncounterType.default.schema.name);
152
+ }
153
+ reportCard.actionDetailVisitType = resource.actionDetail.visitType || null;
154
+ }
143
155
  return reportCard;
144
156
  }
145
157
  isStandardTaskType() {
@@ -179,11 +191,45 @@ class ReportCard extends _BaseEntity.default {
179
191
  set action(x) {
180
192
  this.that.action = x;
181
193
  }
194
+ get actionDetailSubjectType() {
195
+ return this.toEntity("actionDetailSubjectType", _SubjectType.default);
196
+ }
197
+ set actionDetailSubjectType(x) {
198
+ this.that.actionDetailSubjectType = this.fromObject(x);
199
+ }
200
+ get actionDetailProgram() {
201
+ return this.toEntity("actionDetailProgram", _Program.default);
202
+ }
203
+ set actionDetailProgram(x) {
204
+ this.that.actionDetailProgram = this.fromObject(x);
205
+ }
206
+ get actionDetailEncounterType() {
207
+ return this.toEntity("actionDetailEncounterType", _EncounterType.default);
208
+ }
209
+ set actionDetailEncounterType(x) {
210
+ this.that.actionDetailEncounterType = this.fromObject(x);
211
+ }
212
+ get actionDetailVisitType() {
213
+ return this.that.actionDetailVisitType;
214
+ }
215
+ set actionDetailVisitType(x) {
216
+ this.that.actionDetailVisitType = x;
217
+ }
218
+ isActionDoVisit() {
219
+ return this.action === ReportCard.actionTypes.DoVisit;
220
+ }
221
+ isScheduledVisitType() {
222
+ return this.actionDetailVisitType === ReportCard.visitTypes.Scheduled;
223
+ }
182
224
  }
183
225
  _defineProperty(ReportCard, "actionTypes", {
184
226
  ViewSubjectProfile: "ViewSubjectProfile",
185
227
  DoVisit: "DoVisit"
186
228
  });
229
+ _defineProperty(ReportCard, "visitTypes", {
230
+ Scheduled: "Scheduled",
231
+ Unplanned: "Unplanned"
232
+ });
187
233
  _defineProperty(ReportCard, "schema", {
188
234
  name: "ReportCard",
189
235
  primaryKey: "uuid",
@@ -238,6 +284,25 @@ _defineProperty(ReportCard, "schema", {
238
284
  action: {
239
285
  type: "string",
240
286
  optional: true
287
+ },
288
+ actionDetailSubjectType: {
289
+ type: "object",
290
+ objectType: "SubjectType",
291
+ optional: true
292
+ },
293
+ actionDetailProgram: {
294
+ type: "object",
295
+ objectType: "Program",
296
+ optional: true
297
+ },
298
+ actionDetailEncounterType: {
299
+ type: "object",
300
+ objectType: "EncounterType",
301
+ optional: true
302
+ },
303
+ actionDetailVisitType: {
304
+ type: "string",
305
+ optional: true
241
306
  }
242
307
  }
243
308
  });
package/dist/Schema.js CHANGED
@@ -180,7 +180,7 @@ function createRealmConfig() {
180
180
  return doCompact;
181
181
  },
182
182
  //order is important, should be arranged according to the dependency
183
- schemaVersion: 208,
183
+ schemaVersion: 209,
184
184
  onMigration: function (oldDB, newDB) {
185
185
  console.log("[AvniModels.Schema]", `Running migration with old schema version: ${oldDB.schemaVersion} and new schema version: ${newDB.schemaVersion}`);
186
186
  if (oldDB.schemaVersion === VersionWithEmbeddedMigrationProblem) throw new Error(`Update from schema version ${VersionWithEmbeddedMigrationProblem} is not allowed. Please uninstall and install app.`);
@@ -70,11 +70,11 @@ class ReportCardResult extends _BaseEntity.default {
70
70
  reportCardResult.hasErrorMsg = hasErrorMsg;
71
71
  return reportCardResult;
72
72
  }
73
- static fromQueryResult(result, reportCard) {
73
+ static fromQueryResult(result) {
74
74
  const reportCardResult = ReportCardResult.create(result.primaryValue, result.secondaryValue, _lodash.default.isFunction(result.lineListFunction), result.hasErrorMsg);
75
75
  if (!result.hasErrorMsg) {
76
76
  reportCardResult.cardName = result.cardName;
77
- reportCardResult.cardColor = _lodash.default.isNil(result.cardColor) ? reportCard ? reportCard.colour : undefined : result.cardColor;
77
+ reportCardResult.cardColor = result.cardColor;
78
78
  reportCardResult.textColor = result.textColor;
79
79
  }
80
80
  return reportCardResult;
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.33.28",
4
+ "version": "1.33.30",
5
5
  "private": false,
6
6
  "repository": {
7
7
  "type": "git",