2022-06-09 17:51:41 +05:00
|
|
|
import { Navigate, Route, Routes } from 'react-router-dom'
|
|
|
|
import { memo, 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-06-09 17:51:41 +05:00
|
|
|
import { RootPathContext, useRootPath } from '@asb/context'
|
|
|
|
import { PrivateMenu } from '@components/Private'
|
|
|
|
import { NoAccessComponent, wrapPrivateComponent } from '@utils'
|
2022-04-18 17:36:57 +05:00
|
|
|
|
|
|
|
import DailyReport from './DailyReport'
|
|
|
|
import DiagramReport from './DiagramReport'
|
|
|
|
|
|
|
|
const { Content } = Layout
|
|
|
|
|
2022-06-09 17:51:41 +05:00
|
|
|
const Reports = memo(() => {
|
|
|
|
const root = useRootPath()
|
2022-04-19 18:57:19 +05:00
|
|
|
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-06-09 17:51:41 +05:00
|
|
|
<PrivateMenu className={'well_menu'}>
|
|
|
|
<PrivateMenu.Link content={DiagramReport} icon={<FilePdfOutlined />} />
|
|
|
|
<PrivateMenu.Link content={DailyReport} />
|
2022-04-19 18:57:19 +05:00
|
|
|
</PrivateMenu>
|
|
|
|
|
|
|
|
<Layout>
|
|
|
|
<Content className={'site-layout-background'}>
|
2022-06-09 17:51:41 +05:00
|
|
|
<Routes>
|
|
|
|
<Route index element={<Navigate to={'diagram_report'} replace />} />
|
|
|
|
<Route path={'*'} element={<NoAccessComponent />} />
|
|
|
|
|
|
|
|
<Route path={DiagramReport.route} element={<DiagramReport />} />
|
|
|
|
<Route path={DailyReport.route} element={<DailyReport />} />
|
|
|
|
</Routes>
|
2022-04-19 18:57:19 +05:00
|
|
|
</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
|
|
|
)
|
|
|
|
})
|
|
|
|
|
2022-06-09 17:51:41 +05:00
|
|
|
export default wrapPrivateComponent(Reports, {
|
|
|
|
requirements: [],
|
|
|
|
title: 'Рапорта',
|
|
|
|
route: 'reports/*',
|
|
|
|
key: 'reports',
|
|
|
|
})
|