1
- import React from 'react' ;
1
+ import React , { useState } from 'react' ;
2
2
import { useSimpleTabularView } from '@opensrp/react-utils' ;
3
3
import { RouteComponentProps } from 'react-router' ;
4
4
import { ILocation } from '@smile-cdr/fhirts/dist/FHIR-R4/interfaces/ILocation' ;
9
9
} from '../../constants' ;
10
10
import {
11
11
BrokenPage ,
12
- useSearchParams ,
13
12
TableLayout ,
14
- viewDetailsQuery ,
15
13
PageHeader ,
16
14
SearchForm ,
17
15
} from '@opensrp/react-utils' ;
@@ -20,10 +18,9 @@ import { Helmet } from 'react-helmet';
20
18
import { useTranslation } from '../../mls' ;
21
19
import { Row , Col , Button , Divider , Dropdown } from 'antd' ;
22
20
import { useHistory , Link } from 'react-router-dom' ;
23
- import { RbacCheck , useUserRole } from '@opensrp/rbac' ;
21
+ import { RbacCheck } from '@opensrp/rbac' ;
24
22
import type { MenuProps } from 'antd' ;
25
23
import { MoreOutlined , PlusOutlined } from '@ant-design/icons' ;
26
- import { LocationUnitDetail } from '../LocationUnitDetail' ;
27
24
28
25
interface RouteParams {
29
26
locationId : string | undefined ;
@@ -48,8 +45,7 @@ export const AllLocationListFlat: React.FC<LocationListPropTypes> = (props) => {
48
45
const { fhirBaseURL } = props ;
49
46
const { t } = useTranslation ( ) ;
50
47
const history = useHistory ( ) ;
51
- const { addParam, sParams } = useSearchParams ( ) ;
52
- const userRole = useUserRole ( ) ;
48
+ const [ _ , setDetailId ] = useState < string > ( ) ;
53
49
54
50
const {
55
51
queryValues : { data, isFetching, isLoading, error} ,
@@ -76,20 +72,13 @@ export const AllLocationListFlat: React.FC<LocationListPropTypes> = (props) => {
76
72
return [
77
73
{
78
74
key : '1' ,
79
- permissions : [ ] ,
80
75
label : (
81
- < Button type = "link" onClick = { ( ) => addParam ( viewDetailsQuery , record . id ) } >
82
- View Details
76
+ < Button disabled type = "link" onClick = { ( ) => setDetailId ( record . id ) } >
77
+ { t ( ' View details' ) }
83
78
</ Button >
84
79
) ,
85
80
} ,
86
- ]
87
- . filter ( ( item ) => userRole . hasPermissions ( item . permissions ) )
88
- . map ( ( item ) => {
89
- const { permissions, ...rest } = item ;
90
- return rest ;
91
- } ) ;
92
- } ;
81
+ ] } ;
93
82
94
83
const columns = [
95
84
{
0 commit comments