From 7c0c56f19def3af018ce402fbf702c4f0df72918 Mon Sep 17 00:00:00 2001 From: sainingo Date: Wed, 17 Jul 2024 11:36:53 +0300 Subject: [PATCH 1/3] POC-768: Group Manager Bug --- .../group-detail/group-detail.component.html | 8 +----- .../group-detail/group-detail.component.ts | 27 ++++++++++++++++--- 2 files changed, 24 insertions(+), 11 deletions(-) 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..10052201c 100644 --- a/src/app/group-manager/group-detail/group-detail.component.html +++ b/src/app/group-manager/group-detail/group-detail.component.html @@ -242,7 +242,7 @@
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) { From 654d091336cf377f43b2300e59f93bfa0acf1c7e Mon Sep 17 00:00:00 2001 From: sainingo Date: Wed, 17 Jul 2024 11:49:40 +0300 Subject: [PATCH 2/3] Fix prettier issues --- .../group-manager/group-detail/group-detail.component.html | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) 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 10052201c..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 @@
{{ enrollmentErrorMessage }}
-
+