2022-04-19 18:57:19 +05:00
|
|
|
import { useParams } from 'react-router-dom'
|
|
|
|
import { memo, useContext, useMemo } from 'react'
|
2022-04-18 17:36:57 +05:00
|
|
|
import { FilePdfOutlined } from '@ant-design/icons'
|
2022-04-19 18:57:19 +05:00
|
|
|
import { Layout } from 'antd'
|
2022-04-18 17:36:57 +05:00
|
|
|
|
2022-04-19 18:57:19 +05:00
|
|
|
import { PrivateMenu, PrivateSwitch } from '@components/Private'
|
2022-04-18 17:36:57 +05:00
|
|
|
|
|
|
|
import DailyReport from './DailyReport'
|
|
|
|
import DiagramReport from './DiagramReport'
|
2022-04-19 18:57:19 +05:00
|
|
|
import { RootPathContext } from '@pages/Main'
|
2022-04-18 17:36:57 +05:00
|
|
|
|
|
|
|
const { Content } = Layout
|
|
|
|
|
2022-04-19 18:57:19 +05:00
|
|
|
export const Reports = memo(() => {
|
2022-04-18 17:36:57 +05:00
|
|
|
const { tab } = useParams()
|
|
|
|
|
2022-04-19 18:57:19 +05:00
|
|
|
const root = useContext(RootPathContext)
|
|
|
|
const rootPath = useMemo(() => `${root}/reports`, [root])
|
2022-04-18 17:36:57 +05:00
|
|
|
|
2022-04-19 18:57:19 +05:00
|
|
|
return (
|
|
|
|
<RootPathContext.Provider value={rootPath}>
|
2022-04-18 17:36:57 +05:00
|
|
|
<Layout>
|
2022-04-19 18:57:19 +05:00
|
|
|
<PrivateMenu mode={'horizontal'} selectable={true} selectedKeys={[tab]} className={'well_menu'}>
|
|
|
|
<PrivateMenu.Link key={'diagram_report'} icon={<FilePdfOutlined />} title={'Диаграмма'}/>
|
|
|
|
<PrivateMenu.Link key={'daily_report'} title={'Суточный рапорт'} />
|
|
|
|
</PrivateMenu>
|
|
|
|
|
|
|
|
<Layout>
|
|
|
|
<Content className={'site-layout-background'}>
|
|
|
|
<PrivateSwitch elseRedirect={['diagram_report', 'daily_report']}>
|
|
|
|
<DiagramReport key={'diagram_report'} />
|
|
|
|
<DailyReport key={'daily_report'} />
|
|
|
|
</PrivateSwitch>
|
|
|
|
</Content>
|
|
|
|
</Layout>
|
2022-04-18 17:36:57 +05:00
|
|
|
</Layout>
|
2022-04-19 18:57:19 +05:00
|
|
|
</RootPathContext.Provider>
|
2022-04-18 17:36:57 +05:00
|
|
|
)
|
|
|
|
})
|
|
|
|
|
|
|
|
export default Reports
|