-
Notifications
You must be signed in to change notification settings - Fork 12
/
FhirTabs.jsx
57 lines (53 loc) · 1.88 KB
/
FhirTabs.jsx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
import React from 'react';
import { Tabs, Tab } from '@mui/material';
import { map } from 'lodash';
import OrgHomeChildrenList from '../orgs/OrgHomeChildrenList';
import { DEFAULT_LIMIT } from '../../common/constants';
const FhirTabs = ({ tab, onTabChange, selectedConfig, org, location, match, url, limit, hapi, nested}) => {
const tabConfigs = selectedConfig.config.tabs;
const selectedTabConfig = tabConfigs[tab];
const getTABHref = config => {
if(nested)
return `#/fhir${url}${config.type}${location.search}`
return `#/fhir/${config.type}${location.search}`
};
return (
<div className='col-md-12 sub-tab'>
<Tabs className='sub-tab-header col-md-8 no-side-padding' value={tab} onChange={onTabChange} aria-label="fhir-home-tabs" classes={{indicator: 'hidden'}}>
{
map(tabConfigs, config => <Tab key={config.label} label={config.label} component="a" href={getTABHref(config)} />)
}
</Tabs>
<div className='sub-tab-container' style={{display: 'flex', height: 'auto', width: '100%'}}>
<OrgHomeChildrenList
org={org}
location={location}
match={match}
url={url}
resource={selectedTabConfig.type}
viewFilters={selectedTabConfig.filters}
viewFields={selectedTabConfig.fields}
fixedFilters={{
limit: selectedTabConfig.page_size || limit || DEFAULT_LIMIT,
isTable: (selectedTabConfig.layout || '').toLowerCase() !== 'list',
sortParams: {sortAsc: '_id'}
}}
fhirParams={{
_getpagesoffset: 0,
_count: limit || DEFAULT_LIMIT,
_sort: '_id'
}}
staticParams={{
_total: 'accurate',
}}
noQuery
noHeaders
nested
fhir
hapi={hapi}
/>
</div>
</div>
)
}
export default FhirTabs;