diff --git a/src/pages/History/AccordionWrapper.tsx b/src/pages/History/AccordionWrapper.tsx index 7ae7918..eef4f41 100644 --- a/src/pages/History/AccordionWrapper.tsx +++ b/src/pages/History/AccordionWrapper.tsx @@ -4,7 +4,8 @@ import File from "@components/icons/File" import { getDeclension } from "@utils/declension" import { enqueueSnackbar } from "notistack" import { addTariffToCart } from "@root/stores/user" -import { getMessageFromFetchError } from "@frontend/kitui" +import {getMessageFromFetchError, makeRequest} from "@frontend/kitui" +import EmailIcon from "@mui/icons-material/Email" export type History = { title: string; @@ -21,10 +22,11 @@ interface AccordionWrapperProps { content: [RawDetails, KeyValue]; last?: boolean; first?: boolean; - createdAt: string + createdAt: string; + onClickMail?: any } -export default function AccordionWrapper({ content, last, first, createdAt }: AccordionWrapperProps) { +export default function AccordionWrapper({ content, last, first, createdAt, onClickMail }: AccordionWrapperProps) { const theme = useTheme() const upMd = useMediaQuery(theme.breakpoints.up("md")) const upSm = useMediaQuery(theme.breakpoints.up("sm")) @@ -181,56 +183,68 @@ export default function AccordionWrapper({ content, last, first, createdAt }: Ac {!isMobile && - { - e.stopPropagation() - handleTariffItemClick(valuesByKey.id) - }} - sx={{ - ml: "20px", - bgcolor:"#EEE4FC", - stroke: "#7E2AEA", - borderRadius: 2, - "&:hover": { - bgcolor:"#7E2AEA", - stroke: "white", - }, - "&:active": { - bgcolor:"black", - stroke: "white", - } - }} - > - - + <> + + + + { + e.stopPropagation() + handleTariffItemClick(valuesByKey.id) + }} + sx={{ + ml: "20px", + bgcolor:"#EEE4FC", + stroke: "#7E2AEA", + borderRadius: 2, + "&:hover": { + bgcolor:"#7E2AEA", + stroke: "white", + }, + "&:active": { + bgcolor:"black", + stroke: "white", + } + }} + > + + + + } {isMobile && - { - e.stopPropagation() - handleTariffItemClick(valuesByKey.id) - }} - sx={{ - mr: "10px", - bgcolor:"#EEE4FC", - stroke: "#7E2AEA", - borderRadius: 2, - "&:hover": { - bgcolor:"#7E2AEA", - stroke: "white", - }, - "&:active": { - bgcolor:"black", - stroke: "white", - } - }} - > - - + <> + + + + { + e.stopPropagation() + handleTariffItemClick(valuesByKey.id) + }} + sx={{ + mr: "10px", + bgcolor:"#EEE4FC", + stroke: "#7E2AEA", + borderRadius: 2, + "&:hover": { + bgcolor:"#7E2AEA", + stroke: "white", + }, + "&:active": { + bgcolor:"black", + stroke: "white", + } + }} + > + + + + } } diff --git a/src/pages/History/index.tsx b/src/pages/History/index.tsx index 5f1107a..48e0b58 100644 --- a/src/pages/History/index.tsx +++ b/src/pages/History/index.tsx @@ -14,6 +14,9 @@ import { isArray } from "cypress/types/lodash" import { ErrorBoundary } from "react-error-boundary" import { handleComponentError } from "@root/utils/handleComponentError" import { useHistoryStore } from "@root/stores/history"; +import EmailIcon from '@mui/icons-material/Email'; +import {enqueueSnackbar} from "notistack" +import { makeRequest } from "@frontend/kitui" const subPages = ["Платежи", "Покупки тарифов", "Окончания тарифов"] @@ -33,6 +36,20 @@ export default function History() { return dateMatch ? dateMatch[0] : "" } + async function handleHistoryResponse(tariffId: string) { + try { + await makeRequest ( + { + url: `https://hub.pena.digital/customer/sendReport/${tariffId}`, + method: "POST", + } + ) + enqueueSnackbar("Запрос отправлен") + } catch (e) { + enqueueSnackbar("извините, произошла ошибка") + } + } + return ( { + event.stopPropagation() + handleHistoryResponse(e.id) + }} /> )})}