diff --git a/src/app/group-manager/group-detail/group-detail-summary.component.html b/src/app/group-manager/group-detail/group-detail-summary.component.html
index f7a444eb1..fc629b506 100644
--- a/src/app/group-manager/group-detail/group-detail-summary.component.html
+++ b/src/app/group-manager/group-detail/group-detail-summary.component.html
@@ -108,10 +108,10 @@
Group Summary
-
+
Group Activity:
- {{ groupActivity?.value }}
+ {{ groupActivity?.value }}
|
diff --git a/src/app/group-manager/group-detail/group-detail-summary.component.ts b/src/app/group-manager/group-detail/group-detail-summary.component.ts
index b2b2783cb..509119428 100644
--- a/src/app/group-manager/group-detail/group-detail-summary.component.ts
+++ b/src/app/group-manager/group-detail/group-detail-summary.component.ts
@@ -550,6 +550,7 @@ export class GroupDetailSummaryComponent implements OnInit, OnDestroy {
public showUpdateGroupModal(modal) {
let program = null;
let provider = null;
+ const context = this.validOTZProgram;
this.program
? (program = this.program)
: (program = { name: null, value: null });
@@ -571,7 +572,7 @@ export class GroupDetailSummaryComponent implements OnInit, OnDestroy {
groupProgram: { label: program['name'], value: program['uuid'] },
provider: { label: provider.person.display, value: provider.person.uuid },
address: this.landmark.value,
- groupActivity: this.groupActivity.value,
+ groupActivity: context ? this.groupActivity.value : null,
groupUuid: this.group.uuid,
actionButtonText: 'Save Changes'
};
diff --git a/src/app/group-manager/group-detail/group-detail.component.html b/src/app/group-manager/group-detail/group-detail.component.html
index 133b77188..0d3ae5fa5 100644
--- a/src/app/group-manager/group-detail/group-detail.component.html
+++ b/src/app/group-manager/group-detail/group-detail.component.html
@@ -240,10 +240,7 @@ Add Membership
{{ enrollmentErrorMessage }}
-
+
The patient is not enrolled in this program.
-
- Patient is not eligible for OTZ enrollment
-
!group.voided
);
}
+ const targetProgramUuid = '203571d6-a4f2-4953-9e8b-e1105e2340f5';
+ const checkOTZProgram = programsEnrolled.some(
+ (program) => program.programUuid === targetProgramUuid
+ );
const validation = this.communityGroupMemberService.validateMemberEnrollment(
programsEnrolled,
currentGroupsEnrolled,
@@ -778,9 +782,17 @@ export class GroupDetailComponent implements OnInit, OnDestroy, AfterViewInit {
this.validatingEnrollment = false;
this.showEnrollmentAlert('Patient already enrolled in this group!');
break;
- case !validation.notEnrolledInGroupProgram.found:
+ case !validation.notEnrolledInGroupProgram.found &&
+ checkOTZProgram &&
+ this.isOtzProgram:
this.validatingEnrollment = false;
this.validateAge(patient);
+ if (this.showOTZEnrollmentMsg) {
+ this.showEnrollButton(patient);
+ }
+ break;
+ case !validation.notEnrolledInGroupProgram.found:
+ this.validatingEnrollment = false;
this.showEnrollButton(patient);
break;
case validation.enrolledInAnotherGroupInSameProgram.found:
@@ -839,12 +851,16 @@ export class GroupDetailComponent implements OnInit, OnDestroy, AfterViewInit {
}
private validateAge(patient) {
- if (patient._person.age > 9 && patient._person.age <= 24) {
+ const age = patient._person.age;
+
+ if (age > 9 && age <= 24) {
this.showOTZEnrollmentMsg = true;
- } else {
- this.showOTZEnrollmentMsg = false;
+ return;
}
+
+ this.showEnrollmentAlert('Patient is not eligible for OTZ enrollment!');
}
+
private enrollPatientToGroup(group: Group, patient: Patient) {
this.communityGroupMemberService
.createMember(group.uuid, patient.uuid)
@@ -859,6 +875,9 @@ export class GroupDetailComponent implements OnInit, OnDestroy, AfterViewInit {
private showEnrollmentAlert(msg: string) {
this.enrollmentErrorMessage = msg;
+ setTimeout(() => {
+ this.enrollmentErrorMessage = '';
+ }, 5000);
}
private transferPatientFromGroup(groupToEnroll, groupToUnenroll, patient) {