-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
#1382 - unselect programs and encounters based on which parent has be…
…en unselected in the filters. fixed BaseService find by all uuid. refactored custom filter service so that it can be reused. removed wrong use of state at the service level for individuals. used CustomFilterService in scheduled report card type.
- Loading branch information
1 parent
1656939
commit bc8bd16
Showing
19 changed files
with
307 additions
and
240 deletions.
There are no files selected for viewing
40 changes: 40 additions & 0 deletions
40
packages/openchs-android/src/model/DashboardReportFilter.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
// Objects has been used in place of arrays to allow for flexibility in contract in the future. | ||
|
||
import _ from "lodash"; | ||
import {CustomFilter} from "openchs-models"; | ||
|
||
export class DashboardReportFilter { | ||
type; | ||
dataType; | ||
groupSubjectTypeFilter; | ||
observationBasedFilter; | ||
filterValue; | ||
|
||
static getAddressFilter(reportFilters) { | ||
if (_.isNil(reportFilters)) return null; | ||
return _.find(reportFilters, (x: DashboardReportFilter) => x.type === CustomFilter.type.Address); | ||
} | ||
|
||
static getGenderFilterValues(reportFilters = []) { | ||
const genderFilter = _.find(reportFilters, (x: DashboardReportFilter) => x.type === CustomFilter.type.Gender); | ||
if (_.isNil(genderFilter)) return []; | ||
return genderFilter.filterValue; | ||
} | ||
|
||
getScope() { | ||
return _.get(this.observationBasedFilter, "scope"); | ||
} | ||
|
||
getConceptUUID() { | ||
return _.get(this.observationBasedFilter, "concept.uuid"); | ||
} | ||
|
||
getScopeParameters() { | ||
if (_.isNil(this.observationBasedFilter)) return null; | ||
|
||
return { | ||
programUUIDs: Object.keys(this.observationBasedFilter.programs), | ||
encounterTypeUUIDs: Object.keys(this.observationBasedFilter.encounterTypes) | ||
}; | ||
} | ||
} |
17 changes: 0 additions & 17 deletions
17
packages/openchs-android/src/model/DashboardReportFilters.js
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.