Skip to content

Commit

Permalink
U4X-335-Fix-Clinician-workflow (#151)
Browse files Browse the repository at this point in the history
* Disable the edit of patient demographics
  • Loading branch information
jabahum authored and Mwanje committed Feb 6, 2024
1 parent c6eba2d commit 83d4c73
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ function ActiveVisitsTabs() {
const [selectedTab, setSelectedTab] = useState(0);
const [overlayHeader, setOverlayTitle] = useState('');

const status = 'completed' || 'serving' || 'pending';

return (
<div className={styles.container}>
<Tabs
Expand All @@ -21,12 +23,12 @@ function ActiveVisitsTabs() {
className={styles.tabs}
>
<TabList style={{ paddingLeft: '1rem' }} aria-label="Outpatient tabs" contained>
<Tab>{t('pending', 'Pending')}</Tab>
<Tab>{t('pending', 'In Queue')}</Tab>
<Tab>{t('completed', 'Completed')}</Tab>
</TabList>
<TabPanels>
<TabPanel style={{ padding: 0 }}>
<ActiveVisitsTable status={'pending'} />
<ActiveVisitsTable status={''} />
</TabPanel>
<TabPanel style={{ padding: 0 }}>
<ActiveVisitsTable status={'completed'} />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ import {
useConfig,
useLayoutType,
usePagination,
userHasAccess,
useSession,
} from '@openmrs/esm-framework';
import React, { AnchorHTMLAttributes, MouseEvent, useMemo, useState } from 'react';
Expand All @@ -53,6 +54,7 @@ import EmptyState from '../utils/empty-state/empty-state.component';
import ViewActionsMenu from './view-action-menu.components';
import CurrentVisit from '../current-visit/current-visit-summary.component';
import NotesActionsMenu from './notes-action-menu.components';
import { PRIVILEGE_ENABLE_EDIT_DEMOGRAPHICS } from '../constants';

type FilterProps = {
rowIds: Array<string>;
Expand Down Expand Up @@ -187,15 +189,21 @@ const ActiveVisitsTable: React.FC<ActiveVisitsTableProps> = ({ status }) => {
actions: {
content: (
<>
<PickPatientActionMenu queueEntry={entry} closeModal={() => true} />
<EditActionsMenu to={`\${openmrsSpaBase}/patient/${entry?.patientUuid}/edit`} from={fromPage} />
{entry.status === 'COMPLETED' && (
<>
<PickPatientActionMenu queueEntry={entry} closeModal={() => true} />
{session?.user && userHasAccess(PRIVILEGE_ENABLE_EDIT_DEMOGRAPHICS, session.user) && (
<EditActionsMenu to={`\${openmrsSpaBase}/patient/${entry?.patientUuid}/edit`} from={fromPage} />
)}
</>
)}
<ViewActionsMenu to={`\${openmrsSpaBase}/patient/${entry?.patientUuid}/chart`} from={fromPage} />
<NotesActionsMenu note={entry} />
</>
),
},
}));
}, [paginatedQueueEntries, t, fromPage]);
}, [paginatedQueueEntries, t, session.user, fromPage]);

const handleFilter = ({ rowIds, headers, cellsById, inputValue, getCellId }: FilterProps): Array<string> => {
return rowIds.filter((rowId) =>
Expand Down
1 change: 1 addition & 0 deletions packages/esm-patient-queues-app/src/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,4 @@ export const PRIVILEGE_CLINICIAN_METRIC = 'View Clinician Metrics';
export const PRIVILEGE_RECEPTION_QUEUE_LIST = 'View Reception Queuelist';
export const PRIVILEGE_TRIAGE_QUEUE_LIST = 'View Triage Queuelist';
export const PRIVILEGE_CLINICIAN_QUEUE_LIST = 'View Clinician Queuelist';
export const PRIVILEGE_ENABLE_EDIT_DEMOGRAPHICS = 'Edit Patient Demographics';

0 comments on commit 83d4c73

Please sign in to comment.