2022-09-08 17:21:17 +00:00
|
|
|
|
import * as React from "react";
|
2022-09-14 10:24:02 +00:00
|
|
|
|
import { useNavigate } from "react-router-dom";
|
2022-09-09 13:54:49 +00:00
|
|
|
|
import { Box, Typography, TextField, Button } from "@mui/material";
|
2022-09-26 12:35:56 +00:00
|
|
|
|
import Table from "@mui/material/Table";
|
|
|
|
|
import TableHead from "@mui/material/TableHead";
|
|
|
|
|
import TableBody from "@mui/material/TableBody";
|
|
|
|
|
import TableCell from "@mui/material/TableCell";
|
|
|
|
|
import TableRow from "@mui/material/TableRow";
|
|
|
|
|
import Radio from "@mui/material/Radio";
|
|
|
|
|
import Skeleton from "@mui/material/Skeleton";
|
2022-09-27 20:42:56 +00:00
|
|
|
|
import Accordion from '@mui/material/Accordion';
|
|
|
|
|
import AccordionSummary from '@mui/material/AccordionSummary';
|
|
|
|
|
import AccordionDetails from '@mui/material/AccordionDetails';
|
|
|
|
|
import ExpandMoreIcon from '@mui/icons-material/ExpandMore';
|
|
|
|
|
import ClearIcon from '@mui/icons-material/Clear';
|
2023-03-06 13:25:06 +00:00
|
|
|
|
import { getRoles_mock, TMockData } from "../../../api/roles";
|
|
|
|
|
import theme from "../../../theme"
|
2022-09-08 17:21:17 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const Users: React.FC = () => {
|
2022-09-26 12:35:56 +00:00
|
|
|
|
const radioboxes = [ "a", "b", "c" ];
|
|
|
|
|
|
|
|
|
|
const [selectedValue, setSelectedValue] = React.useState("a");
|
2022-09-09 13:54:49 +00:00
|
|
|
|
const handleChange = (event: React.ChangeEvent<HTMLInputElement>) => {
|
|
|
|
|
setSelectedValue(event.target.value);
|
|
|
|
|
};
|
|
|
|
|
|
2022-09-14 10:24:02 +00:00
|
|
|
|
const navigate = useNavigate();
|
|
|
|
|
|
2022-09-24 15:37:24 +00:00
|
|
|
|
const [data, setData] = React.useState<TMockData>([]);
|
|
|
|
|
const handleChangeData = () => {
|
2022-09-26 12:35:56 +00:00
|
|
|
|
getRoles_mock().then((mockdata) => {
|
|
|
|
|
setData( mockdata );
|
2022-09-24 15:37:24 +00:00
|
|
|
|
})
|
|
|
|
|
};
|
|
|
|
|
|
2022-09-27 20:42:56 +00:00
|
|
|
|
const [accordionHeader, setAccordionHeader] = React.useState<string>("none");
|
|
|
|
|
const [accordionState, setAccordionState] = React.useState<boolean>(true);
|
|
|
|
|
const [accordionText, setAccordionText] = React.useState<string>("");
|
|
|
|
|
const handleChangeAccordion = (text:string) => {
|
|
|
|
|
if( text == "" ) {
|
|
|
|
|
setAccordionState( true );
|
|
|
|
|
setAccordionHeader("none");
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
handleToggleAccordion();
|
|
|
|
|
setAccordionHeader("flex")
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
accordionState
|
|
|
|
|
? setAccordionText( text )
|
|
|
|
|
: setAccordionText( "" )
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const handleToggleAccordion = () => {
|
|
|
|
|
setAccordionState( !accordionState );
|
|
|
|
|
}
|
|
|
|
|
|
2022-09-26 12:35:56 +00:00
|
|
|
|
handleChangeData();
|
|
|
|
|
|
2022-09-08 17:21:17 +00:00
|
|
|
|
return (
|
|
|
|
|
<React.Fragment>
|
2022-09-13 16:16:57 +00:00
|
|
|
|
<Button
|
|
|
|
|
variant="text"
|
2022-09-19 16:17:03 +00:00
|
|
|
|
onClick={ () => navigate("/modalAdmin") }
|
2022-09-13 16:16:57 +00:00
|
|
|
|
sx={{
|
2022-12-19 20:15:00 +00:00
|
|
|
|
width: "84%",
|
2022-09-13 16:16:57 +00:00
|
|
|
|
display: "flex",
|
|
|
|
|
flexDirection: "column",
|
|
|
|
|
justifyContent: "center",
|
|
|
|
|
alignItems: "center",
|
2022-09-27 20:42:56 +00:00
|
|
|
|
marginBottom: "35px",
|
2022-09-13 16:16:57 +00:00
|
|
|
|
border: "2px solid",
|
|
|
|
|
fontWeight: "normal",
|
|
|
|
|
borderColor: theme.palette.golden.main,
|
2022-09-14 10:24:02 +00:00
|
|
|
|
color: theme.palette.secondary.main,
|
|
|
|
|
"&:hover": {
|
|
|
|
|
backgroundColor: theme.palette.menu.main
|
|
|
|
|
}
|
|
|
|
|
}}>
|
2022-09-13 16:16:57 +00:00
|
|
|
|
ИНФОРМАЦИЯ О ПРОЕКТЕ
|
|
|
|
|
</Button>
|
2022-09-08 17:21:17 +00:00
|
|
|
|
|
2022-09-27 20:42:56 +00:00
|
|
|
|
|
|
|
|
|
<Accordion sx={{
|
2022-12-19 20:15:00 +00:00
|
|
|
|
width: "84%",
|
2022-09-27 20:42:56 +00:00
|
|
|
|
backgroundColor: theme.palette.content.main
|
|
|
|
|
}} expanded={ accordionState }>
|
|
|
|
|
<AccordionSummary
|
|
|
|
|
sx = {{ display: accordionHeader }}
|
|
|
|
|
expandIcon={
|
|
|
|
|
<ExpandMoreIcon sx={{
|
|
|
|
|
color: theme.palette.secondary.main
|
|
|
|
|
}}
|
|
|
|
|
onClick={ () => handleToggleAccordion() }
|
|
|
|
|
/>
|
|
|
|
|
}
|
|
|
|
|
aria-controls="panel1a-content"
|
|
|
|
|
id="panel1a-header"
|
|
|
|
|
>
|
|
|
|
|
<Typography sx={{
|
|
|
|
|
width: "100%",
|
|
|
|
|
color: theme.palette.secondary.main
|
|
|
|
|
}}>
|
|
|
|
|
{ accordionText }
|
|
|
|
|
</Typography>
|
|
|
|
|
|
|
|
|
|
<Box sx={{
|
|
|
|
|
display: "flex",
|
|
|
|
|
alignItems: "right"
|
|
|
|
|
}}>
|
|
|
|
|
<ClearIcon
|
|
|
|
|
sx={{ color: theme.palette.secondary.main }}
|
|
|
|
|
onClick={ () => handleChangeAccordion("") }
|
|
|
|
|
/>
|
|
|
|
|
</Box>
|
|
|
|
|
</AccordionSummary>
|
|
|
|
|
<AccordionDetails>
|
|
|
|
|
|
|
|
|
|
<Table sx={{
|
|
|
|
|
width: "100%",
|
|
|
|
|
border: "2px solid",
|
|
|
|
|
borderColor: theme.palette.secondary.main,
|
|
|
|
|
}} aria-label="simple table">
|
|
|
|
|
<TableHead>
|
|
|
|
|
<TableRow sx={{
|
|
|
|
|
borderBottom: "2px solid",
|
|
|
|
|
borderColor: theme.palette.grayLight.main,
|
|
|
|
|
height: "100px"
|
|
|
|
|
}}>
|
|
|
|
|
<TableCell>
|
|
|
|
|
<Typography
|
|
|
|
|
variant="h4"
|
|
|
|
|
sx={{
|
|
|
|
|
color: theme.palette.secondary.main,
|
2022-09-26 12:35:56 +00:00
|
|
|
|
}}>
|
2022-09-27 20:42:56 +00:00
|
|
|
|
Имя
|
|
|
|
|
</Typography>
|
|
|
|
|
</TableCell>
|
|
|
|
|
<TableCell>
|
|
|
|
|
<Typography
|
|
|
|
|
variant="h4"
|
|
|
|
|
sx={{
|
|
|
|
|
color: theme.palette.secondary.main,
|
|
|
|
|
}}>
|
|
|
|
|
Описание
|
|
|
|
|
</Typography>
|
|
|
|
|
</TableCell>
|
|
|
|
|
<TableCell>
|
|
|
|
|
<Typography
|
|
|
|
|
variant="h4"
|
|
|
|
|
sx={{
|
|
|
|
|
color: theme.palette.secondary.main,
|
|
|
|
|
}}>
|
|
|
|
|
Отобразить
|
|
|
|
|
</Typography>
|
|
|
|
|
</TableCell>
|
|
|
|
|
</TableRow>
|
|
|
|
|
</TableHead>
|
2022-09-24 15:37:24 +00:00
|
|
|
|
|
2022-09-27 20:42:56 +00:00
|
|
|
|
<TableBody>
|
2022-09-09 13:54:49 +00:00
|
|
|
|
|
2022-09-27 20:42:56 +00:00
|
|
|
|
{
|
|
|
|
|
data.length
|
|
|
|
|
? (
|
2022-09-26 12:35:56 +00:00
|
|
|
|
data.map(function(item, i) {
|
|
|
|
|
return(
|
|
|
|
|
<TableRow sx={{
|
|
|
|
|
borderTop: "2px solid",
|
|
|
|
|
borderColor: theme.palette.grayLight.main,
|
2022-09-27 20:42:56 +00:00
|
|
|
|
height: "100px",
|
|
|
|
|
cursor: "pointer"
|
|
|
|
|
}}
|
|
|
|
|
key={ item.key }
|
|
|
|
|
onClick={ () => handleChangeAccordion( item.desc ) }>
|
2022-09-26 12:35:56 +00:00
|
|
|
|
<TableCell>
|
|
|
|
|
<Typography sx={{
|
|
|
|
|
color: theme.palette.secondary.main
|
|
|
|
|
}}>
|
|
|
|
|
{ item.name }
|
|
|
|
|
</Typography>
|
|
|
|
|
</TableCell>
|
|
|
|
|
<TableCell>
|
|
|
|
|
<Typography sx={{
|
|
|
|
|
color: theme.palette.secondary.main
|
|
|
|
|
}}>
|
|
|
|
|
{ item.desc }
|
|
|
|
|
</Typography>
|
|
|
|
|
</TableCell>
|
|
|
|
|
<TableCell>
|
|
|
|
|
<Radio
|
|
|
|
|
checked={selectedValue === radioboxes[ i ]}
|
|
|
|
|
onChange={handleChange}
|
|
|
|
|
value={ radioboxes[ i ] }
|
|
|
|
|
sx={{
|
|
|
|
|
"&, &.Mui-checked": {
|
|
|
|
|
color: theme.palette.secondary.main,
|
|
|
|
|
},
|
|
|
|
|
}} />
|
|
|
|
|
</TableCell>
|
|
|
|
|
</TableRow>
|
|
|
|
|
);
|
|
|
|
|
})
|
2022-09-27 20:42:56 +00:00
|
|
|
|
|
|
|
|
|
) : (
|
|
|
|
|
<TableRow sx={{
|
|
|
|
|
borderTop: "2px solid",
|
|
|
|
|
borderColor: theme.palette.grayLight.main,
|
|
|
|
|
height: "100px"
|
|
|
|
|
}}>
|
|
|
|
|
<TableCell colSpan={3}>
|
|
|
|
|
<Skeleton variant="rectangular"
|
|
|
|
|
sx={{
|
|
|
|
|
width: "100%",
|
|
|
|
|
minWidth: "100%",
|
|
|
|
|
minHeight: "200px",
|
|
|
|
|
marginTop: "15px",
|
|
|
|
|
marginBottom: "15px"
|
|
|
|
|
}}
|
|
|
|
|
/>
|
|
|
|
|
</TableCell>
|
|
|
|
|
</TableRow>
|
|
|
|
|
)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
</TableBody>
|
|
|
|
|
</Table>
|
|
|
|
|
|
|
|
|
|
</AccordionDetails>
|
|
|
|
|
</Accordion>
|
|
|
|
|
|
2022-09-09 13:54:49 +00:00
|
|
|
|
|
|
|
|
|
<Box sx={{
|
|
|
|
|
width: "90%",
|
|
|
|
|
marginTop: "35px"
|
|
|
|
|
}}>
|
|
|
|
|
<Box sx={{ display: "flex" }}>
|
|
|
|
|
<TextField
|
|
|
|
|
id = "standard-basic"
|
|
|
|
|
label = "id"
|
|
|
|
|
variant = "filled"
|
|
|
|
|
color = "secondary"
|
|
|
|
|
sx = {{
|
|
|
|
|
width: "80%"
|
|
|
|
|
}}
|
|
|
|
|
InputProps={{
|
|
|
|
|
style: {
|
|
|
|
|
backgroundColor: theme.palette.content.main,
|
|
|
|
|
color: theme.palette.secondary.main,
|
|
|
|
|
borderBottom: "1px solid",
|
2022-09-12 10:32:05 +00:00
|
|
|
|
borderColor: theme.palette.grayLight.main,
|
2022-09-09 13:54:49 +00:00
|
|
|
|
} }}
|
|
|
|
|
InputLabelProps={{
|
|
|
|
|
style: {
|
|
|
|
|
color: theme.palette.secondary.main
|
|
|
|
|
} }}
|
|
|
|
|
/>
|
2022-12-19 20:15:00 +00:00
|
|
|
|
<Box
|
2022-09-09 13:54:49 +00:00
|
|
|
|
sx={{
|
2022-12-19 20:15:00 +00:00
|
|
|
|
display: 'flex',
|
|
|
|
|
justifyContent: 'center',
|
|
|
|
|
maxWidth: '317px',
|
|
|
|
|
width: '100%'
|
|
|
|
|
}}
|
|
|
|
|
>
|
|
|
|
|
<Button
|
|
|
|
|
variant = "text"
|
|
|
|
|
sx={{
|
|
|
|
|
backgroundColor: theme.palette.content.main,
|
|
|
|
|
color: theme.palette.secondary.main,
|
|
|
|
|
// width: "20%",
|
|
|
|
|
"&:hover": {
|
|
|
|
|
backgroundColor: theme.palette.content.main
|
|
|
|
|
}
|
|
|
|
|
}}>
|
|
|
|
|
НАЙТИ
|
|
|
|
|
</Button>
|
|
|
|
|
</Box>
|
2022-09-09 13:54:49 +00:00
|
|
|
|
</Box>
|
|
|
|
|
|
|
|
|
|
<Box sx={{ display: "flex" }}>
|
|
|
|
|
<TextField
|
|
|
|
|
id = "standard-basic"
|
|
|
|
|
label = "mail"
|
|
|
|
|
variant = "filled"
|
|
|
|
|
color = "secondary"
|
|
|
|
|
sx = {{
|
|
|
|
|
width: "80%"
|
|
|
|
|
}}
|
|
|
|
|
InputProps={{
|
|
|
|
|
style: {
|
|
|
|
|
backgroundColor: theme.palette.content.main,
|
|
|
|
|
color: theme.palette.secondary.main,
|
|
|
|
|
borderBottom: "1px solid",
|
2022-09-12 10:32:05 +00:00
|
|
|
|
borderColor: theme.palette.grayLight.main,
|
2022-09-09 13:54:49 +00:00
|
|
|
|
} }}
|
|
|
|
|
InputLabelProps={{
|
|
|
|
|
style: {
|
|
|
|
|
color: theme.palette.secondary.main
|
|
|
|
|
} }}
|
|
|
|
|
/>
|
2022-12-19 20:15:00 +00:00
|
|
|
|
<Box
|
|
|
|
|
sx={{
|
|
|
|
|
display: 'flex',
|
|
|
|
|
justifyContent: 'center',
|
|
|
|
|
maxWidth: '317px',
|
|
|
|
|
width: '100%'
|
|
|
|
|
}}
|
|
|
|
|
>
|
|
|
|
|
<Button
|
|
|
|
|
variant = "text"
|
|
|
|
|
sx={{
|
|
|
|
|
backgroundColor: theme.palette.content.main,
|
|
|
|
|
color: theme.palette.secondary.main,
|
|
|
|
|
width: "20%",
|
|
|
|
|
"&:hover": {
|
|
|
|
|
backgroundColor: theme.palette.content.main
|
|
|
|
|
}
|
|
|
|
|
}}>
|
|
|
|
|
СБРОСИТЬ
|
|
|
|
|
</Button>
|
|
|
|
|
</Box>
|
2022-09-09 13:54:49 +00:00
|
|
|
|
</Box>
|
|
|
|
|
</Box>
|
2022-09-19 16:17:03 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<Table sx={{
|
|
|
|
|
width: "90%",
|
|
|
|
|
border: "2px solid",
|
|
|
|
|
borderColor: theme.palette.grayLight.main,
|
|
|
|
|
marginTop: "35px",
|
|
|
|
|
}} aria-label="simple table">
|
|
|
|
|
<TableHead>
|
|
|
|
|
<TableRow sx={{
|
|
|
|
|
borderBottom: "2px solid",
|
|
|
|
|
borderColor: theme.palette.grayLight.main,
|
|
|
|
|
height: "100px"
|
|
|
|
|
}}>
|
|
|
|
|
<TableCell sx={{ textAlign: "center" }}>
|
|
|
|
|
<Typography
|
|
|
|
|
variant="h4"
|
|
|
|
|
sx={{
|
|
|
|
|
color: theme.palette.secondary.main,
|
|
|
|
|
}}>
|
|
|
|
|
ID
|
|
|
|
|
</Typography>
|
|
|
|
|
</TableCell>
|
|
|
|
|
</TableRow>
|
|
|
|
|
</TableHead>
|
|
|
|
|
|
|
|
|
|
<TableBody>
|
|
|
|
|
<TableRow sx={{
|
|
|
|
|
borderBottom: "2px solid",
|
|
|
|
|
borderColor: theme.palette.grayLight.main,
|
2022-09-21 13:47:45 +00:00
|
|
|
|
height: "100px",
|
|
|
|
|
cursor: "pointer"
|
|
|
|
|
}} onClick={ () => navigate("/modalUser") }>
|
2022-09-19 16:17:03 +00:00
|
|
|
|
<TableCell sx={{ textAlign: "center" }}>
|
|
|
|
|
<Typography sx={{
|
|
|
|
|
color: theme.palette.secondary.main
|
|
|
|
|
}}>
|
|
|
|
|
1
|
|
|
|
|
</Typography>
|
|
|
|
|
</TableCell>
|
|
|
|
|
</TableRow>
|
|
|
|
|
|
|
|
|
|
<TableRow sx={{
|
|
|
|
|
borderBottom: "2px solid",
|
|
|
|
|
borderColor: theme.palette.grayLight.main,
|
2022-09-21 13:47:45 +00:00
|
|
|
|
height: "100px",
|
|
|
|
|
cursor: "pointer"
|
|
|
|
|
}} onClick={ () => navigate("/modalUser") }>
|
2022-09-19 16:17:03 +00:00
|
|
|
|
<TableCell sx={{ textAlign: "center" }}>
|
|
|
|
|
<Typography sx={{
|
|
|
|
|
color: theme.palette.secondary.main
|
|
|
|
|
}}>
|
|
|
|
|
2
|
|
|
|
|
</Typography>
|
|
|
|
|
</TableCell>
|
|
|
|
|
</TableRow>
|
|
|
|
|
|
|
|
|
|
<TableRow sx={{
|
|
|
|
|
borderBottom: "1px solid",
|
|
|
|
|
border: theme.palette.secondary.main,
|
2022-09-21 13:47:45 +00:00
|
|
|
|
height: "100px",
|
|
|
|
|
cursor: "pointer"
|
|
|
|
|
}} onClick={ () => navigate("/modalUser") }>
|
2022-09-19 16:17:03 +00:00
|
|
|
|
<TableCell sx={{ textAlign: "center" }}>
|
|
|
|
|
<Typography sx={{
|
|
|
|
|
color: theme.palette.secondary.main
|
|
|
|
|
}}>
|
|
|
|
|
3
|
|
|
|
|
</Typography>
|
|
|
|
|
</TableCell>
|
|
|
|
|
</TableRow>
|
|
|
|
|
</TableBody>
|
|
|
|
|
</Table>
|
2022-09-08 17:21:17 +00:00
|
|
|
|
</React.Fragment>
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
export default Users;
|