openchs-models 1.31.75 → 1.31.77
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.
|
@@ -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;
|