2024-03-21 14:24:56 +00:00
|
|
|
|
import { useState } from "react";
|
2024-03-20 12:18:09 +00:00
|
|
|
|
import {
|
|
|
|
|
Box,
|
|
|
|
|
Button,
|
|
|
|
|
IconButton,
|
|
|
|
|
Paper,
|
|
|
|
|
Typography,
|
|
|
|
|
useMediaQuery,
|
|
|
|
|
useTheme,
|
|
|
|
|
} from "@mui/material";
|
|
|
|
|
import { DatePicker } from "@mui/x-date-pickers";
|
2024-03-20 14:44:51 +00:00
|
|
|
|
import { LineChart } from "@mui/x-charts";
|
2024-03-20 12:18:09 +00:00
|
|
|
|
import moment from "moment";
|
2024-03-20 14:44:51 +00:00
|
|
|
|
|
|
|
|
|
import HeaderFull from "@ui_kit/Header/HeaderFull";
|
|
|
|
|
import SectionWrapper from "@ui_kit/SectionWrapper";
|
|
|
|
|
|
2024-03-21 14:24:56 +00:00
|
|
|
|
import { General } from "./General";
|
2024-03-25 15:02:24 +00:00
|
|
|
|
import { AnswersStatistics } from "./Answers";
|
2024-03-20 14:44:51 +00:00
|
|
|
|
import { Devices } from "./Devices";
|
|
|
|
|
|
2024-03-19 06:56:21 +00:00
|
|
|
|
import CalendarIcon from "@icons/CalendarIcon";
|
2024-03-20 14:44:51 +00:00
|
|
|
|
|
2024-03-20 12:18:09 +00:00
|
|
|
|
export default function Analytics() {
|
2024-03-20 14:44:51 +00:00
|
|
|
|
const [isOpen, setOpen] = useState(false);
|
|
|
|
|
const [isOpenEnd, setOpenEnd] = useState(false);
|
|
|
|
|
|
2024-03-20 12:18:09 +00:00
|
|
|
|
const theme = useTheme();
|
|
|
|
|
const isTablet = useMediaQuery(theme.breakpoints.down(1000));
|
|
|
|
|
const isMobile = useMediaQuery(theme.breakpoints.down(600));
|
2024-03-19 06:56:21 +00:00
|
|
|
|
|
2024-03-20 12:18:09 +00:00
|
|
|
|
const handleClose = () => {
|
|
|
|
|
setOpen(false);
|
|
|
|
|
};
|
|
|
|
|
const handleOpen = () => {
|
|
|
|
|
setOpen(true);
|
|
|
|
|
};
|
|
|
|
|
const onAdornmentClick = () => {
|
|
|
|
|
setOpen((old) => !old);
|
|
|
|
|
if (isOpenEnd === true) {
|
|
|
|
|
handleCloseEnd();
|
2024-03-19 06:56:21 +00:00
|
|
|
|
}
|
2024-03-20 12:18:09 +00:00
|
|
|
|
};
|
2024-03-19 06:56:21 +00:00
|
|
|
|
|
2024-03-20 12:18:09 +00:00
|
|
|
|
const handleCloseEnd = () => {
|
|
|
|
|
setOpenEnd(false);
|
|
|
|
|
};
|
|
|
|
|
const handleOpenEnd = () => {
|
|
|
|
|
setOpenEnd(true);
|
|
|
|
|
};
|
|
|
|
|
const onAdornmentClickEnd = () => {
|
|
|
|
|
setOpenEnd((old) => !old);
|
|
|
|
|
if (isOpen === true) {
|
|
|
|
|
handleClose();
|
2024-03-19 06:56:21 +00:00
|
|
|
|
}
|
2024-03-20 12:18:09 +00:00
|
|
|
|
};
|
2024-03-19 06:56:21 +00:00
|
|
|
|
|
2024-03-20 12:18:09 +00:00
|
|
|
|
const now = moment();
|
|
|
|
|
return (
|
|
|
|
|
<>
|
2024-03-21 14:24:56 +00:00
|
|
|
|
<HeaderFull isRequest />
|
|
|
|
|
<SectionWrapper component={"section"} sx={{ padding: "60px 20px" }}>
|
2024-03-20 12:18:09 +00:00
|
|
|
|
<Typography variant={"h4"}>Аналитика</Typography>
|
|
|
|
|
<Box
|
|
|
|
|
sx={{
|
|
|
|
|
display: "flex",
|
|
|
|
|
gap: isMobile ? "15px" : "20px",
|
|
|
|
|
alignItems: "end",
|
|
|
|
|
justifyContent: "space-between",
|
|
|
|
|
padding: "40px 0 20px",
|
|
|
|
|
borderBottom: `1px solid ${theme.palette.grey2.main}`,
|
|
|
|
|
}}
|
|
|
|
|
>
|
|
|
|
|
<Box sx={{ display: "flex", gap: isMobile ? "15px" : "20px" }}>
|
|
|
|
|
<Box>
|
|
|
|
|
<Typography
|
|
|
|
|
sx={{
|
|
|
|
|
fontSize: "16px",
|
|
|
|
|
marginBottom: "5px",
|
|
|
|
|
fontWeight: 500,
|
|
|
|
|
color: "4D4D4D",
|
|
|
|
|
}}
|
|
|
|
|
>
|
|
|
|
|
Дата начала
|
|
|
|
|
</Typography>
|
|
|
|
|
<DatePicker
|
|
|
|
|
open={isOpen}
|
|
|
|
|
onClose={handleClose}
|
|
|
|
|
onOpen={handleOpen}
|
|
|
|
|
// defaultValue={now}
|
|
|
|
|
sx={{
|
|
|
|
|
width: isMobile ? "146px" : "169px",
|
2024-03-19 06:56:21 +00:00
|
|
|
|
|
2024-03-20 12:18:09 +00:00
|
|
|
|
"& .MuiOutlinedInput-root": {
|
|
|
|
|
borderRadius: "10px",
|
|
|
|
|
fontSize: "16px",
|
|
|
|
|
},
|
|
|
|
|
"& .MuiInputBase-input": {
|
|
|
|
|
padding: "12.5px 14px",
|
|
|
|
|
},
|
|
|
|
|
}}
|
|
|
|
|
slotProps={{
|
|
|
|
|
textField: {
|
|
|
|
|
InputProps: {
|
|
|
|
|
endAdornment: (
|
|
|
|
|
<IconButton onClick={onAdornmentClick}>
|
|
|
|
|
<CalendarIcon />
|
|
|
|
|
</IconButton>
|
|
|
|
|
),
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
}}
|
|
|
|
|
/>
|
|
|
|
|
</Box>
|
|
|
|
|
<Box>
|
|
|
|
|
<Typography
|
|
|
|
|
sx={{
|
|
|
|
|
fontSize: "16px",
|
|
|
|
|
marginBottom: "5px",
|
|
|
|
|
fontWeight: 500,
|
|
|
|
|
color: "4D4D4D",
|
|
|
|
|
}}
|
|
|
|
|
>
|
|
|
|
|
Дата окончания
|
|
|
|
|
</Typography>
|
|
|
|
|
<DatePicker
|
|
|
|
|
open={isOpenEnd}
|
|
|
|
|
onClose={handleCloseEnd}
|
|
|
|
|
onOpen={handleOpenEnd}
|
|
|
|
|
// defaultValue={now}
|
|
|
|
|
sx={{
|
|
|
|
|
width: isMobile ? "146px" : "169px",
|
|
|
|
|
"& .MuiOutlinedInput-root": {
|
|
|
|
|
borderRadius: "10px",
|
|
|
|
|
fontSize: "16px",
|
|
|
|
|
},
|
|
|
|
|
"& .MuiInputBase-input": {
|
|
|
|
|
padding: "12.5px 14px",
|
|
|
|
|
},
|
|
|
|
|
}}
|
|
|
|
|
slotProps={{
|
|
|
|
|
textField: {
|
|
|
|
|
InputProps: {
|
|
|
|
|
endAdornment: (
|
|
|
|
|
<IconButton onClick={onAdornmentClickEnd}>
|
|
|
|
|
<CalendarIcon />
|
|
|
|
|
</IconButton>
|
|
|
|
|
),
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
}}
|
|
|
|
|
/>
|
|
|
|
|
</Box>
|
|
|
|
|
</Box>
|
2024-03-19 06:56:21 +00:00
|
|
|
|
|
2024-03-20 12:18:09 +00:00
|
|
|
|
<Button
|
|
|
|
|
variant="outlined"
|
|
|
|
|
sx={{
|
|
|
|
|
minWidth: isMobile ? "144px" : "180px",
|
|
|
|
|
px: isMobile ? "31px" : "43px",
|
|
|
|
|
color: theme.palette.brightPurple.main,
|
|
|
|
|
"&:hover": {
|
|
|
|
|
backgroundColor: "#581CA7",
|
|
|
|
|
color: "#FFFFFF",
|
|
|
|
|
},
|
|
|
|
|
"&:active": {
|
|
|
|
|
backgroundColor: "#000000",
|
|
|
|
|
color: "#FFFFFF",
|
|
|
|
|
},
|
|
|
|
|
}}
|
|
|
|
|
>
|
|
|
|
|
Сбросить
|
|
|
|
|
</Button>
|
|
|
|
|
</Box>
|
2024-03-21 14:24:56 +00:00
|
|
|
|
<General />
|
2024-03-25 15:02:24 +00:00
|
|
|
|
<AnswersStatistics />
|
2024-03-21 14:24:56 +00:00
|
|
|
|
<Devices />
|
2024-03-20 12:18:09 +00:00
|
|
|
|
</SectionWrapper>
|
|
|
|
|
</>
|
|
|
|
|
);
|
|
|
|
|
}
|