Skip to content

Commit 878ffe8

Browse files
committed
feat: add reports page
1 parent 5f13716 commit 878ffe8

File tree

10 files changed

+761
-16
lines changed

10 files changed

+761
-16
lines changed

frontend/package.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,16 @@
55
"proxy1": "http://18.185.65.50/",
66
"proxy": "http://localhost:5000/",
77
"dependencies": {
8-
"@date-io/moment": "2.11.0",
8+
"@date-io/moment": "^2.13.1",
99
"@emotion/react": "^11.6.0",
1010
"@emotion/styled": "^11.6.0",
1111
"@material-ui/core": "^4.11.4",
1212
"@material-ui/icons": "^4.11.2",
1313
"@material-ui/pickers": "^3.3.10",
1414
"@mui/icons-material": "^5.2.5",
1515
"@mui/material": "^5.1.1",
16+
"@mui/x-date-pickers": "^5.0.0-alpha.2",
17+
"@mui/x-date-pickers-pro": "^5.0.0-alpha.2",
1618
"@testing-library/jest-dom": "^5.11.4",
1719
"@testing-library/react": "^12.1.2",
1820
"@testing-library/user-event": "^13.5.0",

frontend/src/App.tsx

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,8 @@ import OrderEdit from './pages/orders/OrderEdit';
2424
import PaidOuts from './pages/PaidOuts';
2525
import Settings from './pages/administration/Settings';
2626
import Cash from './pages/administration/Cash';
27+
import { RequestPage } from '@mui/icons-material';
28+
import RequestsReport from './pages/reports/RequestsReport';
2729

2830
const App = () => {
2931
const dispatch = useDispatch();
@@ -97,6 +99,9 @@ const App = () => {
9799
<Route exact path="/paids">
98100
<PaidOuts />
99101
</Route>
102+
<Route exact path="/reports/requests-report">
103+
<RequestsReport />
104+
</Route>
100105

101106
{(userRole === 'ADMIN' || userRole === 'SUPER_ADMIN') && (
102107
<>

frontend/src/components/Appbar/Appbar.tsx

Lines changed: 55 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ import { changeDrawer } from '../../store/actions/mainActions';
2121
import { StoreModel } from '../../models/storeModel';
2222
import PeopleAltOutlinedIcon from '@material-ui/icons/PeopleAltOutlined';
2323
import { useHistory, useLocation } from 'react-router';
24-
import { adminRoutes, routes } from '../../utils/routes';
24+
import { adminRoutes, reportsRoutes, routes } from '../../utils/routes';
2525
import ExpandLess from '@material-ui/icons/ExpandLess';
2626
import ExpandMore from '@material-ui/icons/ExpandMore';
2727
import { useState } from 'react';
@@ -35,6 +35,7 @@ import PlaylistAddCheckIcon from '@material-ui/icons/PlaylistAddCheck';
3535
import EmojiPeopleIcon from '@material-ui/icons/EmojiPeople';
3636
import AttachMoneyIcon from '@material-ui/icons/AttachMoney';
3737
import PointOfSaleIcon from '@mui/icons-material/PointOfSale';
38+
import AssessmentIcon from '@mui/icons-material/Assessment';
3839

3940
const Appbar = () => {
4041
const open = useSelector((state: StoreModel) => state.mainStore.isDrawerOpen);
@@ -45,11 +46,16 @@ const Appbar = () => {
4546
const history = useHistory();
4647
const location = useLocation();
4748
const [openSubMenu, setOpenSubMenu] = useState(false);
49+
const [openReports, setOpenReports] = useState(false);
4850

4951
const handleOpenSubmenu = () => {
5052
setOpenSubMenu(!openSubMenu);
5153
};
5254

55+
const handleReportsMenu = () => {
56+
setOpenReports(!openReports);
57+
};
58+
5359
const handleChange = () => {
5460
dispatch(changeDrawer(!open));
5561
};
@@ -127,9 +133,56 @@ const Appbar = () => {
127133
</ListItem>
128134
))}
129135

136+
<ListItem
137+
button
138+
onClick={handleReportsMenu}
139+
className={
140+
location.pathname === '/reports'
141+
? 'menu__item menu__item_selected'
142+
: 'menu__item'
143+
}
144+
>
145+
<ListItemIcon>
146+
<AssessmentIcon />
147+
</ListItemIcon>
148+
<ListItemText primary="Отчеты" />
149+
{openReports ? <ExpandLess /> : <ExpandMore />}
150+
</ListItem>
151+
152+
<Collapse in={openReports} unmountOnExit>
153+
<List component="div" disablePadding className="menu__nested">
154+
{reportsRoutes.map((route, index) => (
155+
<ListItem
156+
key={index}
157+
button
158+
onClick={() => navigateTo(route.path)}
159+
selected={location.pathname === route.path}
160+
className={
161+
location.pathname === route.path
162+
? 'menu__item menu__item_selected'
163+
: 'menu__item'
164+
}
165+
>
166+
<ListItemIcon>
167+
{route.code === 'requestsReport' && <WorkIcon />}
168+
</ListItemIcon>
169+
<ListItemText primary={route.name} />
170+
</ListItem>
171+
))}
172+
</List>
173+
</Collapse>
174+
130175
{(userRoleCode === 'ADMIN' || userRoleCode === 'SUPER_ADMIN') && (
131176
<>
132-
<ListItem button onClick={handleOpenSubmenu}>
177+
<ListItem
178+
button
179+
onClick={handleOpenSubmenu}
180+
className={
181+
location.pathname === '/administration'
182+
? 'menu__item menu__item_selected'
183+
: 'menu__item'
184+
}
185+
>
133186
<ListItemIcon>
134187
<SettingsIcon />
135188
</ListItemIcon>
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
.filters {
2+
padding: 12px;
3+
}

0 commit comments

Comments
 (0)