2023-03-30 18:39:59 +00:00
|
|
|
|
import {
|
2023-04-15 09:10:59 +00:00
|
|
|
|
Box,
|
|
|
|
|
Button,
|
|
|
|
|
FormControl,
|
|
|
|
|
FormControlLabel,
|
|
|
|
|
IconButton,
|
|
|
|
|
Link,
|
|
|
|
|
MenuItem,
|
|
|
|
|
Modal,
|
|
|
|
|
Radio,
|
|
|
|
|
RadioGroup,
|
|
|
|
|
Select,
|
|
|
|
|
SelectChangeEvent,
|
|
|
|
|
TextField,
|
|
|
|
|
Typography,
|
|
|
|
|
useTheme,
|
2023-03-30 18:39:59 +00:00
|
|
|
|
} from "@mui/material";
|
|
|
|
|
import * as React from "react";
|
2023-05-10 17:35:30 +00:00
|
|
|
|
import ArrowDown from "@icons/ArrowDownIcon";
|
2023-04-15 09:10:59 +00:00
|
|
|
|
import { useState } from "react";
|
2023-05-10 17:35:30 +00:00
|
|
|
|
import DeleteIcon from "@icons/questionsPage/deleteIcon";
|
2023-05-03 23:25:35 +00:00
|
|
|
|
import RadioCheck from "@ui_kit/RadioCheck";
|
|
|
|
|
import RadioIcon from "@ui_kit/RadioIcon";
|
2023-03-30 18:39:59 +00:00
|
|
|
|
|
|
|
|
|
export default function BranchingQuestions() {
|
2023-04-15 09:10:59 +00:00
|
|
|
|
const theme = useTheme();
|
2023-07-14 11:43:28 +00:00
|
|
|
|
// const [open, setOpen] = useState(false);
|
2023-04-15 09:10:59 +00:00
|
|
|
|
const [condition, setCondition] = useState<boolean>(false);
|
2023-07-14 11:43:28 +00:00
|
|
|
|
// const handleOpen = () => setOpen(true);
|
|
|
|
|
// const handleClose = () => setOpen(false);
|
2023-03-30 18:39:59 +00:00
|
|
|
|
|
2023-04-15 09:10:59 +00:00
|
|
|
|
const [display, setDisplay] = React.useState("1");
|
|
|
|
|
const handleChange = (event: SelectChangeEvent) => {
|
|
|
|
|
setDisplay(event.target.value);
|
|
|
|
|
};
|
2023-03-30 18:39:59 +00:00
|
|
|
|
|
2023-04-15 09:10:59 +00:00
|
|
|
|
const [value, setValue] = React.useState("1");
|
2023-03-30 18:39:59 +00:00
|
|
|
|
|
2023-04-15 09:10:59 +00:00
|
|
|
|
const handleChangeRadio = (event: React.ChangeEvent<HTMLInputElement>) => {
|
|
|
|
|
setValue((event.target as HTMLInputElement).value);
|
|
|
|
|
};
|
|
|
|
|
return (
|
|
|
|
|
<>
|
|
|
|
|
<Modal
|
2023-07-14 11:43:28 +00:00
|
|
|
|
open={openBranch}
|
|
|
|
|
onClose={handleCloseBranch}
|
2023-04-15 09:10:59 +00:00
|
|
|
|
aria-labelledby="modal-modal-title"
|
|
|
|
|
aria-describedby="modal-modal-description"
|
|
|
|
|
>
|
|
|
|
|
<Box
|
|
|
|
|
sx={{
|
|
|
|
|
position: "absolute" as "absolute",
|
|
|
|
|
top: "50%",
|
|
|
|
|
left: "50%",
|
|
|
|
|
transform: "translate(-50%, -50%)",
|
|
|
|
|
maxWidth: "620px",
|
|
|
|
|
width: "100%",
|
|
|
|
|
bgcolor: "background.paper",
|
|
|
|
|
borderRadius: "12px",
|
|
|
|
|
boxShadow: 24,
|
|
|
|
|
p: 0,
|
|
|
|
|
}}
|
|
|
|
|
>
|
|
|
|
|
<Box
|
|
|
|
|
sx={{
|
|
|
|
|
padding: "20px",
|
|
|
|
|
display: "flex",
|
|
|
|
|
flexDirection: "column",
|
|
|
|
|
gap: "30px",
|
|
|
|
|
}}
|
|
|
|
|
>
|
|
|
|
|
<Box
|
|
|
|
|
sx={{
|
|
|
|
|
display: "flex",
|
|
|
|
|
gap: "20px",
|
|
|
|
|
alignItems: "center",
|
|
|
|
|
}}
|
|
|
|
|
>
|
|
|
|
|
<FormControl
|
|
|
|
|
fullWidth
|
|
|
|
|
size="small"
|
|
|
|
|
sx={{
|
|
|
|
|
width: "100%",
|
|
|
|
|
maxWidth: "140px",
|
|
|
|
|
height: "48px",
|
|
|
|
|
}}
|
|
|
|
|
>
|
|
|
|
|
<Select
|
|
|
|
|
id="display-select"
|
|
|
|
|
variant="outlined"
|
|
|
|
|
value={display}
|
|
|
|
|
displayEmpty
|
|
|
|
|
onChange={handleChange}
|
|
|
|
|
sx={{
|
|
|
|
|
height: "48px",
|
|
|
|
|
borderRadius: "8px",
|
|
|
|
|
"& .MuiOutlinedInput-notchedOutline": {
|
|
|
|
|
border: `1px solid ${theme.palette.brightPurple.main} !important`,
|
|
|
|
|
},
|
|
|
|
|
}}
|
|
|
|
|
MenuProps={{
|
|
|
|
|
PaperProps: {
|
|
|
|
|
sx: {
|
|
|
|
|
mt: "8px",
|
|
|
|
|
p: "4px",
|
|
|
|
|
borderRadius: "8px",
|
|
|
|
|
border: "1px solid #EEE4FC",
|
|
|
|
|
boxShadow: "0px 8px 24px rgba(210, 208, 225, 0.4)",
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
MenuListProps: {
|
|
|
|
|
sx: {
|
|
|
|
|
py: 0,
|
|
|
|
|
display: "flex",
|
|
|
|
|
flexDirection: "column",
|
|
|
|
|
gap: "8px",
|
|
|
|
|
"& .Mui-selected": {
|
|
|
|
|
backgroundColor: theme.palette.background.default,
|
|
|
|
|
color: theme.palette.brightPurple.main,
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
}}
|
|
|
|
|
inputProps={{
|
|
|
|
|
sx: {
|
|
|
|
|
color: theme.palette.brightPurple.main,
|
|
|
|
|
display: "flex",
|
|
|
|
|
alignItems: "center",
|
|
|
|
|
px: "9px",
|
|
|
|
|
gap: "20px",
|
|
|
|
|
},
|
|
|
|
|
}}
|
|
|
|
|
IconComponent={(props) => <ArrowDown {...props} />}
|
|
|
|
|
>
|
|
|
|
|
<MenuItem
|
|
|
|
|
value={1}
|
|
|
|
|
sx={{
|
|
|
|
|
display: "flex",
|
|
|
|
|
alignItems: "center",
|
|
|
|
|
gap: "20px",
|
|
|
|
|
p: "4px",
|
|
|
|
|
borderRadius: "5px",
|
|
|
|
|
color: theme.palette.grey2.main,
|
|
|
|
|
}}
|
|
|
|
|
>
|
|
|
|
|
Показать
|
|
|
|
|
</MenuItem>
|
|
|
|
|
<MenuItem
|
|
|
|
|
value={2}
|
|
|
|
|
sx={{
|
|
|
|
|
display: "flex",
|
|
|
|
|
alignItems: "center",
|
|
|
|
|
gap: "20px",
|
|
|
|
|
p: "4px",
|
|
|
|
|
borderRadius: "5px",
|
|
|
|
|
color: theme.palette.grey2.main,
|
|
|
|
|
}}
|
|
|
|
|
>
|
|
|
|
|
Скрыть
|
|
|
|
|
</MenuItem>
|
|
|
|
|
</Select>
|
|
|
|
|
</FormControl>
|
|
|
|
|
<Typography sx={{ color: theme.palette.grey2.main }}>если в ответе на вопрос</Typography>
|
|
|
|
|
</Box>
|
|
|
|
|
{condition ? (
|
|
|
|
|
<Box sx={{ padding: "20px", borderRadius: "8px", height: "100%", bgcolor: "#F2F3F7" }}>
|
|
|
|
|
<Box sx={{ display: "flex", justifyContent: "space-between", alignItems: "center", pb: "14px" }}>
|
|
|
|
|
<Typography>Условие 1</Typography>
|
|
|
|
|
<IconButton sx={{ borderRadius: "6px", padding: "2px" }}>
|
2023-07-06 18:48:39 +00:00
|
|
|
|
<DeleteIcon color={"#4D4D4D"}/>
|
2023-04-15 09:10:59 +00:00
|
|
|
|
</IconButton>
|
|
|
|
|
</Box>
|
2023-03-30 18:39:59 +00:00
|
|
|
|
|
2023-04-15 09:10:59 +00:00
|
|
|
|
<TextField
|
|
|
|
|
// value={text}
|
|
|
|
|
fullWidth
|
|
|
|
|
sx={{
|
|
|
|
|
pb: "20px",
|
|
|
|
|
"& .MuiInputBase-root": {
|
|
|
|
|
backgroundColor: "#F2F3F7",
|
|
|
|
|
height: "48px",
|
|
|
|
|
borderRadius: "10px",
|
|
|
|
|
},
|
|
|
|
|
}}
|
|
|
|
|
inputProps={{
|
|
|
|
|
sx: {
|
|
|
|
|
borderRadius: "10px",
|
|
|
|
|
fontSize: "18px",
|
|
|
|
|
lineHeight: "21px",
|
|
|
|
|
py: 0,
|
|
|
|
|
},
|
|
|
|
|
}}
|
|
|
|
|
/>
|
|
|
|
|
<Box sx={{ display: "flex", alignItems: "center", pb: "14px" }}>
|
|
|
|
|
<Typography>Дан ответ</Typography>
|
|
|
|
|
<Typography sx={{ color: "#7E2AEA", pl: "10px" }}>(Укажите один или несколько вариантов)</Typography>
|
2023-03-30 18:39:59 +00:00
|
|
|
|
</Box>
|
2023-04-15 09:10:59 +00:00
|
|
|
|
<TextField
|
|
|
|
|
// value={text}
|
|
|
|
|
fullWidth
|
|
|
|
|
sx={{
|
|
|
|
|
"& .MuiInputBase-root": {
|
|
|
|
|
backgroundColor: "#F2F3F7",
|
|
|
|
|
height: "48px",
|
|
|
|
|
borderRadius: "10px",
|
|
|
|
|
},
|
|
|
|
|
}}
|
|
|
|
|
inputProps={{
|
|
|
|
|
sx: {
|
|
|
|
|
borderRadius: "10px",
|
|
|
|
|
fontSize: "18px",
|
|
|
|
|
lineHeight: "21px",
|
|
|
|
|
py: 0,
|
|
|
|
|
},
|
|
|
|
|
}}
|
|
|
|
|
/>
|
|
|
|
|
</Box>
|
|
|
|
|
) : (
|
|
|
|
|
""
|
|
|
|
|
)}
|
|
|
|
|
<Box
|
|
|
|
|
sx={{
|
|
|
|
|
display: "flex",
|
|
|
|
|
flexDirection: "column",
|
|
|
|
|
alignItems: "baseline",
|
|
|
|
|
}}
|
|
|
|
|
>
|
|
|
|
|
<Link
|
|
|
|
|
component="button"
|
|
|
|
|
variant="body2"
|
|
|
|
|
sx={{ color: theme.palette.brightPurple.main }}
|
|
|
|
|
onClick={() => setCondition(true)}
|
|
|
|
|
>
|
|
|
|
|
Добавить условие
|
|
|
|
|
</Link>
|
|
|
|
|
|
|
|
|
|
<FormControl>
|
|
|
|
|
<RadioGroup
|
|
|
|
|
aria-labelledby="demo-controlled-radio-buttons-group"
|
|
|
|
|
name="controlled-radio-buttons-group"
|
|
|
|
|
value={value}
|
|
|
|
|
onChange={handleChangeRadio}
|
|
|
|
|
>
|
|
|
|
|
<FormControlLabel
|
|
|
|
|
sx={{ color: theme.palette.grey2.main }}
|
|
|
|
|
value="1"
|
2023-05-03 23:25:35 +00:00
|
|
|
|
control={<Radio checkedIcon={<RadioCheck/>} icon={<RadioIcon/>}/>}
|
2023-04-15 09:10:59 +00:00
|
|
|
|
label="Все условия обязательны"
|
|
|
|
|
/>
|
|
|
|
|
<FormControlLabel
|
|
|
|
|
sx={{ color: theme.palette.grey2.main }}
|
|
|
|
|
value="2"
|
2023-05-03 23:25:35 +00:00
|
|
|
|
control={<Radio checkedIcon={<RadioCheck/>} icon={<RadioIcon/>}/>}
|
2023-04-15 09:10:59 +00:00
|
|
|
|
label="Обязательно хотя бы одно условие"
|
|
|
|
|
/>
|
|
|
|
|
</RadioGroup>
|
|
|
|
|
</FormControl>
|
|
|
|
|
</Box>
|
|
|
|
|
<Box sx={{ display: "flex", justifyContent: "end", gap: "10px" }}>
|
2023-05-10 17:35:30 +00:00
|
|
|
|
<Button
|
2023-04-15 09:10:59 +00:00
|
|
|
|
variant="outlined"
|
2023-07-14 11:43:28 +00:00
|
|
|
|
onClick={handleCloseBranch}
|
2023-04-15 09:10:59 +00:00
|
|
|
|
>
|
|
|
|
|
Отмена
|
2023-05-10 17:35:30 +00:00
|
|
|
|
</Button>
|
|
|
|
|
<Button
|
|
|
|
|
variant="contained">
|
2023-04-15 09:10:59 +00:00
|
|
|
|
Готово
|
2023-05-10 17:35:30 +00:00
|
|
|
|
</Button>
|
2023-04-15 09:10:59 +00:00
|
|
|
|
</Box>
|
|
|
|
|
</Box>
|
|
|
|
|
</Box>
|
|
|
|
|
</Modal>
|
|
|
|
|
</>
|
|
|
|
|
);
|
|
|
|
|
}
|