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

MF-641: Patient List Modal #22

Closed
Prev Previous commit
Next Next commit
Merge branch 'deploy_patient_list' of https://github.com/openmrs/open…
…mrs-esm-patient-management into deploy_patient_list
  • Loading branch information
vasharma05 committed Jul 14, 2021
commit 08164392bf85fdf501dc6715972c7e42b13d5e11
3 changes: 2 additions & 1 deletion packages/esm-patient-list-app/src/AddPatientToList/index.tsx
Original file line number Diff line number Diff line change
@@ -8,6 +8,7 @@ import styles from './add-patient-to-list.scss';

import { OpenmrsCohort, addPatientToList } from '../patientListData/api';
import SkeletonText from 'carbon-components-react/es/components/SkeletonText';
import { toOmrsIsoString } from '@openmrs/esm-framework';

const CheckboxedPatientList = ({ name, uuid, checked, handleChange }) => {
return (
@@ -45,8 +46,8 @@ const AddPatient: React.FC<{ close: () => void; patientUuid: string }> = ({ clos
if (selectedLists[patientList.uuid]) {
addPatientToList({
patient: 'b2f86b28-7998-4812-83a9-7f8ad3c47e66',
name: patientList.name,
cohort: patientList.uuid,
startDate: toOmrsIsoString(new Date()),
});
}
});
16 changes: 15 additions & 1 deletion packages/esm-patient-list-app/src/patientListData/api.ts
Original file line number Diff line number Diff line change
@@ -77,7 +77,21 @@ async function getPatientListMembers(cohortUuid: string) {
return patients;
}

export async function addPatientToList(data: { name: string; patient: string; cohort: string }) {
export async function getPatientListsForPatient(patientUuid: string) {
const {
results,
error,
}: {
results: Array<OpenmrsCohortMember>;
error: Error;
} = await (await fetch(`/openmrs/ws/rest/v1/cohortm/cohortmember?patient=${patientUuid}&v=default`)).json();

if (error) throw error;

return results;
}

export async function addPatientToList(data: { patient: string; cohort: string; startDate: string }) {
return postData('/openmrs/ws/rest/v1/cohortm/cohortmember', data);
}

You are viewing a condensed version of this merge commit. You can view the full changes here.