символы в пароле, ограничения для инпутов, округление цены, запрос вопросов в заявках вернулся
This commit is contained in:
parent
e191955adb
commit
698ca3a051
@ -48,9 +48,9 @@ function getAnswerResultList(resultId: number) {
|
||||
});
|
||||
}
|
||||
|
||||
function AnswerResultListEx(quizId: number, body:any) {
|
||||
function AnswerResultListEx(quizId: number, body: any) {
|
||||
return makeRequest<unknown, unknown>({
|
||||
responseType: 'blob',
|
||||
responseType: "blob",
|
||||
url: process.env.REACT_APP_DOMAIN + `/squiz/results/${quizId}/export`,
|
||||
method: "POST",
|
||||
body: body,
|
||||
|
@ -98,6 +98,7 @@ export default function SettingOptionsAndPict({
|
||||
width: "100%",
|
||||
mr: isMobile ? "0px" : "16px",
|
||||
}}
|
||||
maxLength={60}
|
||||
placeholder={"Пример текста"}
|
||||
text={question.content.replText}
|
||||
onChange={({ target }) => setReplText(target.value)}
|
||||
@ -182,6 +183,7 @@ export default function SettingOptionsAndPict({
|
||||
sx={{ maxWidth: "360px", width: "100%" }}
|
||||
placeholder={"Пример текста"}
|
||||
text={question.content.replText}
|
||||
maxLength={60}
|
||||
onChange={({ target }) => setReplText(target.value)}
|
||||
/>
|
||||
</>
|
||||
|
@ -46,7 +46,7 @@ export const Select = ({
|
||||
setActiveItem(activeItemIndex);
|
||||
}, [activeItemIndex]);
|
||||
useEffect(() => {
|
||||
if (data) setActiveItem(items.indexOf(data))
|
||||
if (data) setActiveItem(items.indexOf(data));
|
||||
}, [data]);
|
||||
|
||||
const handleChange = (event: SelectChangeEvent) => {
|
||||
|
@ -439,10 +439,16 @@ export const CardAnswer = ({
|
||||
p: "20px",
|
||||
}}
|
||||
>
|
||||
<Typography sx={{ fontSize: "18px", fontWeight: "500" }}>
|
||||
<Typography
|
||||
sx={{
|
||||
fontSize: "18px",
|
||||
fontWeight: "500",
|
||||
wordBreak: "break-word",
|
||||
}}
|
||||
>
|
||||
{res.description || "нет заголовка"}
|
||||
</Typography>
|
||||
<Typography sx={{ fontSize: "18px" }}>
|
||||
<Typography sx={{ fontSize: "18px", wordBreak: "break-word" }}>
|
||||
{res.title || "нет текста"}
|
||||
</Typography>
|
||||
<img
|
||||
|
@ -31,6 +31,7 @@ import { setQuizes } from "@root/quizes/actions";
|
||||
import { useCurrentQuiz, useQuizes } from "@root/quizes/hooks";
|
||||
import { useQuizStore } from "@root/quizes/store";
|
||||
import { questionApi } from "@api/question";
|
||||
import { setQuestions } from "@root/questions/actions";
|
||||
|
||||
const itemsCities = [
|
||||
{ label: "Муром (1)", value: "option1" },
|
||||
@ -45,7 +46,7 @@ const itemsTime = [
|
||||
"Последние 30 дней",
|
||||
"Этот месяц",
|
||||
];
|
||||
const itemsNews = ["Все заявки", "Новые"]
|
||||
const itemsNews = ["Все заявки", "Новые"];
|
||||
|
||||
const resetTime = () => {
|
||||
return Math.round(Number(moment().format("X")) / 86400 - 1) * 86400 - 0;
|
||||
@ -57,16 +58,16 @@ export const QuizAnswersPage: FC = () => {
|
||||
const isMobile = useMediaQuery(theme.breakpoints.down(600));
|
||||
|
||||
const [filterModalOpen, setFilterModalOpen] = useState<boolean>(false);
|
||||
const [exportContactsModalOpen, setExportContactsModalOpen] = useState<boolean>(false);
|
||||
const [exportContactsModalOpen, setExportContactsModalOpen] =
|
||||
useState<boolean>(false);
|
||||
const [filterNew, setFilterNew] = useState<string>("Все заявки");
|
||||
const [filterDate, setFilterDate] = useState<string>("За всё время");
|
||||
const filterNewHC = (value: string) => {
|
||||
setFilterNew(value)
|
||||
|
||||
}
|
||||
setFilterNew(value);
|
||||
};
|
||||
const filterDateHC = (value: string) => {
|
||||
setFilterDate(value)
|
||||
}
|
||||
setFilterDate(value);
|
||||
};
|
||||
|
||||
const quizList = useQuizStore();
|
||||
const quiz = useCurrentQuiz();
|
||||
@ -75,7 +76,6 @@ export const QuizAnswersPage: FC = () => {
|
||||
const { total_count } = useResultStore();
|
||||
// const {idResultArray, addIdResult, clearIdResultArray} = useObsolescenceIdResult()
|
||||
useEffect(() => {
|
||||
|
||||
getData();
|
||||
}, [filterNew, filterDate]);
|
||||
|
||||
@ -101,31 +101,40 @@ export const QuizAnswersPage: FC = () => {
|
||||
return timeResult;
|
||||
};
|
||||
const parseFilters = () => {
|
||||
const filters: any = {}
|
||||
const filters: any = {};
|
||||
|
||||
if (filterNew === "Новые") filters.new = true
|
||||
if (filterNew === "Новые") filters.new = true;
|
||||
if (filterDate.length !== 0 && filterDate !== "За всё время") {
|
||||
console.log(filterDate)
|
||||
console.log(filterDate);
|
||||
|
||||
filters.to = new Date
|
||||
filters.to = new Date();
|
||||
|
||||
let resetedCurrentTime = Number(resetTime())
|
||||
if (filterDate === "Сегодня") filters.from = moment.unix(resetedCurrentTime)._d
|
||||
if (filterDate === "Вчера") filters.from = moment.unix(resetedCurrentTime - 86400)._d
|
||||
if (filterDate === "Последние 7 дней") filters.from = moment.unix(resetedCurrentTime - 604800)._d
|
||||
if (filterDate === "Последние 30 дней") filters.from = moment.unix(resetedCurrentTime - 2592000)._d
|
||||
let resetedCurrentTime = Number(resetTime());
|
||||
if (filterDate === "Сегодня")
|
||||
filters.from = moment.unix(resetedCurrentTime)._d;
|
||||
if (filterDate === "Вчера")
|
||||
filters.from = moment.unix(resetedCurrentTime - 86400)._d;
|
||||
if (filterDate === "Последние 7 дней")
|
||||
filters.from = moment.unix(resetedCurrentTime - 604800)._d;
|
||||
if (filterDate === "Последние 30 дней")
|
||||
filters.from = moment.unix(resetedCurrentTime - 2592000)._d;
|
||||
if (filterDate === "Этот месяц") {
|
||||
let date = new Date(), y = date.getFullYear(), m = date.getMonth();
|
||||
filters.from = new Date(y, m, 1)
|
||||
let date = new Date(),
|
||||
y = date.getFullYear(),
|
||||
m = date.getMonth();
|
||||
filters.from = new Date(y, m, 1);
|
||||
}
|
||||
}
|
||||
return filters
|
||||
}
|
||||
return filters;
|
||||
};
|
||||
const getData = async () => {
|
||||
if (editQuizId !== null) {
|
||||
const quizes = await quizApi.getList();
|
||||
setQuizes(quizes);
|
||||
|
||||
const questions = await questionApi.getList({ quiz_id: editQuizId });
|
||||
setQuestions(questions);
|
||||
|
||||
const result = await resultApi.getList(editQuizId, parseFilters());
|
||||
setResults(result);
|
||||
}
|
||||
@ -144,7 +153,13 @@ export const QuizAnswersPage: FC = () => {
|
||||
maxWidth="lg"
|
||||
>
|
||||
<Typography
|
||||
sx={{ fontSize: "36px", fontWeight: "500", mb: "50px", mt: "60px" }}
|
||||
sx={{
|
||||
fontSize: "36px",
|
||||
fontWeight: "500",
|
||||
mb: "50px",
|
||||
mt: "60px",
|
||||
lineHeight: "normal",
|
||||
}}
|
||||
>
|
||||
{quiz.name}
|
||||
</Typography>
|
||||
@ -180,15 +195,17 @@ export const QuizAnswersPage: FC = () => {
|
||||
<Box sx={{ display: "flex", alignItems: "center", gap: "10px" }}>
|
||||
<IconButton
|
||||
onClick={async () => {
|
||||
const data = await resultApi.export(editQuizId, parseFilters())
|
||||
console.log(typeof data)
|
||||
const data = await resultApi.export(
|
||||
editQuizId,
|
||||
parseFilters(),
|
||||
);
|
||||
console.log(typeof data);
|
||||
|
||||
const blob = data;
|
||||
const blob = data;
|
||||
const link = document.createElement("a");
|
||||
link.href = window.URL.createObjectURL(blob);
|
||||
link.download = `report_${new Date().getTime()}.xlsx`;
|
||||
link.click();
|
||||
|
||||
}}
|
||||
sx={{
|
||||
width: "44px",
|
||||
@ -207,7 +224,10 @@ const blob = data;
|
||||
border: "1px solid #7E2AEA",
|
||||
}}
|
||||
onClick={async () => {
|
||||
const result = await resultApi.getList(editQuizId, parseFilters());
|
||||
const result = await resultApi.getList(
|
||||
editQuizId,
|
||||
parseFilters(),
|
||||
);
|
||||
console.log(result);
|
||||
setResults(result);
|
||||
}}
|
||||
|
@ -258,7 +258,7 @@ function TariffPage() {
|
||||
component="h2"
|
||||
mb="20px"
|
||||
>
|
||||
Вы подтверждаете платёж в сумму {openModal.price} ₽
|
||||
Вы подтверждаете платёж в сумму {openModal.price}
|
||||
</Typography>
|
||||
<Button variant="contained" onClick={() => tryBuy(openModal)}>
|
||||
купить
|
||||
|
@ -47,7 +47,10 @@ export const createTariffElements = (
|
||||
buttonProps={{
|
||||
text: "Выбрать",
|
||||
onClick: () =>
|
||||
onclick({ id: tariff._id, price: priceAfterDiscounts / 100 }),
|
||||
onclick({
|
||||
id: tariff._id,
|
||||
price: currencyFormatter.format(priceAfterDiscounts / 100),
|
||||
}),
|
||||
}}
|
||||
headerText={tariff.name}
|
||||
text={tariff.privileges.map((p) => `${p.name} - ${p.amount}`)}
|
||||
|
@ -281,6 +281,8 @@ export const StartPageViewPublication = ({ setVisualStartPage }: Props) => {
|
||||
overflowWrap: "break-word",
|
||||
fontSize: "12px",
|
||||
textAlign: isTablet ? "start" : "end",
|
||||
maxHeight: "120px",
|
||||
overflow: "auto",
|
||||
color:
|
||||
quiz.config.startpageType === "expanded" && !isMobile
|
||||
? "white"
|
||||
@ -371,6 +373,8 @@ function QuizPreviewLayoutByType({
|
||||
alignItems: "flex-start",
|
||||
p: "25px",
|
||||
height: "80%",
|
||||
overflowY: "auto",
|
||||
overflowX: "hidden",
|
||||
}}
|
||||
>
|
||||
{quizHeaderBlock}
|
||||
|
@ -149,6 +149,12 @@ export const Varimg = ({ currentQuestion }: VarimgProps) => {
|
||||
style={{ width: "100%", height: "100%", objectFit: "cover" }}
|
||||
alt=""
|
||||
/>
|
||||
) : currentQuestion.content.back !== " " ? (
|
||||
<img
|
||||
src={currentQuestion.content.back || gag}
|
||||
style={{ width: "100%", height: "100%", objectFit: "cover" }}
|
||||
alt=""
|
||||
/>
|
||||
) : currentQuestion.content.replText !== " " &&
|
||||
currentQuestion.content.replText.length > 0 ? (
|
||||
currentQuestion.content.replText
|
||||
|
@ -39,7 +39,7 @@ const validationSchema = object({
|
||||
password: string()
|
||||
.min(8, "Минимум 8 символов")
|
||||
.matches(
|
||||
/^[.,:;\-_+!&()<>\[\]\{\}`@"#$\%\^\=?\d\w]+$/,
|
||||
/^[.,:;\-_+!&()<>\[\]{}№`@"~*|#$%^=?\d\w]+$/,
|
||||
"Некорректные символы",
|
||||
)
|
||||
.required("Поле обязательно"),
|
||||
|
@ -35,7 +35,7 @@ export const FilterModal: FC<Iprops> = ({
|
||||
setFilterNew,
|
||||
setFilterDate,
|
||||
itemsTime,
|
||||
itemsNews
|
||||
itemsNews,
|
||||
}) => {
|
||||
const theme = useTheme();
|
||||
const isMobile = useMediaQuery(theme.breakpoints.down(650));
|
||||
|
Loading…
Reference in New Issue
Block a user