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: Completed Patient List Modal #26

Merged
merged 2 commits into from
Jul 27, 2021
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Closing modal workflow fixed
  • Loading branch information
vasharma05 committed Jul 27, 2021
commit b800ea632d47f7bb8f3013e83c10956dec3a66e1
11 changes: 2 additions & 9 deletions packages/esm-patient-list-app/src/AddPatientToList/index.tsx
Original file line number Diff line number Diff line change
@@ -10,20 +10,13 @@ import Checkbox from 'carbon-components-react/lib/components/Checkbox';
import SkeletonText from 'carbon-components-react/es/components/SkeletonText';
import styles from './add-patient-to-list.scss';

let closeModal = () => {};

export const openModal = () => {
closeModal = showModal('add-patient-to-patient-list-modal');
};

function getPatientUuidFromUrl(): string {
const match = /\/patient\/([a-zA-Z0-9\-]+)\/?/.exec(location.pathname);
return match && match[1];
}

interface AddPatientProps {
close: () => void;
patientUuid: string;
closeModal: () => void;
}

interface PatientListProp {
@@ -34,7 +27,7 @@ interface PatientListProp {

type PatientListObj = Record<string, PatientListProp>;

const AddPatient: React.FC<AddPatientProps> = ({ close }) => {
const AddPatient: React.FC<AddPatientProps> = ({ closeModal }) => {
const { t } = useTranslation();
const [searchValue, setSearchValue] = useState('');
const { loading, data } = usePatientListData();
6 changes: 5 additions & 1 deletion packages/esm-patient-list-app/src/patient-list-action.tsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,16 @@
import React from 'react';
import { useTranslation } from 'react-i18next';
import { showModal } from '@openmrs/esm-framework';
import { openModal } from './AddPatientToList';

interface AddPastVisitOverflowMenuItemProps {}

const AddPastVisitOverflowMenuItem: React.FC<AddPastVisitOverflowMenuItemProps> = () => {
const { t } = useTranslation();
const openModal = React.useCallback(() => {
const dispose = showModal('add-patient-to-patient-list-modal', {
closeModal: () => dispose(),
});
}, []);

return (
<>