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-4004: Fix Patient action menu button workspace #1336

Merged
merged 27 commits into from
Oct 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
e710137
feat-metrics
kb019 Jun 25, 2024
f56fc3a
resolve conflicts
kb019 Aug 19, 2024
5104ac5
update metrics
kb019 Aug 26, 2024
321625b
Merge branch 'main' into feat/metrics
kb019 Aug 28, 2024
801177b
correct test
kb019 Aug 28, 2024
dd661e0
refactor useAdmission
kb019 Aug 29, 2024
c870aba
Merge branch 'main' of https://github.com/openmrs/openmrs-esm-patient…
kb019 Aug 29, 2024
7c947c8
fix e2e tests
kb019 Aug 29, 2024
82b6817
(refactor) Refactor registration form cancel modal to match conventio…
denniskigen Aug 28, 2024
9a4671a
(feat) 03-3404: follow-up -ensure the dateAppointmentScheduled <= ap…
lucyjemutai Aug 28, 2024
7bb7ed3
Merge branch 'feat/metrics' of https://github.com/kb019/openmrs-esm-p…
kb019 Aug 29, 2024
6a7e24d
correct yarn.lock
kb019 Aug 29, 2024
5e7d993
Merge branch 'main' of https://github.com/openmrs/openmrs-esm-patient…
kb019 Aug 29, 2024
a83b944
fix metrics calculations
kb019 Sep 4, 2024
74d4137
resolve conflicts
kb019 Sep 4, 2024
e4671c5
add internationalization
kb019 Sep 16, 2024
d1f9f4b
correct mocks
kb019 Sep 17, 2024
4211d83
add dir attribute
kb019 Sep 17, 2024
d2bb04d
resolve conflicts
kb019 Sep 18, 2024
bc68943
Merge branch 'main' of https://github.com/openmrs/openmrs-esm-patient…
kb019 Sep 18, 2024
9a1ca44
remove i18n code
kb019 Sep 18, 2024
18f854a
clean code
kb019 Sep 20, 2024
7eac5bf
Merge branch 'main' of https://github.com/openmrs/openmrs-esm-patient…
kb019 Sep 20, 2024
57a7dfa
use admissionLocation as source of truth
kb019 Oct 1, 2024
423475a
resolved conflicts
kb019 Oct 1, 2024
e9ff288
fix patient error
kb019 Oct 7, 2024
9875458
resolved conflicts
kb019 Oct 7, 2024
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
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import WardPatientBedNumber from './row-elements/ward-patient-bed-number';
import WardPatientName from './row-elements/ward-patient-name';
import { WardPatientCardElement } from './ward-patient-card-element.component';
import styles from './ward-patient-card.scss';
import { launchPatientWorkspace, setWardPatient } from './ward-patient-resource';

const WardPatientCard: WardPatientCard = (wardPatient) => {
const { patient, bed } = wardPatient;
Expand Down Expand Up @@ -57,9 +58,8 @@ const WardPatientCard: WardPatientCard = (wardPatient) => {
<button
className={styles.wardPatientCardButton}
onClick={() => {
launchWorkspace<WardPatientWorkspaceProps>('ward-patient-workspace', {
wardPatient,
});
setWardPatient(wardPatient);
launchPatientWorkspace();
}}>
{/* Name will not be displayed; just there for a11y */}
{getPatientName(patient.person)}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import { launchWorkspace } from '@openmrs/esm-framework';
import { type WardPatient, type WardPatientWorkspaceProps } from '../types';

//To keep track of current patient when clicked on ward-patient-card and pass
//it as a prop to launch workspace
let wardPatient: WardPatient = null;
Copy link
Contributor

Choose a reason for hiding this comment

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

Can you add a comment on why we need this?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

added the comment.Thanks

export function setWardPatient(currentWardPatient: WardPatient) {
wardPatient = currentWardPatient;
}

export function launchPatientWorkspace() {
launchWorkspace<WardPatientWorkspaceProps>('ward-patient-workspace', {
wardPatient,
});
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import React from 'react';
import { useTranslation } from 'react-i18next';
import { UserAvatarIcon } from '@openmrs/esm-framework';
import { ActionMenuButton, launchWorkspace } from '@openmrs/esm-framework';
import { launchPatientWorkspace } from '../../ward-patient-card/ward-patient-resource';

export default function WardPatientActionButton() {
const { t } = useTranslation();
Expand All @@ -11,7 +12,7 @@ export default function WardPatientActionButton() {
getIcon={(props) => <UserAvatarIcon {...props} />}
label={t('Patient', 'patient')}
iconDescription={t('Patient', 'patient')}
handler={() => launchWorkspace('ward-patient-workspace')}
handler={() => launchPatientWorkspace()}
type={'ward'}
/>
);
Expand Down
Loading