openchs-models 1.30.3 → 1.30.5
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,8 +111,6 @@ const dateFilterTypes = [_CustomFilter.default.type.RegistrationDate, _CustomFil
|
|
|
111
111
|
|
|
112
112
|
class DashboardFilterConfig {
|
|
113
113
|
constructor() {
|
|
114
|
-
_defineProperty(this, "subjectType", void 0);
|
|
115
|
-
|
|
116
114
|
_defineProperty(this, "type", void 0);
|
|
117
115
|
|
|
118
116
|
_defineProperty(this, "widget", void 0);
|
|
@@ -143,14 +141,13 @@ class DashboardFilterConfig {
|
|
|
143
141
|
}
|
|
144
142
|
|
|
145
143
|
isValid() {
|
|
146
|
-
const valid = !
|
|
144
|
+
const valid = !_lodash.default.isNil(this.type);
|
|
147
145
|
if (!valid) return valid;
|
|
148
146
|
if (this.isConceptTypeFilter()) return this.observationBasedFilter.isValid();else if (this.isGroupSubjectTypeFilter()) return this.groupSubjectTypeFilter.isValid();else if (this.isWidgetRequired()) return !_lodash.default.isNil(this.widget);else return true;
|
|
149
147
|
}
|
|
150
148
|
|
|
151
149
|
toServerRequest() {
|
|
152
150
|
const request = {
|
|
153
|
-
subjectTypeUUID: this.subjectType.uuid,
|
|
154
151
|
type: this.type,
|
|
155
152
|
widget: this.widget
|
|
156
153
|
};
|
|
@@ -178,19 +175,6 @@ class DashboardFilterConfig {
|
|
|
178
175
|
return [RegistrationDate, EnrolmentDate, ProgramEncounterDate, EncounterDate].includes(this.type) || this.isConceptTypeFilter() && this.observationBasedFilter.isWidgetRequired();
|
|
179
176
|
}
|
|
180
177
|
|
|
181
|
-
setSubjectType(subjectType) {
|
|
182
|
-
if (_lodash.default.get(subjectType, "uuid") !== _lodash.default.get(this.subjectType, "uuid")) {
|
|
183
|
-
this.subjectType = subjectType;
|
|
184
|
-
|
|
185
|
-
if (!_lodash.default.isNil(this.observationBasedFilter)) {
|
|
186
|
-
this.observationBasedFilter.programs = [];
|
|
187
|
-
this.observationBasedFilter.encounterTypes = [];
|
|
188
|
-
} else if (!_lodash.default.isNil(this.groupSubjectTypeFilter)) {
|
|
189
|
-
this.groupSubjectTypeFilter.subjectType = null;
|
|
190
|
-
}
|
|
191
|
-
}
|
|
192
|
-
}
|
|
193
|
-
|
|
194
178
|
willObservationBeInScopeOfProgramEnrolment() {
|
|
195
179
|
return this.isConceptTypeFilter() && this.observationBasedFilter.willObservationBeInScopeOfProgramEnrolment();
|
|
196
180
|
}
|
|
@@ -212,7 +196,6 @@ class DashboardFilterConfig {
|
|
|
212
196
|
clone() {
|
|
213
197
|
const clone = new DashboardFilterConfig();
|
|
214
198
|
clone.type = this.type;
|
|
215
|
-
clone.subjectType = this.subjectType;
|
|
216
199
|
clone.widget = this.widget;
|
|
217
200
|
clone.groupSubjectTypeFilter = this.groupSubjectTypeFilter;
|
|
218
201
|
clone.observationBasedFilter = this.observationBasedFilter;
|