Merge branch 'dev' into 'staging'
Dev See merge request frontend/admin!75
This commit is contained in:
commit
3ad5f8a02d
@ -5,6 +5,9 @@ import type { Moment } from "moment";
|
|||||||
import { DatePicker, LocalizationProvider } from '@mui/x-date-pickers';
|
import { DatePicker, LocalizationProvider } from '@mui/x-date-pickers';
|
||||||
import { useQuizStatistic } from '@root/utils/hooks/useQuizStatistic';
|
import { useQuizStatistic } from '@root/utils/hooks/useQuizStatistic';
|
||||||
import { AdapterMoment } from '@mui/x-date-pickers/AdapterMoment'
|
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";
|
||||||
|
|
||||||
export default () => {
|
export default () => {
|
||||||
const theme = useTheme()
|
const theme = useTheme()
|
||||||
@ -56,6 +59,28 @@ export default () => {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const StatisticsShild = async (from: any, to: any) => {
|
||||||
|
try {
|
||||||
|
const StatisticResponse = await makeRequest<unknown, unknown>({
|
||||||
|
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 <>
|
return <>
|
||||||
<LocalizationProvider dateAdapter={AdapterMoment}>
|
<LocalizationProvider dateAdapter={AdapterMoment}>
|
||||||
@ -135,6 +160,14 @@ export default () => {
|
|||||||
>
|
>
|
||||||
Сбросить даты
|
Сбросить даты
|
||||||
</Button>
|
</Button>
|
||||||
|
<Button
|
||||||
|
sx={{
|
||||||
|
m: '10px 0'
|
||||||
|
}}
|
||||||
|
onClick={async() =>StatisticsShild(from, to)}
|
||||||
|
>
|
||||||
|
Запросить статистику(тест)
|
||||||
|
</Button>
|
||||||
|
|
||||||
<Table
|
<Table
|
||||||
sx={{
|
sx={{
|
||||||
|
@ -0,0 +1,84 @@
|
|||||||
|
import Modal from "@mui/material/Modal";
|
||||||
|
import {closeDeleteTariffDialog} from "@stores/tariffs";
|
||||||
|
import Box from "@mui/material/Box";
|
||||||
|
import Typography from "@mui/material/Typography";
|
||||||
|
import Button from "@mui/material/Button";
|
||||||
|
import makeRequest from "@root/api/makeRequest";
|
||||||
|
import {parseAxiosError} from "@root/utils/parse-error";
|
||||||
|
interface Props{
|
||||||
|
ticketId: string | undefined,
|
||||||
|
openModal: boolean,
|
||||||
|
setOpenModal: (a: boolean) => void
|
||||||
|
}
|
||||||
|
|
||||||
|
export default function CloseTicketModal({ticketId, openModal, setOpenModal}: Props) {
|
||||||
|
|
||||||
|
const CloseTicket = async () => {
|
||||||
|
try {
|
||||||
|
const ticketCloseResponse = await makeRequest<unknown, unknown>({
|
||||||
|
url: process.env.REACT_APP_DOMAIN + "/heruvym/close" ,
|
||||||
|
method: "post",
|
||||||
|
useToken: true,
|
||||||
|
body: {
|
||||||
|
"ticket": ticketId
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
return [ticketCloseResponse];
|
||||||
|
} catch (nativeError) {
|
||||||
|
const [error] = parseAxiosError(nativeError);
|
||||||
|
|
||||||
|
return [null, `Не удалось закрыть тикет. ${error}`];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return (
|
||||||
|
<Modal
|
||||||
|
open={openModal}
|
||||||
|
onClose={() => setOpenModal(false)}
|
||||||
|
aria-labelledby="modal-modal-title"
|
||||||
|
aria-describedby="modal-modal-description"
|
||||||
|
>
|
||||||
|
<Box
|
||||||
|
sx={{
|
||||||
|
position: "absolute",
|
||||||
|
top: "50%",
|
||||||
|
left: "50%",
|
||||||
|
transform: "translate(-50%, -50%)",
|
||||||
|
width: 400,
|
||||||
|
bgcolor: "background.paper",
|
||||||
|
border: "2px solid gray",
|
||||||
|
borderRadius: "6px",
|
||||||
|
boxShadow: 24,
|
||||||
|
p: 4,
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<Typography id="modal-modal-title" variant="h6" component="h2">
|
||||||
|
Вы уверены, что хотите закрыть тикет?
|
||||||
|
</Typography>
|
||||||
|
<Box
|
||||||
|
sx={{
|
||||||
|
mt: "20px",
|
||||||
|
display: "flex",
|
||||||
|
width: "332px",
|
||||||
|
justifyContent: "space-between",
|
||||||
|
alignItems: "center",
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<Button
|
||||||
|
onClick={CloseTicket}
|
||||||
|
sx={{width: "40px", height: "25px"}}
|
||||||
|
>
|
||||||
|
Да
|
||||||
|
</Button>
|
||||||
|
<Button
|
||||||
|
onClick={() => setOpenModal(false)}
|
||||||
|
sx={{width: "40px", height: "25px"}}
|
||||||
|
>
|
||||||
|
Нет
|
||||||
|
</Button>
|
||||||
|
</Box>
|
||||||
|
</Box>
|
||||||
|
</Modal>
|
||||||
|
)
|
||||||
|
}
|
@ -3,9 +3,13 @@ import SearchOutlinedIcon from "@mui/icons-material/SearchOutlined";
|
|||||||
import { Box, Button, useMediaQuery, useTheme } from "@mui/material";
|
import { Box, Button, useMediaQuery, useTheme } from "@mui/material";
|
||||||
import { Ticket } from "@root/model/ticket";
|
import { Ticket } from "@root/model/ticket";
|
||||||
import { incrementTicketsApiPage, useTicketStore } from "@root/stores/tickets";
|
import { incrementTicketsApiPage, useTicketStore } from "@root/stores/tickets";
|
||||||
import { useEffect, useRef } from "react";
|
import {useEffect, useRef, useState} from "react";
|
||||||
import TicketItem from "./TicketItem";
|
import TicketItem from "./TicketItem";
|
||||||
import { throttle } from "@frontend/kitui";
|
import { throttle } from "@frontend/kitui";
|
||||||
|
import makeRequest from "@root/api/makeRequest";
|
||||||
|
import {parseAxiosError} from "@root/utils/parse-error";
|
||||||
|
import {useParams} from "react-router-dom";
|
||||||
|
import CloseTicketModal from "@pages/dashboard/Content/Support/TicketList/CloseTicketModal";
|
||||||
|
|
||||||
type TicketListProps = {
|
type TicketListProps = {
|
||||||
closeCollapse?: () => void;
|
closeCollapse?: () => void;
|
||||||
@ -21,6 +25,8 @@ export default function TicketList({
|
|||||||
const tickets = useTicketStore((state) => state.tickets);
|
const tickets = useTicketStore((state) => state.tickets);
|
||||||
const ticketsFetchState = useTicketStore((state) => state.ticketsFetchState);
|
const ticketsFetchState = useTicketStore((state) => state.ticketsFetchState);
|
||||||
const ticketsBoxRef = useRef<HTMLDivElement>(null);
|
const ticketsBoxRef = useRef<HTMLDivElement>(null);
|
||||||
|
const ticketId = useParams().ticketId;
|
||||||
|
const [openModal, setOpenModal] = useState(false)
|
||||||
|
|
||||||
useEffect(
|
useEffect(
|
||||||
function updateCurrentPageOnScroll() {
|
function updateCurrentPageOnScroll() {
|
||||||
@ -91,6 +97,7 @@ export default function TicketList({
|
|||||||
<SearchOutlinedIcon />
|
<SearchOutlinedIcon />
|
||||||
</Button>
|
</Button>
|
||||||
<Button
|
<Button
|
||||||
|
onClick={()=> setOpenModal(true)}
|
||||||
variant="text"
|
variant="text"
|
||||||
sx={{
|
sx={{
|
||||||
width: "100%",
|
width: "100%",
|
||||||
@ -109,6 +116,7 @@ export default function TicketList({
|
|||||||
ЗАКРЫТЬ ТИКЕТ
|
ЗАКРЫТЬ ТИКЕТ
|
||||||
<HighlightOffOutlinedIcon />
|
<HighlightOffOutlinedIcon />
|
||||||
</Button>
|
</Button>
|
||||||
|
<CloseTicketModal openModal={openModal} setOpenModal={setOpenModal} ticketId={ticketId}/>
|
||||||
</Box>
|
</Box>
|
||||||
<Box
|
<Box
|
||||||
ref={ticketsBoxRef}
|
ref={ticketsBoxRef}
|
||||||
|
Loading…
Reference in New Issue
Block a user