adminFront/src/pages/dashboard/ModalUser/index.tsx

184 lines
5.6 KiB
TypeScript
Raw Normal View History

2022-09-12 13:28:56 +00:00
import * as React from "react";
2022-09-17 19:38:19 +00:00
import { useLinkClickHandler } from "react-router-dom";
2022-09-14 10:24:02 +00:00
import { Box, Modal, Fade, Backdrop, Typography } from "@mui/material";
2022-09-21 13:47:45 +00:00
import Tabs from "@mui/material/Tabs";
import Tab from "@mui/material/Tab";
2022-09-22 12:09:10 +00:00
import { DataGrid, GridColDef } from '@mui/x-data-grid';
2022-09-20 14:35:49 +00:00
import theme from "../../../theme";
2022-09-12 13:28:56 +00:00
2022-09-22 12:09:10 +00:00
2022-09-17 19:38:19 +00:00
export interface MWProps {
open: boolean
}
2022-09-12 13:28:56 +00:00
2022-09-22 12:09:10 +00:00
const columns: GridColDef[] = [
{
field: 'id',
headerName: 'ID',
width: 30,
sortable: false,
},
{
field: 'dateTime',
headerName: 'Дата / время',
width: 150,
sortable: false,
},
{
field: 'email',
headerName: 'Почта',
width: 110,
sortable: false,
},{
field: 'summa',
headerName: 'Сумма',
type: 'number',
width: 110,
sortable: false,
},
{
field: 'idLong',
headerName: 'ID long',
type: 'number',
width: 110,
sortable: false,
},
{
field: 'paymentStatus',
headerName: 'Статус платежа',
width: 160,
sortable: false,
},
];
const rows = [
{ id: 1, dateTime: '22.09.22 12:15', email: 'asd@mail.ru', summa: 100500, idLong: 123, paymentStatus: "В обработке" },
{ id: 1, dateTime: '22.09.22 12:15', email: 'asd@mail.ru', summa: 100500, idLong: 123, paymentStatus: "В обработке" },
{ id: 1, dateTime: '22.09.22 12:15', email: 'asd@mail.ru', summa: 100500, idLong: 123, paymentStatus: "В обработке" },
{ id: 1, dateTime: '22.09.22 12:15', email: 'asd@mail.ru', summa: 100500, idLong: 123, paymentStatus: "В обработке" },
{ id: 1, dateTime: '22.09.22 12:15', email: 'asd@mail.ru', summa: 100500, idLong: 123, paymentStatus: "В обработке" },
];
const ModalUser = ({open}: MWProps ) => {
2022-09-21 13:47:45 +00:00
const [value, setValue] = React.useState(0);
const handleChange = (event: React.SyntheticEvent, newValue: number) => {
setValue(newValue);
};
2022-09-12 13:28:56 +00:00
return (
<React.Fragment>
2022-09-14 10:24:02 +00:00
<Modal
aria-labelledby="transition-modal-title"
aria-describedby="transition-modal-description"
open={ open }
2022-09-17 19:38:19 +00:00
onClose={ useLinkClickHandler('/users') }
2022-09-14 10:24:02 +00:00
closeAfterTransition
BackdropComponent={Backdrop}
BackdropProps={{
timeout: 500,
}}
>
<Fade in={open}>
2022-09-12 13:28:56 +00:00
<Box sx={{
2022-09-14 10:24:02 +00:00
position: "absolute" as "absolute",
top: "50%",
left: "50%",
transform: "translate(-50%, -50%)",
2022-10-01 14:06:54 +00:00
width: "980px",
height: "480px",
2022-09-14 10:24:02 +00:00
bgcolor: theme.palette.menu.main,
boxShadow: 24,
color: theme.palette.secondary.main,
display: "flex",
flexDirection: "column",
alignItems: "center",
2022-09-12 13:28:56 +00:00
}}>
2022-09-14 10:24:02 +00:00
<Typography id="transition-modal-title" variant="caption">
Пользователь сервиса
2022-09-14 10:24:02 +00:00
</Typography>
2022-09-12 13:28:56 +00:00
<Box sx={{
2022-09-14 10:24:02 +00:00
width: "100%",
2022-09-21 13:47:45 +00:00
marginTop: "50px",
2022-09-14 10:24:02 +00:00
display: "flex"
2022-09-12 13:28:56 +00:00
}}>
2022-09-21 13:47:45 +00:00
<Tabs
orientation="vertical"
variant="scrollable"
value={value}
onChange={handleChange}
aria-label="Vertical tabs example"
sx={{
borderRight: 1,
borderColor: theme.palette.secondary.main,
"& .MuiTab-root.Mui-selected": {
color: theme.palette.secondary.main
}
}}
TabIndicatorProps={{style: {
background: theme.palette.secondary.main
}}}
>
<Tab sx={{
2022-09-14 10:24:02 +00:00
color: theme.palette.grayDisabled.main,
2022-09-21 13:47:45 +00:00
width: "180px",
fontSize: "15px"
}}
label="Пользовательская информация" />
<Tab sx={{
2022-09-14 10:24:02 +00:00
color: theme.palette.grayDisabled.main,
2022-09-21 13:47:45 +00:00
width: "180px",
fontSize: "15px"
}}
label="История транзакций" />
</Tabs>
{ value == 0 && (
<Box sx={{ marginLeft: "20px" }}>
<Typography>Id: 1</Typography>
<Typography>Email: 2</Typography>
<Typography>Номер телефона: 3</Typography>
</Box>
) }
{ value == 1 && (
<Box sx={{ marginLeft: "20px" }}>
2022-09-22 12:09:10 +00:00
<DataGrid
rows={rows}
columns={columns}
pageSize={5}
rowsPerPageOptions={[5]}
disableSelectionOnClick
experimentalFeatures={{ newEditingApi: true }}
sx={{
color: theme.palette.secondary.main,
2022-10-01 14:06:54 +00:00
width: "720px",
height: "350px",
overflowY: "auto",
2022-09-22 12:09:10 +00:00
"& .MuiDataGrid-iconSeparator": {
display: "none"
},
"& .css-levciy-MuiTablePagination-displayedRows": {
color: theme.palette.secondary.main
2022-09-24 15:37:24 +00:00
},
"& .MuiSvgIcon-root": {
color: theme.palette.secondary.main
2022-09-22 12:09:10 +00:00
}
}}
/>
2022-09-21 13:47:45 +00:00
</Box>
) }
2022-09-12 13:28:56 +00:00
</Box>
</Box>
2022-09-14 10:24:02 +00:00
</Fade>
</Modal>
2022-09-12 13:28:56 +00:00
</React.Fragment>
);
}
2022-09-13 16:16:57 +00:00
export default ModalUser;