From 29da491be18960714e2b4709d94b72b99b366d5c Mon Sep 17 00:00:00 2001 From: kajambiya Date: Wed, 17 Jan 2024 13:09:37 +0300 Subject: [PATCH] fix missing appointment date on TB dashboard summary --- .../cohort-patient-list.component.tsx | 1 + .../tb-patient-list-tabs.component.tsx | 11 +++++++++-- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/packages/esm-commons-lib/src/components/cohort-patient-list/cohort-patient-list.component.tsx b/packages/esm-commons-lib/src/components/cohort-patient-list/cohort-patient-list.component.tsx index 85d7ae2ab..564c1096c 100644 --- a/packages/esm-commons-lib/src/components/cohort-patient-list/cohort-patient-list.component.tsx +++ b/packages/esm-commons-lib/src/components/cohort-patient-list/cohort-patient-list.component.tsx @@ -286,6 +286,7 @@ export const CohortPatientList: React.FC = ({ autoFocus: true, }; }, [ + loadedExtraEncounters, searchTerm, filteredResults, paginatedPatients, diff --git a/packages/esm-tb-app/src/views/dashboard/patient-list-tabs/tb-patient-list-tabs.component.tsx b/packages/esm-tb-app/src/views/dashboard/patient-list-tabs/tb-patient-list-tabs.component.tsx index d445945d3..f9cb89ca9 100644 --- a/packages/esm-tb-app/src/views/dashboard/patient-list-tabs/tb-patient-list-tabs.component.tsx +++ b/packages/esm-tb-app/src/views/dashboard/patient-list-tabs/tb-patient-list-tabs.component.tsx @@ -23,6 +23,7 @@ function TbHomePatientTabs() { }, associatedEncounterType: config.encounterTypes.tbProgramEnrollment, excludeColumns: ['timeAddedToList', 'waitingTime', 'location', 'phoneNumber', 'hivResult'], + extraAssociatedEncounterTypes: [config.encounterTypes.tbTreatmentAndFollowUp], otherColumns: [ { key: 'caseID', @@ -49,8 +50,14 @@ function TbHomePatientTabs() { { key: 'nextAppointmentDate', header: t('appointmentDate', 'Appointment Date'), - getValue: ({ latestEncounter }) => { - return getObsFromEncounter(latestEncounter, config.obsConcepts.nextAppointmentDate, true); + getValue: (patient) => { + const patientLatestExtraEncounters = patient.latestExtraEncounters + if (patientLatestExtraEncounters && patientLatestExtraEncounters.length) { + const latestFollowUpEncounter = patientLatestExtraEncounters[0]; + return getObsFromEncounter(latestFollowUpEncounter, config.obsConcepts.nextAppointmentDate, true); + } else { + return '--'; + } }, }, {