Skip to content

Commit c1f61a9

Browse files
committed
Merge branch '1328-eusm-commodity-rd' into 1328-eusm-commodity-cu
2 parents 4cc749b + 450cab6 commit c1f61a9

File tree

4 files changed

+16
-5
lines changed

4 files changed

+16
-5
lines changed

app/src/App/tests/App.test.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -242,7 +242,7 @@ describe('App - authenticated', () => {
242242
`${LIST_COMMODITY_URL}?${viewDetailsQuery}=1`
243243
);
244244
wrapper.update();
245-
expect(wrapper.find('ViewDetails')).toHaveLength(1);
245+
expect(wrapper.find('ViewDetailsWrapper')).toHaveLength(1);
246246

247247
// go to new resource page
248248
(wrapper.find('Router').prop('history') as RouteComponentProps['history']).push(

app/src/configs/__mocks__/env.ts

+2
Original file line numberDiff line numberDiff line change
@@ -44,3 +44,5 @@ export const ENABLE_QUEST = true;
4444
export const BACKEND_ACTIVE = false;
4545

4646
export const ENABLE_FHIR_USER_MANAGEMENT = true;
47+
48+
export const COMMODITIES_LIST_RESOURCE_ID = 'ad';

packages/fhir-group-management/src/components/CommodityList/Eusm/List.tsx

+9-4
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ import {
1212
import { TFunction } from '@opensrp/i18n';
1313
import { useSearchParams, viewDetailsQuery } from '@opensrp/react-utils';
1414
import { supplyMgSnomedCode, snomedCodeSystem } from '../../../helpers/utils';
15-
import { useUserRole } from '@opensrp/rbac';
15+
import { RbacCheck, useUserRole } from '@opensrp/rbac';
1616
import { ViewDetailsWrapper } from './ViewDetails';
1717

1818
interface GroupListProps {
@@ -90,9 +90,14 @@ export const EusmCommodityList = (props: GroupListProps) => {
9090
// eslint-disable-next-line react/display-name
9191
render: (_: unknown, record: TableData) => (
9292
<span className="d-flex align-items-center">
93-
<Link to={`${ADD_EDIT_COMMODITY_URL}/${record.id}`} className="m-0 p-1">
94-
{t('Edit')}
95-
</Link>
93+
<RbacCheck permissions={['Group.update']}>
94+
<>
95+
<Link to={`${ADD_EDIT_COMMODITY_URL}/${record.id}`} className="m-0 p-1">
96+
{t('Edit')}
97+
</Link>
98+
<Divider type="vertical" />
99+
</>
100+
</RbacCheck>
96101
<Divider type="vertical" />
97102
<Dropdown
98103
menu={{ items: getItems(record) }}

packages/fhir-group-management/src/components/CommodityList/Eusm/tests/__snapshots__/list.test.tsx.snap

+4
Original file line numberDiff line numberDiff line change
@@ -269,6 +269,10 @@ exports[`renders correctly when listing resources: table row 1 page 1 6`] = `
269269
class="ant-divider css-dev-only-do-not-override-k7429z ant-divider-vertical"
270270
role="separator"
271271
/>
272+
<div
273+
class="ant-divider css-dev-only-do-not-override-k7429z ant-divider-vertical"
274+
role="separator"
275+
/>
272276
<span
273277
aria-label="more"
274278
class="anticon anticon-more ant-dropdown-trigger more-options"

0 commit comments

Comments
 (0)