2024-01-30 16:49:33 +00:00
|
|
|
|
import AddressIcon from "@icons/ContactFormIcon/AddressIcon";
|
2023-12-17 13:22:21 +00:00
|
|
|
|
import EmailIcon from "@icons/ContactFormIcon/EmailIcon";
|
2024-02-02 14:35:02 +00:00
|
|
|
|
import NameIcon from "@icons/ContactFormIcon/NameIcon";
|
2023-12-17 13:22:21 +00:00
|
|
|
|
import PhoneIcon from "@icons/ContactFormIcon/PhoneIcon";
|
|
|
|
|
import TextIcon from "@icons/ContactFormIcon/TextIcon";
|
2024-02-05 10:10:02 +00:00
|
|
|
|
import { Box, Button, InputAdornment, Link, TextField as MuiTextField, TextFieldProps, Typography, useTheme } from "@mui/material";
|
2024-01-30 16:49:33 +00:00
|
|
|
|
|
2023-12-17 13:22:21 +00:00
|
|
|
|
import CustomCheckbox from "@ui_kit/CustomCheckbox";
|
2024-01-30 16:49:33 +00:00
|
|
|
|
import { FC, useRef, useState } from "react";
|
2023-12-16 14:55:56 +00:00
|
|
|
|
|
2023-12-17 21:28:57 +00:00
|
|
|
|
import { sendFC } from "@api/quizRelase";
|
2023-12-21 19:22:06 +00:00
|
|
|
|
import { NameplateLogo } from "@icons/NameplateLogo";
|
2023-12-31 00:04:35 +00:00
|
|
|
|
import { QuizQuestionResult } from "@model/questionTypes/result";
|
2024-02-08 13:42:31 +00:00
|
|
|
|
import { AnyTypedQuizQuestion } from "@model/questionTypes/shared";
|
2024-02-02 14:35:02 +00:00
|
|
|
|
import { useQuizData } from "@utils/hooks/useQuizData";
|
2024-02-05 10:10:02 +00:00
|
|
|
|
import { quizThemes } from "@utils/themes/Publication/themePublication";
|
2024-01-30 16:49:33 +00:00
|
|
|
|
import { enqueueSnackbar } from "notistack";
|
2024-02-08 13:42:31 +00:00
|
|
|
|
import { useQuizId } from "../../contexts/QuizIdContext";
|
2024-02-05 10:10:02 +00:00
|
|
|
|
import { useRootContainerSize } from "../../contexts/RootContainerWidthContext";
|
2024-01-30 16:49:33 +00:00
|
|
|
|
|
2023-12-16 14:55:56 +00:00
|
|
|
|
|
2024-01-30 16:49:33 +00:00
|
|
|
|
const TextField = MuiTextField as unknown as FC<TextFieldProps>; // temporary fix ts(2590)
|
|
|
|
|
const EMAIL_REGEXP = /^(([^<>()[\].,:\s@"]+(\.[^<>()[\].,:\s@"]+)*)|(".+"))@(([^<>()[\].,:\s@"]+\.)+[^<>()[\].,:\s@"]{2,})$/iu;
|
2024-01-05 17:00:30 +00:00
|
|
|
|
|
2024-02-08 13:42:31 +00:00
|
|
|
|
type Props = {
|
|
|
|
|
currentQuestion: AnyTypedQuizQuestion;
|
|
|
|
|
onShowResult: () => void;
|
2023-12-16 14:55:56 +00:00
|
|
|
|
};
|
|
|
|
|
|
2024-02-08 13:42:31 +00:00
|
|
|
|
export const ContactForm = ({ currentQuestion, onShowResult }: Props) => {
|
2024-01-30 16:49:33 +00:00
|
|
|
|
const theme = useTheme();
|
2024-02-08 13:42:31 +00:00
|
|
|
|
const qid = useQuizId();
|
2024-02-02 14:35:02 +00:00
|
|
|
|
const { settings, questions } = useQuizData();
|
2024-01-30 16:49:33 +00:00
|
|
|
|
|
2024-01-31 12:57:07 +00:00
|
|
|
|
const [ready, setReady] = useState(false);
|
|
|
|
|
const [name, setName] = useState("");
|
|
|
|
|
const [email, setEmail] = useState("");
|
|
|
|
|
const [phone, setPhone] = useState("");
|
|
|
|
|
const [text, setText] = useState("");
|
|
|
|
|
const [adress, setAdress] = useState("");
|
2024-01-30 16:49:33 +00:00
|
|
|
|
|
2024-01-31 12:57:07 +00:00
|
|
|
|
const fireOnce = useRef(true);
|
|
|
|
|
const [fire, setFire] = useState(false);
|
2024-02-05 10:10:02 +00:00
|
|
|
|
const isMobile = useRootContainerSize() < 850;
|
2024-01-30 16:49:33 +00:00
|
|
|
|
|
2024-02-08 13:42:31 +00:00
|
|
|
|
const resultQuestion = currentQuestion.type === "result"
|
|
|
|
|
? currentQuestion
|
|
|
|
|
: questions.find((question): question is QuizQuestionResult => {
|
|
|
|
|
if (settings?.cfg.haveRoot) {
|
|
|
|
|
return (
|
|
|
|
|
question.type === "result" &&
|
|
|
|
|
question.content.rule.parentId === currentQuestion.content.id
|
|
|
|
|
);
|
|
|
|
|
} else {
|
|
|
|
|
return (
|
|
|
|
|
question.type === "result" && question.content.rule.parentId === "line"
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
});
|
2023-12-23 18:03:34 +00:00
|
|
|
|
|
2024-02-08 13:42:31 +00:00
|
|
|
|
if (!resultQuestion) throw new Error("Result question not found");
|
2024-01-30 16:49:33 +00:00
|
|
|
|
|
|
|
|
|
const inputHC = async () => {
|
2024-02-08 13:42:31 +00:00
|
|
|
|
const FC = settings.cfg.formContact.fields || settings.cfg.formContact;
|
|
|
|
|
const body = {} as any;
|
2024-01-30 16:49:33 +00:00
|
|
|
|
if (name.length > 0) body.name = name;
|
|
|
|
|
if (email.length > 0) body.email = email;
|
|
|
|
|
if (phone.length > 0) body.phone = phone;
|
2024-01-31 12:57:07 +00:00
|
|
|
|
if (adress.length > 0) body.address = adress;
|
|
|
|
|
if (text.length > 0) body.customs = { [FC.text.text || "Фамилия"]: text };
|
2024-01-30 16:49:33 +00:00
|
|
|
|
|
|
|
|
|
if (Object.keys(body).length > 0) {
|
|
|
|
|
try {
|
|
|
|
|
await sendFC({
|
2024-02-08 13:42:31 +00:00
|
|
|
|
questionId: currentQuestion.id,
|
2024-01-30 16:49:33 +00:00
|
|
|
|
body: body,
|
2024-02-08 13:42:31 +00:00
|
|
|
|
qid,
|
2024-01-31 12:57:07 +00:00
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
const sessions = JSON.parse(localStorage.getItem("sessions") || "{}");
|
|
|
|
|
localStorage.setItem(
|
|
|
|
|
"sessions",
|
2024-02-08 13:42:31 +00:00
|
|
|
|
JSON.stringify({ ...sessions, [qid]: new Date().getTime() })
|
2024-01-31 12:57:07 +00:00
|
|
|
|
);
|
2024-01-30 16:49:33 +00:00
|
|
|
|
} catch (e) {
|
2024-01-31 12:57:07 +00:00
|
|
|
|
enqueueSnackbar("ответ не был засчитан");
|
2024-01-30 16:49:33 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
2024-01-31 12:57:07 +00:00
|
|
|
|
};
|
2024-01-30 16:49:33 +00:00
|
|
|
|
|
2024-02-08 13:42:31 +00:00
|
|
|
|
const FCcopy: any = settings.cfg.formContact.fields || settings.cfg.formContact;
|
|
|
|
|
|
|
|
|
|
const filteredFC: any = {};
|
|
|
|
|
for (const i in FCcopy) {
|
|
|
|
|
const field = FCcopy[i];
|
2024-01-30 16:49:33 +00:00
|
|
|
|
if (field.used) {
|
|
|
|
|
filteredFC[i] = field;
|
|
|
|
|
}
|
|
|
|
|
}
|
2024-02-08 13:42:31 +00:00
|
|
|
|
const isWide = Object.keys(filteredFC).length > 2;
|
|
|
|
|
|
|
|
|
|
async function handleShowResultsClick() {
|
|
|
|
|
//@ts-ignore
|
|
|
|
|
const FC: any = settings.cfg.formContact.fields || settings.cfg.formContact;
|
|
|
|
|
if (FC["email"].used !== EMAIL_REGEXP.test(email)) {
|
|
|
|
|
return enqueueSnackbar("введена некорректная почта");
|
|
|
|
|
}
|
2023-12-24 11:52:09 +00:00
|
|
|
|
|
2024-02-08 13:42:31 +00:00
|
|
|
|
|
|
|
|
|
if (fireOnce.current) {
|
|
|
|
|
if (
|
|
|
|
|
name.length === 0
|
|
|
|
|
&& email.length === 0
|
|
|
|
|
&& phone.length === 0
|
|
|
|
|
&& text.length === 0
|
|
|
|
|
&& adress.length === 0
|
|
|
|
|
) return enqueueSnackbar("Пожалуйста, заполните поля");
|
|
|
|
|
|
2024-02-11 23:35:00 +00:00
|
|
|
|
//почта валидна, хоть одно поле заполнено
|
|
|
|
|
setFire(true);
|
2024-02-08 13:42:31 +00:00
|
|
|
|
try {
|
|
|
|
|
await inputHC();
|
|
|
|
|
fireOnce.current = false;
|
|
|
|
|
const sessions: any = JSON.parse(
|
|
|
|
|
localStorage.getItem("sessions") || "{}"
|
|
|
|
|
);
|
|
|
|
|
sessions[qid] = Date.now();
|
|
|
|
|
localStorage.setItem(
|
|
|
|
|
"sessions",
|
|
|
|
|
JSON.stringify(sessions)
|
|
|
|
|
);
|
|
|
|
|
enqueueSnackbar("Данные успешно отправлены");
|
|
|
|
|
} catch (e) {
|
|
|
|
|
enqueueSnackbar("повторите попытку позже");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
onShowResult();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
setFire(false);
|
|
|
|
|
}
|
2023-12-24 11:52:09 +00:00
|
|
|
|
|
2024-01-30 16:49:33 +00:00
|
|
|
|
return (
|
2024-01-06 23:56:13 +00:00
|
|
|
|
<Box
|
|
|
|
|
sx={{
|
2024-01-30 16:49:33 +00:00
|
|
|
|
display: "flex",
|
|
|
|
|
alignItems: "center",
|
|
|
|
|
justifyContent: "center",
|
|
|
|
|
backgroundColor: theme.palette.background.default,
|
2024-02-08 13:42:31 +00:00
|
|
|
|
height: "100%",
|
2024-01-30 16:49:33 +00:00
|
|
|
|
overflow: "auto",
|
2024-01-31 12:57:07 +00:00
|
|
|
|
"&::-webkit-scrollbar": {
|
|
|
|
|
width: "0",
|
|
|
|
|
display: "none",
|
|
|
|
|
msOverflowStyle: "none",
|
|
|
|
|
},
|
2024-01-30 16:49:33 +00:00
|
|
|
|
scrollbarWidth: "none",
|
2024-01-31 12:57:07 +00:00
|
|
|
|
msOverflowStyle: "none",
|
2024-01-06 23:56:13 +00:00
|
|
|
|
}}
|
|
|
|
|
>
|
2024-01-30 16:49:33 +00:00
|
|
|
|
<Box
|
|
|
|
|
sx={{
|
2024-01-31 12:57:07 +00:00
|
|
|
|
width: isWide && !isMobile ? "100%" : isMobile ? undefined : "530px",
|
2024-01-30 16:49:33 +00:00
|
|
|
|
borderRadius: "4px",
|
|
|
|
|
height: "90vh",
|
2024-01-31 12:57:07 +00:00
|
|
|
|
display: isWide && !isMobile ? "flex" : undefined,
|
2024-01-30 16:49:33 +00:00
|
|
|
|
}}
|
2023-12-17 21:28:57 +00:00
|
|
|
|
>
|
2024-01-30 16:49:33 +00:00
|
|
|
|
<Box
|
|
|
|
|
sx={{
|
|
|
|
|
width: isWide && !isMobile ? "100%" : undefined,
|
|
|
|
|
display: "flex",
|
|
|
|
|
flexDirection: "column",
|
|
|
|
|
alignItems: "center",
|
|
|
|
|
justifyContent: "center",
|
2024-01-31 12:57:07 +00:00
|
|
|
|
borderRight: isWide && !isMobile ? "1px solid gray" : undefined,
|
2024-01-30 16:49:33 +00:00
|
|
|
|
}}
|
|
|
|
|
>
|
|
|
|
|
<Typography
|
|
|
|
|
sx={{
|
|
|
|
|
textAlign: "center",
|
|
|
|
|
m: "20px 0",
|
|
|
|
|
fontSize: "28px",
|
2024-01-31 12:57:07 +00:00
|
|
|
|
color: theme.palette.text.primary,
|
2024-01-30 16:49:33 +00:00
|
|
|
|
}}
|
|
|
|
|
>
|
2024-02-08 13:42:31 +00:00
|
|
|
|
{settings.cfg.formContact.title ||
|
2024-01-31 12:57:07 +00:00
|
|
|
|
"Заполните форму, чтобы получить результаты теста"}
|
2024-01-30 16:49:33 +00:00
|
|
|
|
</Typography>
|
2024-02-08 13:42:31 +00:00
|
|
|
|
{settings.cfg.formContact.desc && (
|
2024-01-30 16:49:33 +00:00
|
|
|
|
<Typography
|
|
|
|
|
sx={{
|
|
|
|
|
color: theme.palette.text.primary,
|
|
|
|
|
textAlign: "center",
|
|
|
|
|
m: "20px 0",
|
2024-01-31 12:57:07 +00:00
|
|
|
|
fontSize: "18px",
|
2024-01-30 16:49:33 +00:00
|
|
|
|
}}
|
|
|
|
|
>
|
2024-02-08 13:42:31 +00:00
|
|
|
|
{settings.cfg.formContact.desc}
|
2024-01-30 16:49:33 +00:00
|
|
|
|
</Typography>
|
2024-01-31 12:57:07 +00:00
|
|
|
|
)}
|
2024-01-30 16:49:33 +00:00
|
|
|
|
</Box>
|
|
|
|
|
|
|
|
|
|
<Box
|
|
|
|
|
sx={{
|
|
|
|
|
display: "flex",
|
|
|
|
|
alignItems: "center",
|
|
|
|
|
justifyContent: "center",
|
|
|
|
|
flexDirection: "column",
|
|
|
|
|
backgroundColor: theme.palette.background.default,
|
2024-01-31 12:57:07 +00:00
|
|
|
|
p: "30px",
|
|
|
|
|
}}
|
|
|
|
|
>
|
2024-01-30 16:49:33 +00:00
|
|
|
|
<Box
|
|
|
|
|
sx={{
|
|
|
|
|
display: "flex",
|
|
|
|
|
flexDirection: "column",
|
2024-01-31 12:57:07 +00:00
|
|
|
|
my: "20px",
|
2024-01-30 16:49:33 +00:00
|
|
|
|
}}
|
|
|
|
|
>
|
|
|
|
|
<Inputs
|
2024-01-31 12:57:07 +00:00
|
|
|
|
name={name}
|
|
|
|
|
setName={setName}
|
|
|
|
|
email={email}
|
|
|
|
|
setEmail={setEmail}
|
|
|
|
|
phone={phone}
|
|
|
|
|
setPhone={setPhone}
|
|
|
|
|
text={text}
|
|
|
|
|
setText={setText}
|
|
|
|
|
adress={adress}
|
|
|
|
|
setAdress={setAdress}
|
2024-01-30 16:49:33 +00:00
|
|
|
|
/>
|
|
|
|
|
</Box>
|
|
|
|
|
|
|
|
|
|
{
|
|
|
|
|
// resultQuestion &&
|
2024-02-08 13:42:31 +00:00
|
|
|
|
// settings.cfg.resultInfo.when === "after" &&
|
2024-01-31 12:57:07 +00:00
|
|
|
|
<Button
|
|
|
|
|
disabled={!(ready && !fire)}
|
|
|
|
|
variant="contained"
|
2024-02-08 13:42:31 +00:00
|
|
|
|
onClick={handleShowResultsClick}
|
2024-01-31 12:57:07 +00:00
|
|
|
|
>
|
2024-02-08 13:42:31 +00:00
|
|
|
|
{settings.cfg.formContact?.button || "Получить результаты"}
|
2024-01-31 12:57:07 +00:00
|
|
|
|
</Button>
|
|
|
|
|
}
|
2024-02-10 12:41:20 +00:00
|
|
|
|
|
2024-01-30 16:49:33 +00:00
|
|
|
|
<Box
|
|
|
|
|
sx={{
|
|
|
|
|
display: "flex",
|
|
|
|
|
mt: "20px",
|
|
|
|
|
width: isMobile ? "300px" : "450px",
|
|
|
|
|
}}
|
|
|
|
|
>
|
2024-01-31 12:57:07 +00:00
|
|
|
|
<CustomCheckbox
|
|
|
|
|
label=""
|
|
|
|
|
handleChange={({ target }) => {
|
|
|
|
|
setReady(target.checked);
|
|
|
|
|
}}
|
|
|
|
|
checked={ready}
|
|
|
|
|
colorIcon={theme.palette.primary.main}
|
|
|
|
|
/>
|
2024-01-30 16:49:33 +00:00
|
|
|
|
<Typography sx={{ color: theme.palette.text.primary }}>
|
|
|
|
|
С 
|
|
|
|
|
<Link href={"https://shub.pena.digital/ppdd"} target="_blank">
|
2024-01-31 12:57:07 +00:00
|
|
|
|
Положением об обработке персональных данных{" "}
|
|
|
|
|
</Link>
|
2024-01-30 16:49:33 +00:00
|
|
|
|
 и 
|
2024-01-31 12:57:07 +00:00
|
|
|
|
<Link
|
|
|
|
|
href={"https://shub.pena.digital/docs/privacy"}
|
|
|
|
|
target="_blank"
|
|
|
|
|
>
|
|
|
|
|
{" "}
|
|
|
|
|
Политикой конфиденциальности{" "}
|
|
|
|
|
</Link>
|
2024-01-30 16:49:33 +00:00
|
|
|
|
 ознакомлен
|
|
|
|
|
</Typography>
|
|
|
|
|
</Box>
|
|
|
|
|
<Box
|
2024-02-11 19:48:59 +00:00
|
|
|
|
component={Link}
|
|
|
|
|
target={"_blank"}
|
|
|
|
|
href={"https://quiz.pena.digital"}
|
2024-01-30 16:49:33 +00:00
|
|
|
|
sx={{
|
|
|
|
|
display: "flex",
|
|
|
|
|
alignItems: "center",
|
|
|
|
|
mt: "20px",
|
2024-01-31 12:57:07 +00:00
|
|
|
|
gap: "15px",
|
2024-02-11 19:48:59 +00:00
|
|
|
|
textDecoration: "none",
|
2024-01-30 16:49:33 +00:00
|
|
|
|
}}
|
|
|
|
|
>
|
2024-01-31 12:57:07 +00:00
|
|
|
|
<NameplateLogo
|
|
|
|
|
style={{
|
|
|
|
|
fontSize: "34px",
|
2024-02-02 14:35:02 +00:00
|
|
|
|
color: quizThemes[settings.cfg.theme].isLight ? "#151515" : "#FFFFFF",
|
2024-01-31 12:57:07 +00:00
|
|
|
|
}}
|
|
|
|
|
/>
|
|
|
|
|
<Typography
|
|
|
|
|
sx={{
|
|
|
|
|
fontSize: "20px",
|
2024-02-02 14:35:02 +00:00
|
|
|
|
color: quizThemes[settings.cfg.theme].isLight ? "#4D4D4D" : "#F5F7FF",
|
2024-01-31 12:57:07 +00:00
|
|
|
|
whiteSpace: "nowrap",
|
|
|
|
|
}}
|
|
|
|
|
>
|
2024-01-30 16:49:33 +00:00
|
|
|
|
Сделано на PenaQuiz
|
|
|
|
|
</Typography>
|
|
|
|
|
</Box>
|
|
|
|
|
</Box>
|
2024-01-31 12:57:07 +00:00
|
|
|
|
</Box>
|
2023-12-29 21:31:21 +00:00
|
|
|
|
</Box>
|
2024-01-30 16:49:33 +00:00
|
|
|
|
);
|
|
|
|
|
};
|
2023-12-17 13:22:21 +00:00
|
|
|
|
|
2024-01-30 16:49:33 +00:00
|
|
|
|
const Inputs = ({
|
2024-01-31 12:57:07 +00:00
|
|
|
|
name,
|
|
|
|
|
setName,
|
|
|
|
|
email,
|
|
|
|
|
setEmail,
|
|
|
|
|
phone,
|
|
|
|
|
setPhone,
|
|
|
|
|
text,
|
|
|
|
|
setText,
|
|
|
|
|
adress,
|
|
|
|
|
setAdress,
|
2024-01-30 16:49:33 +00:00
|
|
|
|
}: any) => {
|
2024-02-02 14:35:02 +00:00
|
|
|
|
const { settings } = useQuizData();
|
2023-12-17 13:22:21 +00:00
|
|
|
|
|
2024-01-31 12:57:07 +00:00
|
|
|
|
// @ts-ignore
|
2024-02-08 13:42:31 +00:00
|
|
|
|
const FC = settings.cfg.formContact.fields || settings.cfg.formContact;
|
2023-12-29 13:35:25 +00:00
|
|
|
|
|
2024-01-31 12:57:07 +00:00
|
|
|
|
if (!FC) return null;
|
2023-12-17 13:22:21 +00:00
|
|
|
|
|
2024-01-30 16:49:33 +00:00
|
|
|
|
//@ts-ignore
|
2024-01-31 12:57:07 +00:00
|
|
|
|
const Name = (
|
|
|
|
|
<CustomInput
|
|
|
|
|
//@ts-ignore
|
|
|
|
|
onChange={({ target }) => setName(target.value)}
|
|
|
|
|
id={name}
|
|
|
|
|
title={FC["name"].innerText || "Введите имя"}
|
|
|
|
|
desc={FC["name"].text || "имя"}
|
|
|
|
|
Icon={NameIcon}
|
|
|
|
|
/>
|
2024-01-25 07:36:45 +00:00
|
|
|
|
);
|
2024-01-30 16:49:33 +00:00
|
|
|
|
//@ts-ignore
|
2024-01-31 12:57:07 +00:00
|
|
|
|
const Email = (
|
|
|
|
|
<CustomInput
|
|
|
|
|
error={!EMAIL_REGEXP.test(email)}
|
|
|
|
|
label={!EMAIL_REGEXP.test(email) ? "" : "Некорректная почта"}
|
|
|
|
|
//@ts-ignore
|
|
|
|
|
onChange={({ target }) => setEmail(target.value)}
|
|
|
|
|
id={email}
|
|
|
|
|
title={FC["email"].innerText || "Введите Email"}
|
|
|
|
|
desc={FC["email"].text || "Email"}
|
|
|
|
|
Icon={EmailIcon}
|
|
|
|
|
/>
|
|
|
|
|
);
|
|
|
|
|
const Phone = (
|
|
|
|
|
<CustomInput
|
|
|
|
|
//@ts-ignore
|
|
|
|
|
onChange={({ target }) => setPhone(target.value)}
|
|
|
|
|
id={phone}
|
|
|
|
|
title={FC["phone"].innerText || "Введите номер телефона"}
|
|
|
|
|
desc={FC["phone"].text || "номер телефона"}
|
|
|
|
|
Icon={PhoneIcon}
|
|
|
|
|
/>
|
2024-01-25 07:36:45 +00:00
|
|
|
|
);
|
2024-01-30 16:49:33 +00:00
|
|
|
|
//@ts-ignore
|
2024-01-31 12:57:07 +00:00
|
|
|
|
const Text = (
|
|
|
|
|
<CustomInput
|
|
|
|
|
//@ts-ignore
|
|
|
|
|
onChange={({ target }) => setText(target.value)}
|
|
|
|
|
id={text}
|
|
|
|
|
title={FC["text"].text || "Введите фамилию"}
|
|
|
|
|
desc={FC["text"].innerText || "фамилию"}
|
|
|
|
|
Icon={TextIcon}
|
|
|
|
|
/>
|
|
|
|
|
);
|
2024-01-30 16:49:33 +00:00
|
|
|
|
//@ts-ignore
|
2024-01-31 12:57:07 +00:00
|
|
|
|
const Adress = (
|
|
|
|
|
<CustomInput
|
|
|
|
|
//@ts-ignore
|
|
|
|
|
onChange={({ target }) => setAdress(target.value)}
|
|
|
|
|
id={adress}
|
|
|
|
|
title={FC["address"].innerText || "Введите адрес"}
|
|
|
|
|
desc={FC["address"].text || "адрес"}
|
|
|
|
|
Icon={AddressIcon}
|
|
|
|
|
/>
|
|
|
|
|
);
|
2023-12-17 13:22:21 +00:00
|
|
|
|
|
2024-01-30 16:49:33 +00:00
|
|
|
|
//@ts-ignore
|
|
|
|
|
if (Object.values(FC).some((data) => data.used)) {
|
2024-01-31 12:57:07 +00:00
|
|
|
|
return (
|
|
|
|
|
<>
|
|
|
|
|
{FC["name"].used ? Name : <></>}
|
|
|
|
|
{FC["email"].used ? Email : <></>}
|
|
|
|
|
{FC["phone"].used ? Phone : <></>}
|
|
|
|
|
{FC["text"].used ? Text : <></>}
|
|
|
|
|
{FC["address"].used ? Adress : <></>}
|
|
|
|
|
</>
|
|
|
|
|
);
|
2024-01-30 16:49:33 +00:00
|
|
|
|
} else {
|
2024-01-31 12:57:07 +00:00
|
|
|
|
return (
|
|
|
|
|
<>
|
|
|
|
|
{Name}
|
|
|
|
|
{Email}
|
|
|
|
|
{Phone}
|
|
|
|
|
</>
|
|
|
|
|
);
|
2024-01-30 16:49:33 +00:00
|
|
|
|
}
|
2024-01-25 07:36:45 +00:00
|
|
|
|
};
|
2023-12-17 13:22:21 +00:00
|
|
|
|
|
2023-12-17 21:28:57 +00:00
|
|
|
|
const CustomInput = ({ title, desc, Icon, onChange }: any) => {
|
2024-01-30 16:49:33 +00:00
|
|
|
|
const theme = useTheme();
|
2024-02-05 10:10:02 +00:00
|
|
|
|
const isMobile = useRootContainerSize() < 600;
|
2024-01-31 12:57:07 +00:00
|
|
|
|
//@ts-ignore
|
2024-01-30 16:49:33 +00:00
|
|
|
|
return (
|
|
|
|
|
<Box m="15px 0">
|
2024-01-31 12:57:07 +00:00
|
|
|
|
<Typography mb="7px" color={theme.palette.text.primary}>
|
|
|
|
|
{title}
|
|
|
|
|
</Typography>
|
2024-01-30 16:49:33 +00:00
|
|
|
|
|
|
|
|
|
<TextField
|
|
|
|
|
onChange={onChange}
|
|
|
|
|
sx={{
|
|
|
|
|
width: isMobile ? "300px" : "350px",
|
|
|
|
|
}}
|
|
|
|
|
placeholder={desc}
|
|
|
|
|
InputProps={{
|
2024-01-31 12:57:07 +00:00
|
|
|
|
startAdornment: (
|
|
|
|
|
<InputAdornment position="start">
|
|
|
|
|
<Icon color="gray" />
|
|
|
|
|
</InputAdornment>
|
|
|
|
|
),
|
2024-01-30 16:49:33 +00:00
|
|
|
|
}}
|
|
|
|
|
/>
|
|
|
|
|
</Box>
|
2024-01-31 12:57:07 +00:00
|
|
|
|
);
|
2024-01-25 07:36:45 +00:00
|
|
|
|
};
|