diff --git a/src/pages/dashboard/Content/QuizStatistic/StatisticSchild.tsx b/src/pages/dashboard/Content/QuizStatistic/StatisticSchild.tsx new file mode 100644 index 0000000..8bd15c1 --- /dev/null +++ b/src/pages/dashboard/Content/QuizStatistic/StatisticSchild.tsx @@ -0,0 +1,192 @@ +import {useState} from "react"; +import moment, {Moment} from "moment"; +import { + Box, + Button, + Table, + TableBody, + TableCell, + TableHead, + TableRow, + TextField, + Typography, + useTheme +} from "@mui/material"; +import makeRequest from "@root/api/makeRequest"; +import {parseAxiosError} from "@root/utils/parse-error"; +import {AdapterMoment} from "@mui/x-date-pickers/AdapterMoment"; +import { DatePicker, LocalizationProvider } from '@mui/x-date-pickers'; + +export default function StatisticSchild() { + const theme = useTheme() + const [isOpen, setOpen] = useState(false); + const [isOpenEnd, setOpenEnd] = useState(false); + + const [from, setFrom] = useState(null); + const [to, setTo] = useState(moment(Date.now())); + + const [statistic, setStatistic] = useState([]) + const handleClose = () => { + setOpen(false); + }; + + const handleOpen = () => { + setOpen(true); + }; + + const onAdornmentClick = () => { + setOpen((old) => !old); + if (isOpenEnd) { + handleCloseEnd(); + } + }; + + const handleCloseEnd = () => { + setOpenEnd(false); + }; + + const handleOpenEnd = () => { + setOpenEnd(true); + }; + + const onAdornmentClickEnd = () => { + setOpenEnd((old) => !old); + if (isOpen) { + handleClose(); + } + }; + + const StatisticsShild = async (from: any, to: any) => { + try { + const StatisticResponse = await makeRequest({ + url: process.env.REACT_APP_DOMAIN + "/customer/quizlogo/stat" , + method: "post", + useToken: true, + body: { + "to": to.unix(), + "from": from.unix(), + "page": 0, + "limit": 100 + }, + }); + setStatistic(StatisticResponse) + return [StatisticResponse]; + } catch (nativeError) { + const [error] = parseAxiosError(nativeError); + + return [null, `Ошибка запроса статистики. ${error}`]; + } + } + console.log(statistic) + + return( + + Статистика переходов с шильдика + + + Дата начала + + date && setFrom(date)} + renderInput={(params) => ( + + )} + InputProps={{ + sx: { + height: "40px", + color: theme.palette.secondary.main, + border: "1px solid", + borderColor: theme.palette.secondary.main, + "& .MuiSvgIcon-root": { + color: theme.palette.secondary.main, + }, + }, + }} + /> + + + + Дата окончания + + date && setTo(date)} + renderInput={(params) => ( + + )} + InputProps={{ + sx: { + height: "40px", + color: theme.palette.secondary.main, + border: "1px solid", + borderColor: theme.palette.secondary.main, + "& .MuiSvgIcon-root": { + color: theme.palette.secondary.main, + }, + }, + }} + /> + + + + + + ID + Регистраций + Money + + + + {statistic[0].ID} + {statistic[0].Regs} + {statistic[0].Money} + +
+
+ ) + +} diff --git a/src/pages/dashboard/Content/QuizStatistic/index.tsx b/src/pages/dashboard/Content/QuizStatistic/index.tsx index 9e93461..57d9b25 100644 --- a/src/pages/dashboard/Content/QuizStatistic/index.tsx +++ b/src/pages/dashboard/Content/QuizStatistic/index.tsx @@ -8,6 +8,7 @@ import { AdapterMoment } from '@mui/x-date-pickers/AdapterMoment' import makeRequest from "@root/api/makeRequest"; import {Discount} from "@frontend/kitui"; import {parseAxiosError} from "@root/utils/parse-error"; +import StatisticSchild from "./StatisticSchild"; export default () => { const theme = useTheme() @@ -19,6 +20,7 @@ export default () => { const [to, setTo] = useState(moment(Date.now())); + const { Registrations, Quizes, Results } = useQuizStatistic({ from, to, @@ -59,28 +61,28 @@ export default () => { } }; - const StatisticsShild = async (from: any, to: any) => { - try { - const StatisticResponse = await makeRequest({ - url: process.env.REACT_APP_DOMAIN + "/customer/quizlogo/stat" , - method: "post", - useToken: true, - body: { - "to": to.unix(), - "from": from.unix(), - "page": 0, - "limit": 100 - }, - }); - - return [StatisticResponse]; - } catch (nativeError) { - const [error] = parseAxiosError(nativeError); - - return [null, `Ошибка запроса статистики. ${error}`]; - } - } - + // const StatisticsShild = async (from: any, to: any) => { + // try { + // const StatisticResponse = await makeRequest({ + // url: process.env.REACT_APP_DOMAIN + "/customer/quizlogo/stat" , + // method: "post", + // useToken: true, + // body: { + // "to": to.unix(), + // "from": from.unix(), + // "page": 0, + // "limit": 100 + // }, + // }); + // + // return [StatisticResponse]; + // } catch (nativeError) { + // const [error] = parseAxiosError(nativeError); + // + // return [null, `Ошибка запроса статистики. ${error}`]; + // } + // } + // return <> @@ -160,14 +162,14 @@ export default () => { > Сбросить даты - + {/*StatisticsShild(from, to)}*/} + {/*>*/} + {/* Запросить статистику(тест)*/} + {/**/} { {Results}
+ + +
} \ No newline at end of file diff --git a/src/pages/dashboard/Content/Support/TicketList/CloseTicketModal.tsx b/src/pages/dashboard/Content/Support/TicketList/CloseTicketModal.tsx index 450d49c..1c12a27 100644 --- a/src/pages/dashboard/Content/Support/TicketList/CloseTicketModal.tsx +++ b/src/pages/dashboard/Content/Support/TicketList/CloseTicketModal.tsx @@ -66,7 +66,10 @@ export default function CloseTicketModal({ticketId, openModal, setOpenModal}: Pr }} >