diff --git a/packages/openchs-android/package-lock.json b/packages/openchs-android/package-lock.json index df1d5ea03..a1205724a 100644 --- a/packages/openchs-android/package-lock.json +++ b/packages/openchs-android/package-lock.json @@ -35,7 +35,7 @@ "lodash": "4.17.21", "moment": "2.29.4", "native-base": "3.4.9", - "openchs-models": "1.31.44", + "openchs-models": "1.31.46", "prop-types": "15.8.1", "react": "18.2.0", "react-native": "0.72.3", @@ -16441,9 +16441,9 @@ } }, "node_modules/openchs-models": { - "version": "1.31.44", - "resolved": "https://registry.npmjs.org/openchs-models/-/openchs-models-1.31.44.tgz", - "integrity": "sha512-dCpBqnyTAtz0nl6HNvg4ON98a1Bf+uJDtygZZlflWbOcIJ04CegBjzfVV2IAtI8svIsLKjIRRk4YgEJlsXyFcg==", + "version": "1.31.46", + "resolved": "https://registry.npmjs.org/openchs-models/-/openchs-models-1.31.46.tgz", + "integrity": "sha512-bFXWhzg84SRhZWOKR7bMV4wLd2FA2726yydsfnXDpR6K05YDFZruvNnJZ4EnmbLvzGSoagovVEWvw1LDcfOjbg==", "dependencies": { "uuid": "^9.0.1" }, @@ -35181,9 +35181,9 @@ } }, "openchs-models": { - "version": "1.31.44", - "resolved": "https://registry.npmjs.org/openchs-models/-/openchs-models-1.31.44.tgz", - "integrity": "sha512-dCpBqnyTAtz0nl6HNvg4ON98a1Bf+uJDtygZZlflWbOcIJ04CegBjzfVV2IAtI8svIsLKjIRRk4YgEJlsXyFcg==", + "version": "1.31.46", + "resolved": "https://registry.npmjs.org/openchs-models/-/openchs-models-1.31.46.tgz", + "integrity": "sha512-bFXWhzg84SRhZWOKR7bMV4wLd2FA2726yydsfnXDpR6K05YDFZruvNnJZ4EnmbLvzGSoagovVEWvw1LDcfOjbg==", "requires": { "uuid": "^9.0.1" } diff --git a/packages/openchs-android/package.json b/packages/openchs-android/package.json index b9f945e78..2c15cd210 100644 --- a/packages/openchs-android/package.json +++ b/packages/openchs-android/package.json @@ -58,7 +58,7 @@ "lodash": "4.17.21", "moment": "2.29.4", "native-base": "3.4.9", - "openchs-models": "1.31.44", + "openchs-models": "1.31.46", "prop-types": "15.8.1", "react": "18.2.0", "react-native": "0.72.3", diff --git a/packages/openchs-android/src/views/individual/SubjectDashboardGeneralTab.js b/packages/openchs-android/src/views/individual/SubjectDashboardGeneralTab.js index 7aa90c459..c9fe51d7a 100644 --- a/packages/openchs-android/src/views/individual/SubjectDashboardGeneralTab.js +++ b/packages/openchs-android/src/views/individual/SubjectDashboardGeneralTab.js @@ -14,6 +14,7 @@ import ActionSelector from "../common/ActionSelector"; import PrivilegeService from "../../service/PrivilegeService"; import NewFormButton from "../common/NewFormButton"; import AvniToast from "../common/AvniToast"; +import {SubjectType} from "openchs-models"; class SubjectDashboardGeneralTab extends AbstractComponent { static propTypes = { @@ -64,23 +65,25 @@ class SubjectDashboardGeneralTab extends AbstractComponent { } renderPlannedVisits() { - const scheduledEncounters = _.filter(_.map(this.state.encounters, 'encounter'), (encounter) => !encounter.encounterDateTime && !encounter.cancelDateTime); - const cancelVisitCriteria = `privilege.name = '${Privilege.privilegeName.cancelVisit}' AND privilege.entityType = '${Privilege.privilegeEntityType.encounter}' AND programUuid = null AND subjectTypeUuid = '${this.state.individual.subjectType.uuid}'`; - const allowedEncounterTypeUuidsForCancelVisit = this.privilegeService.allowedEntityTypeUUIDListForCriteria(cancelVisitCriteria, 'encounterTypeUuid'); - const performVisitCriteria = `privilege.name = '${Privilege.privilegeName.performVisit}' AND privilege.entityType = '${Privilege.privilegeEntityType.encounter}' AND programUuid = null AND subjectTypeUuid = '${this.state.individual.subjectType.uuid}'`; - const allowedEncounterTypeUuidsForPerformVisit = this.privilegeService.allowedEntityTypeUUIDListForCriteria(performVisitCriteria, 'encounterTypeUuid'); - return (); + if (this.state.individual.subjectType.getSetting(SubjectType.settingKeys.displayPlannedEncounters) !== false) { + const scheduledEncounters = _.filter(_.map(this.state.encounters, 'encounter'), (encounter) => !encounter.encounterDateTime && !encounter.cancelDateTime); + const cancelVisitCriteria = `privilege.name = '${Privilege.privilegeName.cancelVisit}' AND privilege.entityType = '${Privilege.privilegeEntityType.encounter}' AND programUuid = null AND subjectTypeUuid = '${this.state.individual.subjectType.uuid}'`; + const allowedEncounterTypeUuidsForCancelVisit = this.privilegeService.allowedEntityTypeUUIDListForCriteria(cancelVisitCriteria, 'encounterTypeUuid'); + const performVisitCriteria = `privilege.name = '${Privilege.privilegeName.performVisit}' AND privilege.entityType = '${Privilege.privilegeEntityType.encounter}' AND programUuid = null AND subjectTypeUuid = '${this.state.individual.subjectType.uuid}'`; + const allowedEncounterTypeUuidsForPerformVisit = this.privilegeService.allowedEntityTypeUUIDListForCriteria(performVisitCriteria, 'encounterTypeUuid'); + return (); + } } renderCompletedVisits() { diff --git a/packages/openchs-android/src/views/individual/SubjectDashboardProfileTab.js b/packages/openchs-android/src/views/individual/SubjectDashboardProfileTab.js index bd528ed92..e88af5cfd 100644 --- a/packages/openchs-android/src/views/individual/SubjectDashboardProfileTab.js +++ b/packages/openchs-android/src/views/individual/SubjectDashboardProfileTab.js @@ -40,6 +40,7 @@ import CustomActivityIndicator from "../CustomActivityIndicator"; import GroupSubjectService from "../../service/GroupSubjectService"; import UserInfoService from "../../service/UserInfoService"; import AvniToast from "../common/AvniToast"; +import {SubjectType} from "openchs-models"; class SubjectDashboardProfileTab extends AbstractComponent { static propTypes = { @@ -334,6 +335,14 @@ class SubjectDashboardProfileTab extends AbstractComponent { } + renderProfileOrVoided(individual) { + if (individual.subjectType.getSetting(SubjectType.settingKeys.displayRegistrationDetails) !== false) { + return + {individual.voided ? this.renderVoided() : this.renderProfile()} + + } + } + renderSummary() { return this.dispatchAction(Actions.ON_DISPLAY_INDICATOR_TOGGLE, {display})} /> {!_.isEmpty(this.state.subjectSummary) && this.renderSummary()} - - {individual.voided ? this.renderVoided() : this.renderProfile()} - + {this.renderProfileOrVoided(individual)} {relativesFeatureToggle ? this.renderRelatives() : } {groupSubjectToggle ? this.renderMembers() : } diff --git a/packages/openchs-android/src/views/program/SubjectDashboardProgramsTab.js b/packages/openchs-android/src/views/program/SubjectDashboardProgramsTab.js index 04afaca98..56f0970ca 100644 --- a/packages/openchs-android/src/views/program/SubjectDashboardProgramsTab.js +++ b/packages/openchs-android/src/views/program/SubjectDashboardProgramsTab.js @@ -27,6 +27,7 @@ import Icon from 'react-native-vector-icons/SimpleLineIcons' import Separator from "../primitives/Separator"; import UserInfoService from "../../service/UserInfoService"; import AvniToast from "../common/AvniToast"; +import {SubjectType} from "openchs-models"; class SubjectDashboardProgramsTab extends AbstractComponent { static propTypes = { @@ -147,21 +148,23 @@ class SubjectDashboardProgramsTab extends AbstractComponent { } renderPlannedVisits(allowedEncounterTypeUuids) { - const cancelEncounterCriteria = `privilege.name = '${Privilege.privilegeName.cancelVisit}' AND privilege.entityType = '${Privilege.privilegeEntityType.encounter}' AND subjectTypeUuid = '${this.state.enrolment.individual.subjectType.uuid}' AND programUuid = '${this.state.enrolment.program.uuid}'`; - const allowedEncounterTypeUuidsForCancelVisit = this.privilegeService.allowedEntityTypeUUIDListForCriteria(cancelEncounterCriteria, 'programEncounterTypeUuid'); - const programEnrolment = this.state.enrolment; - const scheduledEncounters = _.filter(programEnrolment.nonVoidedEncounters(), (encounter) => !encounter.encounterDateTime && !encounter.cancelDateTime); - return (); + if (this.state.enrolment.individual.subjectType.getSetting(SubjectType.settingKeys.displayPlannedEncounters) !== false) { + const cancelEncounterCriteria = `privilege.name = '${Privilege.privilegeName.cancelVisit}' AND privilege.entityType = '${Privilege.privilegeEntityType.encounter}' AND subjectTypeUuid = '${this.state.enrolment.individual.subjectType.uuid}' AND programUuid = '${this.state.enrolment.program.uuid}'`; + const allowedEncounterTypeUuidsForCancelVisit = this.privilegeService.allowedEntityTypeUUIDListForCriteria(cancelEncounterCriteria, 'programEncounterTypeUuid'); + const programEnrolment = this.state.enrolment; + const scheduledEncounters = _.filter(programEnrolment.nonVoidedEncounters(), (encounter) => !encounter.encounterDateTime && !encounter.cancelDateTime); + return (); + } } renderCompletedVisits() {