@@ -8,7 +8,7 @@ import SubjectProfilePicture from "./SubjectProfilePicture";
88import OrganisationConfigService from "../../service/OrganisationConfigService" ;
99import _ from 'lodash' ;
1010import ConceptService from "../../service/ConceptService" ;
11- import { Observation } from 'avni -models' ;
11+ import { Observation , ProgramEnrolment } from 'openchs -models' ;
1212import EncounterService from "../../service/EncounterService" ;
1313import IndividualService from "../../service/IndividualService" ;
1414import AddressLevelService from "../../service/AddressLevelService" ;
@@ -71,6 +71,9 @@ class SubjectInfoCard extends AbstractComponent {
7171 const i18n = this . I18n ;
7272 const conceptService = this . getService ( ConceptService ) ;
7373 const iconContainerStyle = { minHeight : 72 , alignItems : 'center' , justifyContent : 'center' } ;
74+ const enrolledPrograms = _ . filter ( this . props . individual . nonVoidedEnrolments ( ) , ( enrolment ) => enrolment . isActive )
75+ . map ( ( x : ProgramEnrolment ) => x . program ) ;
76+
7477 return (
7578 < View style = { {
7679 flexDirection : 'row' ,
@@ -127,7 +130,7 @@ class SubjectInfoCard extends AbstractComponent {
127130 justifyContent : 'flex-end' ,
128131 flexWrap : 'wrap' ,
129132 } } >
130- { _ . filter ( this . props . individual . nonVoidedEnrolments ( ) , ( enrolment ) => enrolment . isActive ) . map ( ( enrolment , index ) => this . renderProgram ( enrolment . program , index ) ) }
133+ { _ . uniqBy ( enrolledPrograms , ( x ) => x . name ) . map ( ( program , index ) => this . renderProgram ( program , index ) ) }
131134 </ View > }
132135 </ View >
133136 </ View >
0 commit comments