Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

(fix) O3-2197: Add the ability to remove a patient from a list #832

Merged
merged 5 commits into from
Oct 27, 2023

Conversation

jwnasambu
Copy link
Contributor

@jwnasambu jwnasambu commented Oct 3, 2023

Requirements

Summary

In this PR, I've added the ability to remove a patient from a list. I've added an icon button to each row in the list members datatable on the list details page. When this button is clicked, a modal prompts the user to confirm that they want to remove the specified patient from the list. Confirming removes the patient from the list and updates the list accordingly.

Screenshots

screencast.2023-10-04.3.AM-01-25.mp4

Related Issue

https://issues.openmrs.org/browse/O3-2197

Other

None

@jwnasambu
Copy link
Contributor Author

@denniskigen, @ibacher, @vasharma05, @dkayiwa Kindly in reference to this link, I kindly request you review my work at your convinient time please!

@denniskigen denniskigen changed the title (fix)O3-2197: Unable to remove a patient from a list (fix) O3-2197: Add the ability to remove a patient from a list Oct 4, 2023
return postData(
`${cohortUrl}/cohortmember/${cohortMembershipUuid}`,
{
endDate: new Date(),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@dkayiwa what should happen after removing a patient from a list using this function? Should subsequently fetching the list return a response whose endDate property is set to the value passed above? And further, should the frontend filter the returned cohort data to remove entries with an endDate property?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

After removing a patient from the list, the original REST call which was used, should return a list which does not include the removed patient.

@denniskigen denniskigen force-pushed the (fix)O3-2197 branch 2 times, most recently from 584b0ae to f623038 Compare October 27, 2023 21:08
`${cohortUrl}/cohortmember?cohort=${patientListUuid}&startIndex=${startIndex}&limit=${pageSize}&v=${v}&q=${searchQuery}`,
openmrsFetch,
);
return { ...swrResult, data: swrResult?.data?.data?.results };

// FIXME: This is a workaround for removing a patient from a list
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@dkayiwa I've ended up filtering the lists on the frontend to remove patients from the list if a cohort membership has an endDate property.

@denniskigen denniskigen merged commit bac09af into openmrs:main Oct 27, 2023
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants