openchs-models 1.31.81 → 1.31.82
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/CustomDashboardCache.js +30 -75
- package/dist/CustomFilter.js +2 -1
- package/dist/Dashboard.js +8 -0
- package/dist/MediaQueue.js +1 -15
- package/dist/ReportCard.js +70 -7
- package/dist/Schema.js +5 -1
- package/dist/StandardReportCardType.js +4 -0
- package/dist/index.js +8 -0
- package/dist/location/Locations.js +21 -0
- package/dist/reports/DashboardFilterConfig.js +14 -0
- package/package.json +1 -1
|
@@ -7,6 +7,10 @@ exports.default = void 0;
|
|
|
7
7
|
|
|
8
8
|
var _BaseEntity = _interopRequireDefault(require("./BaseEntity"));
|
|
9
9
|
|
|
10
|
+
var _Dashboard = _interopRequireDefault(require("./Dashboard"));
|
|
11
|
+
|
|
12
|
+
var _General = _interopRequireDefault(require("./utility/General"));
|
|
13
|
+
|
|
10
14
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
11
15
|
|
|
12
16
|
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
@@ -16,14 +20,6 @@ class CustomDashboardCache extends _BaseEntity.default {
|
|
|
16
20
|
super(that);
|
|
17
21
|
}
|
|
18
22
|
|
|
19
|
-
get checksum() {
|
|
20
|
-
return this.that.checksum;
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
set checksum(x) {
|
|
24
|
-
this.that.checksum = x;
|
|
25
|
-
}
|
|
26
|
-
|
|
27
23
|
get updatedAt() {
|
|
28
24
|
return this.that.updatedAt;
|
|
29
25
|
}
|
|
@@ -48,84 +44,49 @@ class CustomDashboardCache extends _BaseEntity.default {
|
|
|
48
44
|
this.that.filterApplied = x;
|
|
49
45
|
}
|
|
50
46
|
|
|
51
|
-
get
|
|
52
|
-
return this.
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
set filterErrorsJSON(x) {
|
|
56
|
-
this.that.filterErrorsJSON = x;
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
get ruleInputJSON() {
|
|
60
|
-
return this.that.ruleInputJSON;
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
set ruleInputJSON(x) {
|
|
64
|
-
this.that.ruleInputJSON = x;
|
|
47
|
+
get dashboard() {
|
|
48
|
+
return this.toEntity("dashboard", _Dashboard.default);
|
|
65
49
|
}
|
|
66
50
|
|
|
67
|
-
|
|
68
|
-
|
|
51
|
+
set dashboard(x) {
|
|
52
|
+
this.that.dashboard = this.fromObject(x);
|
|
69
53
|
}
|
|
70
54
|
|
|
71
|
-
|
|
72
|
-
this.that.transformedFiltersJSON = x;
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
static create(uuid, checksum, updatedAt, selectedValuesJSON, filterApplied, filterErrorsJSON, ruleInputJSON, transformedFiltersJSON) {
|
|
55
|
+
static create(uuid, updatedAt, selectedValuesJSON = '{}', filterApplied) {
|
|
76
56
|
const customDashboardCache = new CustomDashboardCache();
|
|
77
57
|
customDashboardCache.uuid = uuid;
|
|
78
|
-
customDashboardCache.checksum = checksum;
|
|
79
58
|
customDashboardCache.updatedAt = updatedAt;
|
|
80
59
|
customDashboardCache.selectedValuesJSON = selectedValuesJSON;
|
|
81
60
|
customDashboardCache.filterApplied = filterApplied;
|
|
82
|
-
customDashboardCache.filterErrorsJSON = filterErrorsJSON;
|
|
83
|
-
customDashboardCache.ruleInputJSON = ruleInputJSON;
|
|
84
|
-
customDashboardCache.transformedFiltersJSON = transformedFiltersJSON;
|
|
85
61
|
return customDashboardCache;
|
|
86
62
|
}
|
|
87
63
|
|
|
88
|
-
static
|
|
89
|
-
const
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
selectedGenders: state.selectedGenders
|
|
95
|
-
};
|
|
96
|
-
return filterCache;
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
static createEmptyInstance() {
|
|
100
|
-
return new CustomDashboardCache();
|
|
64
|
+
static newInstance(dashboard) {
|
|
65
|
+
const customDashboardCache = new CustomDashboardCache();
|
|
66
|
+
customDashboardCache.uuid = _General.default.randomUUID();
|
|
67
|
+
customDashboardCache.dashboard = dashboard;
|
|
68
|
+
customDashboardCache.reset();
|
|
69
|
+
return customDashboardCache;
|
|
101
70
|
}
|
|
102
71
|
|
|
103
|
-
|
|
104
|
-
|
|
72
|
+
reset() {
|
|
73
|
+
this.filterApplied = false;
|
|
74
|
+
this.selectedValuesJSON = JSON.stringify({});
|
|
75
|
+
this.updatedAt = new Date();
|
|
105
76
|
}
|
|
106
77
|
|
|
107
78
|
getSelectedValues() {
|
|
108
|
-
return
|
|
79
|
+
return JSON.parse(this.selectedValuesJSON);
|
|
109
80
|
}
|
|
110
81
|
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
}
|
|
120
|
-
|
|
121
|
-
getTransformedFilters() {
|
|
122
|
-
return this.transformedFiltersJSON && JSON.parse(this.transformedFiltersJSON) || {
|
|
123
|
-
date: new Date(),
|
|
124
|
-
applied: false,
|
|
125
|
-
selectedLocations: [],
|
|
126
|
-
selectedCustomFilters: [],
|
|
127
|
-
selectedGenders: []
|
|
128
|
-
};
|
|
82
|
+
clone() {
|
|
83
|
+
const customDashboardCache = new CustomDashboardCache();
|
|
84
|
+
customDashboardCache.uuid = this.uuid;
|
|
85
|
+
customDashboardCache.dashboard = this.dashboard;
|
|
86
|
+
customDashboardCache.updatedAt = this.updatedAt;
|
|
87
|
+
customDashboardCache.selectedValuesJSON = this.selectedValuesJSON;
|
|
88
|
+
customDashboardCache.filterApplied = this.filterApplied;
|
|
89
|
+
return customDashboardCache;
|
|
129
90
|
}
|
|
130
91
|
|
|
131
92
|
}
|
|
@@ -135,16 +96,10 @@ _defineProperty(CustomDashboardCache, "schema", {
|
|
|
135
96
|
primaryKey: "uuid",
|
|
136
97
|
properties: {
|
|
137
98
|
uuid: "string",
|
|
138
|
-
|
|
99
|
+
dashboard: "Dashboard",
|
|
139
100
|
updatedAt: "date",
|
|
140
101
|
selectedValuesJSON: "string",
|
|
141
|
-
filterApplied:
|
|
142
|
-
type: "bool",
|
|
143
|
-
default: false
|
|
144
|
-
},
|
|
145
|
-
filterErrorsJSON: "string",
|
|
146
|
-
ruleInputJSON: "string",
|
|
147
|
-
transformedFiltersJSON: "string"
|
|
102
|
+
filterApplied: "bool"
|
|
148
103
|
}
|
|
149
104
|
});
|
|
150
105
|
|
package/dist/CustomFilter.js
CHANGED
|
@@ -41,7 +41,8 @@ _defineProperty(CustomFilter, "type", {
|
|
|
41
41
|
EncounterDate: "EncounterDate",
|
|
42
42
|
Address: "Address",
|
|
43
43
|
Concept: "Concept",
|
|
44
|
-
GroupSubject: "GroupSubject"
|
|
44
|
+
GroupSubject: "GroupSubject",
|
|
45
|
+
SubjectType: "SubjectType"
|
|
45
46
|
});
|
|
46
47
|
|
|
47
48
|
_defineProperty(CustomFilter, "scope", {
|
package/dist/Dashboard.js
CHANGED
|
@@ -36,6 +36,14 @@ class Dashboard extends _BaseEntity.default {
|
|
|
36
36
|
this.that.description = x;
|
|
37
37
|
}
|
|
38
38
|
|
|
39
|
+
get filters() {
|
|
40
|
+
return this.toEntityList("filters", _DashboardFilter.default);
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
set filters(x) {
|
|
44
|
+
this.that.filters = this.fromEntityList(x);
|
|
45
|
+
}
|
|
46
|
+
|
|
39
47
|
static fromResource(resource) {
|
|
40
48
|
return _General.default.assignFields(resource, new Dashboard(), ["uuid", "name", "description", "voided"]);
|
|
41
49
|
}
|
package/dist/MediaQueue.js
CHANGED
|
@@ -9,8 +9,6 @@ var _General = _interopRequireDefault(require("./utility/General"));
|
|
|
9
9
|
|
|
10
10
|
var _BaseEntity = _interopRequireDefault(require("./BaseEntity"));
|
|
11
11
|
|
|
12
|
-
var _lodash = _interopRequireDefault(require("lodash"));
|
|
13
|
-
|
|
14
12
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
15
13
|
|
|
16
14
|
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
@@ -69,7 +67,7 @@ class MediaQueue extends _BaseEntity.default {
|
|
|
69
67
|
}
|
|
70
68
|
|
|
71
69
|
static create(entityUUID, entityName, fileName, type, entityTargetField, conceptUUID, uuid = _General.default.randomUUID()) {
|
|
72
|
-
|
|
70
|
+
var mediaQueue = new MediaQueue();
|
|
73
71
|
mediaQueue.entityUUID = entityUUID;
|
|
74
72
|
mediaQueue.uuid = uuid;
|
|
75
73
|
mediaQueue.entityName = entityName;
|
|
@@ -92,18 +90,6 @@ class MediaQueue extends _BaseEntity.default {
|
|
|
92
90
|
return mediaQueueItem;
|
|
93
91
|
}
|
|
94
92
|
|
|
95
|
-
getDisplayText() {
|
|
96
|
-
// generate safe to string
|
|
97
|
-
let str = "";
|
|
98
|
-
if (!_lodash.default.isNil(this.entityName)) str += "EntityName: " + this.entityName + ", ";
|
|
99
|
-
if (!_lodash.default.isNil(this.entityUUID)) str += "EntityUUID: " + this.entityUUID + ", ";
|
|
100
|
-
if (!_lodash.default.isNil(this.entityTargetField)) str += "EntityTargetField: " + this.entityTargetField + ", ";
|
|
101
|
-
if (!_lodash.default.isNil(this.fileName)) str += "FileName: " + this.fileName + ", ";
|
|
102
|
-
if (!_lodash.default.isNil(this.type)) str += "Type: " + this.type + ", ";
|
|
103
|
-
if (!_lodash.default.isNil(this.conceptUUID)) str += "ConceptUUID: " + this.conceptUUID;
|
|
104
|
-
return str;
|
|
105
|
-
}
|
|
106
|
-
|
|
107
93
|
}
|
|
108
94
|
|
|
109
95
|
_defineProperty(MediaQueue, "schema", {
|
package/dist/ReportCard.js
CHANGED
|
@@ -15,15 +15,25 @@ var _StandardReportCardType = _interopRequireDefault(require("./StandardReportCa
|
|
|
15
15
|
|
|
16
16
|
var _lodash = _interopRequireDefault(require("lodash"));
|
|
17
17
|
|
|
18
|
+
var _SubjectType = _interopRequireDefault(require("./SubjectType"));
|
|
19
|
+
|
|
20
|
+
var _Program = _interopRequireDefault(require("./Program"));
|
|
21
|
+
|
|
22
|
+
var _EncounterType = _interopRequireDefault(require("./EncounterType"));
|
|
23
|
+
|
|
18
24
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
19
25
|
|
|
20
26
|
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
21
27
|
|
|
22
|
-
function throwInvalidIndexError(index, reportCardsLength) {
|
|
23
|
-
throw new Error(`Invalid index ${index} specified for reportCard with length ${reportCardsLength}`);
|
|
24
|
-
}
|
|
25
|
-
|
|
26
28
|
class ReportCard extends _BaseEntity.default {
|
|
29
|
+
static newReportCard() {
|
|
30
|
+
const reportCard = new ReportCard();
|
|
31
|
+
reportCard.standardReportCardInputSubjectTypes = [];
|
|
32
|
+
reportCard.standardReportCardInputPrograms = [];
|
|
33
|
+
reportCard.standardReportCardInputEncounterTypes = [];
|
|
34
|
+
return reportCard;
|
|
35
|
+
}
|
|
36
|
+
|
|
27
37
|
constructor(that = null) {
|
|
28
38
|
super(that);
|
|
29
39
|
}
|
|
@@ -96,6 +106,30 @@ class ReportCard extends _BaseEntity.default {
|
|
|
96
106
|
get textColor() {
|
|
97
107
|
return _lodash.default.isNil(this.standardReportCardType) ? '#ffffff' : this.standardReportCardType.textColor;
|
|
98
108
|
}
|
|
109
|
+
|
|
110
|
+
get standardReportCardInputSubjectTypes() {
|
|
111
|
+
return this.toEntityList("standardReportCardInputSubjectTypes", _SubjectType.default);
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
set standardReportCardInputSubjectTypes(x) {
|
|
115
|
+
this.that.standardReportCardInputSubjectTypes = this.fromEntityList(x);
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
get standardReportCardInputPrograms() {
|
|
119
|
+
return this.toEntityList("standardReportCardInputPrograms", _Program.default);
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
set standardReportCardInputPrograms(x) {
|
|
123
|
+
this.that.standardReportCardInputPrograms = this.fromEntityList(x);
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
get standardReportCardInputEncounterTypes() {
|
|
127
|
+
return this.toEntityList("standardReportCardInputEncounterTypes", _EncounterType.default);
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
set standardReportCardInputEncounterTypes(x) {
|
|
131
|
+
this.that.standardReportCardInputEncounterTypes = this.fromEntityList(x);
|
|
132
|
+
}
|
|
99
133
|
/**
|
|
100
134
|
* Helper method used to generate unique key value for Nested Report Cards using UUID and Index of the Report Card.
|
|
101
135
|
* The Nested Report Card's query responses would be mapped to the corresponding Dashboard Report cards using the UUID and Index.
|
|
@@ -122,9 +156,18 @@ class ReportCard extends _BaseEntity.default {
|
|
|
122
156
|
}
|
|
123
157
|
|
|
124
158
|
static fromResource(resource, entityService) {
|
|
125
|
-
const reportCard = _General.default.assignFields(resource,
|
|
159
|
+
const reportCard = _General.default.assignFields(resource, ReportCard.newReportCard(), ["uuid", "name", "query", "description", "colour", "voided", "nested", "countOfCards"]);
|
|
126
160
|
|
|
127
161
|
reportCard.standardReportCardType = entityService.findByKey("uuid", _ResourceUtil.default.getUUIDFor(resource, "standardReportCardUUID"), _StandardReportCardType.default.schema.name);
|
|
162
|
+
resource.standardReportCardInputSubjectTypes.forEach(uuid => {
|
|
163
|
+
reportCard.standardReportCardInputSubjectTypes.push(entityService.findByUUID(uuid, _SubjectType.default.schema.name));
|
|
164
|
+
});
|
|
165
|
+
resource.standardReportCardInputPrograms.forEach(uuid => {
|
|
166
|
+
reportCard.standardReportCardInputPrograms.push(entityService.findByUUID(uuid, _Program.default.schema.name));
|
|
167
|
+
});
|
|
168
|
+
resource.standardReportCardInputEncounterTypes.forEach(uuid => {
|
|
169
|
+
reportCard.standardReportCardInputEncounterTypes.push(entityService.findByUUID(uuid, _EncounterType.default.schema.name));
|
|
170
|
+
});
|
|
128
171
|
return reportCard;
|
|
129
172
|
}
|
|
130
173
|
|
|
@@ -132,6 +175,14 @@ class ReportCard extends _BaseEntity.default {
|
|
|
132
175
|
return _lodash.default.isNil(this.standardReportCardType) ? false : this.standardReportCardType.isTaskType();
|
|
133
176
|
}
|
|
134
177
|
|
|
178
|
+
isStandardReportType() {
|
|
179
|
+
return !_lodash.default.isNil(this.standardReportCardType);
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
isSubjectTypeFilterSupported() {
|
|
183
|
+
return this.isStandardReportType() && this.standardReportCardType.isSubjectTypeFilterSupported();
|
|
184
|
+
}
|
|
185
|
+
|
|
135
186
|
}
|
|
136
187
|
|
|
137
188
|
_defineProperty(ReportCard, "schema", {
|
|
@@ -166,8 +217,20 @@ _defineProperty(ReportCard, "schema", {
|
|
|
166
217
|
type: "int",
|
|
167
218
|
default: 1,
|
|
168
219
|
optional: true
|
|
169
|
-
}
|
|
170
|
-
|
|
220
|
+
},
|
|
221
|
+
//Used only by nested ReportCards
|
|
222
|
+
standardReportCardInputSubjectTypes: {
|
|
223
|
+
type: "list",
|
|
224
|
+
objectType: "SubjectType"
|
|
225
|
+
},
|
|
226
|
+
standardReportCardInputPrograms: {
|
|
227
|
+
type: "list",
|
|
228
|
+
objectType: "Program"
|
|
229
|
+
},
|
|
230
|
+
standardReportCardInputEncounterTypes: {
|
|
231
|
+
type: "list",
|
|
232
|
+
objectType: "EncounterType"
|
|
233
|
+
}
|
|
171
234
|
}
|
|
172
235
|
});
|
|
173
236
|
|
package/dist/Schema.js
CHANGED
|
@@ -279,7 +279,7 @@ function createRealmConfig() {
|
|
|
279
279
|
return doCompact;
|
|
280
280
|
},
|
|
281
281
|
//order is important, should be arranged according to the dependency
|
|
282
|
-
schemaVersion:
|
|
282
|
+
schemaVersion: 191,
|
|
283
283
|
onMigration: function (oldDB, newDB) {
|
|
284
284
|
console.log("[AvniModels.Schema]", `Running migration with old schema version: ${oldDB.schemaVersion} and new schema version: ${newDB.schemaVersion}`);
|
|
285
285
|
if (oldDB.schemaVersion === VersionWithEmbeddedMigrationProblem) throw new Error(`Update from schema version ${VersionWithEmbeddedMigrationProblem} is not allowed. Please uninstall and install app.`);
|
|
@@ -913,6 +913,10 @@ function createRealmConfig() {
|
|
|
913
913
|
if (oldDB.schemaVersion < 190) {// PlaceHolder for SubjectType.User changes, so that people with previous version of client
|
|
914
914
|
// are not able to use fastSync of version 190 and above
|
|
915
915
|
}
|
|
916
|
+
|
|
917
|
+
if (oldDB.schemaVersion < 191) {
|
|
918
|
+
newDB.delete(newDB.objects("CustomDashboardCache"));
|
|
919
|
+
}
|
|
916
920
|
}
|
|
917
921
|
};
|
|
918
922
|
}
|
|
@@ -118,6 +118,10 @@ class StandardReportCardType extends _BaseEntity.default {
|
|
|
118
118
|
return typeToStatusMap[this.name];
|
|
119
119
|
}
|
|
120
120
|
|
|
121
|
+
isSubjectTypeFilterSupported() {
|
|
122
|
+
return [StandardReportCardType.type.ScheduledVisits, StandardReportCardType.type.OverdueVisits].includes(this.name);
|
|
123
|
+
}
|
|
124
|
+
|
|
121
125
|
}
|
|
122
126
|
|
|
123
127
|
_defineProperty(StandardReportCardType, "schema", {
|
package/dist/index.js
CHANGED
|
@@ -789,6 +789,12 @@ Object.defineProperty(exports, "JSONStringify", {
|
|
|
789
789
|
return _JsonStringify.JSONStringify;
|
|
790
790
|
}
|
|
791
791
|
});
|
|
792
|
+
Object.defineProperty(exports, "Locations", {
|
|
793
|
+
enumerable: true,
|
|
794
|
+
get: function () {
|
|
795
|
+
return _Locations.default;
|
|
796
|
+
}
|
|
797
|
+
});
|
|
792
798
|
|
|
793
799
|
var _AbstractEncounter = _interopRequireDefault(require("./AbstractEncounter"));
|
|
794
800
|
|
|
@@ -1042,6 +1048,8 @@ var _DashboardCacheFilter = _interopRequireDefault(require("./application/Dashbo
|
|
|
1042
1048
|
|
|
1043
1049
|
var _JsonStringify = require("./utility/JsonStringify");
|
|
1044
1050
|
|
|
1051
|
+
var _Locations = _interopRequireDefault(require("./location/Locations"));
|
|
1052
|
+
|
|
1045
1053
|
function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }
|
|
1046
1054
|
|
|
1047
1055
|
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
|
|
8
|
+
var _lodash = _interopRequireDefault(require("lodash"));
|
|
9
|
+
|
|
10
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
11
|
+
|
|
12
|
+
// AddressLevel = Location
|
|
13
|
+
class Locations {
|
|
14
|
+
static getUniqueLevels(locations) {
|
|
15
|
+
return _lodash.default.uniq(locations.map(x => x.level));
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
var _default = Locations;
|
|
21
|
+
exports.default = _default;
|
|
@@ -111,6 +111,8 @@ const dateFilterTypes = [_CustomFilter.default.type.RegistrationDate, _CustomFil
|
|
|
111
111
|
|
|
112
112
|
class DashboardFilterConfig {
|
|
113
113
|
constructor() {
|
|
114
|
+
_defineProperty(this, "subjectType", void 0);
|
|
115
|
+
|
|
114
116
|
_defineProperty(this, "type", void 0);
|
|
115
117
|
|
|
116
118
|
_defineProperty(this, "widget", void 0);
|
|
@@ -140,6 +142,10 @@ class DashboardFilterConfig {
|
|
|
140
142
|
return this.type === _CustomFilter.default.type.GroupSubject;
|
|
141
143
|
}
|
|
142
144
|
|
|
145
|
+
isSubjectTypeFilter() {
|
|
146
|
+
return this.type === _CustomFilter.default.type.SubjectType;
|
|
147
|
+
}
|
|
148
|
+
|
|
143
149
|
isValid() {
|
|
144
150
|
const valid = !_lodash.default.isNil(this.type);
|
|
145
151
|
if (!valid) return valid;
|
|
@@ -149,6 +155,7 @@ class DashboardFilterConfig {
|
|
|
149
155
|
toServerRequest() {
|
|
150
156
|
const request = {
|
|
151
157
|
type: this.type,
|
|
158
|
+
subjectTypeUUID: this.subjectType && this.subjectType.uuid,
|
|
152
159
|
widget: this.widget
|
|
153
160
|
};
|
|
154
161
|
if (this.isConceptTypeFilter()) request.observationBasedFilter = this.observationBasedFilter.toServerRequest();else if (this.isGroupSubjectTypeFilter()) request.groupSubjectTypeFilter = this.groupSubjectTypeFilter.toServerRequest();
|
|
@@ -175,6 +182,12 @@ class DashboardFilterConfig {
|
|
|
175
182
|
return [RegistrationDate, EnrolmentDate, ProgramEncounterDate, EncounterDate].includes(this.type) || this.isConceptTypeFilter() && this.observationBasedFilter.isWidgetRequired();
|
|
176
183
|
}
|
|
177
184
|
|
|
185
|
+
setSubjectType(subjectType) {
|
|
186
|
+
if (_lodash.default.get(subjectType, "uuid") !== _lodash.default.get(this.subjectType, "uuid")) {
|
|
187
|
+
this.subjectType = subjectType;
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
|
|
178
191
|
willObservationBeInScopeOfProgramEnrolment() {
|
|
179
192
|
return this.isConceptTypeFilter() && this.observationBasedFilter.willObservationBeInScopeOfProgramEnrolment();
|
|
180
193
|
}
|
|
@@ -200,6 +213,7 @@ class DashboardFilterConfig {
|
|
|
200
213
|
clone() {
|
|
201
214
|
const clone = new DashboardFilterConfig();
|
|
202
215
|
clone.type = this.type;
|
|
216
|
+
clone.subjectType = this.subjectType;
|
|
203
217
|
clone.widget = this.widget;
|
|
204
218
|
clone.groupSubjectTypeFilter = this.groupSubjectTypeFilter;
|
|
205
219
|
clone.observationBasedFilter = this.observationBasedFilter;
|