forked from openmrs/openmrs-esm-patient-chart
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
(feat) Add functionality to allow deleting and editing an allergy (op…
…enmrs#1703) * Add functionality to allow deleting and editing an allergy (feat) O3-2760: Add a `closeWorkspaceWithSavedChanges` function to the workspace API (openmrs#1689) * Added new function 'closeWorkspaceWithSavedChanges' to close workspace after form is saved * Passing 'closeWorkspaceWithSavedChanges' as workspace props (docs) Amend steps for updating core libraries in README (openmrs#1690) (chore) Bump @openmrs/ngx-formentry (openmrs#1684) (fix) O3 2804: Reuse the ResponsiveWrapper component from esm-framework (openmrs#1673) * (feat) Reuse ResponsiveWrapper component from esm-framework * feat: Added Layer in visit-notes-form * Fix styleguide imports by bumping both openmrs tooling and framework * Misc fixes --------- Co-authored-by: Dennis Kigen <kigen.work@gmail.com> (refactor) O3-2815: Replace usages of `/ws/rest/v1` with `restBaseUrl` (openmrs#1661) * (Refactor)O3-2815: Replace usages of '/ws/rest/v1' with restBaseUrl * Fixup --------- Co-authored-by: jwnasambu <wamalwa1844.com> Co-authored-by: Dennis Kigen <kigen.work@gmail.com> (feat) Add ability to cancel orders (openmrs#1640) * (feat) cancel order * clean up * pr changes, reload fixes and clean up * translations * wip cancel order via action * mutate orders on cancel * order mutations and pr comments * fixes to labs * button text change * Fixup * More tweaks --------- Co-authored-by: Dennis Kigen <kigen.work@gmail.com> (chore) Add generic slot to Visit Form (openmrs#1688) * (chore) Add billing slot to Start Visit Form * Add generic visit attribute slot * remove slot from config --------- Co-authored-by: CynthiaKamau <cynthiakamau54@gmail.com> (chore) Bump Angular form engine (openmrs#1694) (feat) Makes orders widget expandable and adds detailed order view (openmrs#1696) * (feat) Expandable orders widget * adds order item cards when expanded * changes button to tooltip (fix) O3-2629: Submit button on Allergy Form remains disabled when filling allergen and severity before reactions (openmrs#1699) fix the allergy reaction dependency (feat) Hide bottom navigation on tablets and phones when workspace is active (openmrs#1695) (feat) Relocate Load More button in visits section (openmrs#1702) (chore) Relocate Load More button in visits section add closeWorkspaceWithSavedChanges argument to Allergy form parameterised allergy reaction should be checked correctly maintain non-coded allergen array remove test (chore) Prettier should only list files that don't formatting config (feat) Add config to handle bill submission in start visit form (openmrs#1700) Upgrade peter-evans/create-pull-request See peter-evans/create-pull-request#2790 (chore) Update translations from Transifex (openmrs#1683) add test fix added test * clean deletePatientAllergy function * Update packages/esm-patient-allergies-app/src/allergies/allergies-form/allergy-form.component.tsx Co-authored-by: Dennis Kigen <kigen.work@gmail.com> * Update packages/esm-patient-allergies-app/src/allergies/allergies-form/allergy-form.test.tsx Co-authored-by: Dennis Kigen <kigen.work@gmail.com> * Update packages/esm-patient-allergies-app/src/allergies/allergies-form/allergy-form.resource.ts Co-authored-by: Dennis Kigen <kigen.work@gmail.com> * (chore) Bump @openmrs/ngx-formentry * make default allergy loading more clean * fix linting --------- Co-authored-by: Dennis Kigen <kigen.work@gmail.com>
- Loading branch information
1 parent
68346cc
commit e731eb3
Showing
12 changed files
with
391 additions
and
44 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
60 changes: 60 additions & 0 deletions
60
packages/esm-patient-allergies-app/src/allergies/allergies-action-menu.component.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
import React, { useCallback } from 'react'; | ||
import { useTranslation } from 'react-i18next'; | ||
import { Layer, OverflowMenu, OverflowMenuItem } from '@carbon/react'; | ||
import { launchPatientWorkspace } from '@openmrs/esm-patient-common-lib'; | ||
import { showModal, useLayoutType } from '@openmrs/esm-framework'; | ||
import { type Allergy } from './allergy-intolerance.resource'; | ||
import styles from './allergies-action-menu.scss'; | ||
import { patientAllergiesFormWorkspace } from '../constants'; | ||
|
||
interface allergiesActionMenuProps { | ||
allergy: Allergy; | ||
patientUuid?: string; | ||
} | ||
|
||
export const AllergiesActionMenu = ({ allergy, patientUuid }: allergiesActionMenuProps) => { | ||
const { t } = useTranslation(); | ||
const isTablet = useLayoutType() === 'tablet'; | ||
|
||
const launchEditAllergiesForm = useCallback(() => { | ||
launchPatientWorkspace(patientAllergiesFormWorkspace, { | ||
workspaceTitle: t('editAllergy', 'Edit an Allergy'), | ||
allergy, | ||
formContext: 'editing', | ||
}); | ||
}, [allergy, t]); | ||
|
||
const launchDeleteAllergyDialog = (allergyId: string) => { | ||
const dispose = showModal('allergy-delete-confirmation-dialog', { | ||
closeDeleteModal: () => dispose(), | ||
allergyId, | ||
patientUuid, | ||
}); | ||
}; | ||
|
||
return ( | ||
<Layer className={styles.layer}> | ||
<OverflowMenu | ||
aria-label={t('editOrDeleteAllergy', 'Edit or delete allergy')} | ||
size={isTablet ? 'lg' : 'sm'} | ||
flipped | ||
align="left" | ||
> | ||
<OverflowMenuItem | ||
className={styles.menuItem} | ||
id="editAllergy" | ||
onClick={launchEditAllergiesForm} | ||
itemText={t('edit', 'Edit')} | ||
/> | ||
<OverflowMenuItem | ||
className={styles.menuItem} | ||
id="deleteAllergy" | ||
itemText={t('delete', 'Delete')} | ||
onClick={() => launchDeleteAllergyDialog(allergy.id)} | ||
isDelete | ||
hasDivider | ||
/> | ||
</OverflowMenu> | ||
</Layer> | ||
); | ||
}; |
11 changes: 11 additions & 0 deletions
11
packages/esm-patient-allergies-app/src/allergies/allergies-action-menu.scss
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
.layer { | ||
height: 100%; | ||
|
||
:global(.cds--overflow-menu) { | ||
min-height: unset; | ||
} | ||
} | ||
|
||
.menuItem { | ||
max-width: none; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.