Merge branch 'dev' into 'staging'
Dev See merge request frontend/squiz!342
This commit is contained in:
commit
2cb1aff63a
@ -11,19 +11,20 @@ const API_URL = `${process.env.REACT_APP_DOMAIN}/squiz/amocrm`;
|
|||||||
// получение информации об аккаунте
|
// получение информации об аккаунте
|
||||||
|
|
||||||
export type AccountResponse = {
|
export type AccountResponse = {
|
||||||
ID: number;
|
id: number;
|
||||||
AmoUserID: number;
|
accountID: string;
|
||||||
AccountID: string;
|
amoID: number;
|
||||||
AmoID: number;
|
name: string;
|
||||||
Name: string;
|
deleted: boolean;
|
||||||
Email: string;
|
createdAt: string;
|
||||||
Role: string;
|
subdomain: string;
|
||||||
Group: number;
|
country: string;
|
||||||
Deleted: boolean;
|
driveURL: string;
|
||||||
CreatedAt: number;
|
// AmoUiserid: number;
|
||||||
Subdomain: string;
|
// Email: string;
|
||||||
Amoiserid: number;
|
// Role: string;
|
||||||
Country: string;
|
// Group: number;
|
||||||
|
// AmoUserID: number;
|
||||||
};
|
};
|
||||||
|
|
||||||
export const getAccount = async (): Promise<
|
export const getAccount = async (): Promise<
|
||||||
@ -117,18 +118,18 @@ export const getTags = async ({
|
|||||||
//получение списка пользователей
|
//получение списка пользователей
|
||||||
|
|
||||||
export type User = {
|
export type User = {
|
||||||
ID: number;
|
id: number;
|
||||||
AccountID: string;
|
amoID: number;
|
||||||
AmoID: number;
|
name: string;
|
||||||
Name: string;
|
email: string;
|
||||||
Email: string;
|
role: number;
|
||||||
Role: string;
|
group: number;
|
||||||
Group: number;
|
deleted: boolean;
|
||||||
Deleted: boolean;
|
createdAt: string;
|
||||||
CreatedAt: number;
|
amoUserID: number;
|
||||||
Subdomain: string;
|
|
||||||
Amoiserid: number;
|
// Subdomain: string;
|
||||||
Country: string;
|
// AccountID: string;
|
||||||
};
|
};
|
||||||
|
|
||||||
export type UsersResponse = {
|
export type UsersResponse = {
|
||||||
@ -229,23 +230,35 @@ export const getPipelines = async ({
|
|||||||
};
|
};
|
||||||
|
|
||||||
//получение настроек интеграции
|
//получение настроек интеграции
|
||||||
|
type QuestionID = Record<string, number>
|
||||||
|
|
||||||
export type IntegrationRules = {
|
export type IntegrationRules = {
|
||||||
ID: number;
|
|
||||||
AccountID: number;
|
|
||||||
QuizID: number;
|
|
||||||
PerformerID: number;
|
|
||||||
PipelineID: number;
|
PipelineID: number;
|
||||||
StepID: number;
|
StepID: number;
|
||||||
UTMs: number[];
|
PerformerID?: number;
|
||||||
FieldsRule: {
|
FieldsRule: {
|
||||||
Lead: { QuestionID: number }[];
|
Lead: [
|
||||||
Contact: { ContactRuleMap: string }[];
|
{
|
||||||
Company: { QuestionID: number }[];
|
QuestionID: QuestionID;
|
||||||
Customer: { QuestionID: number }[];
|
}
|
||||||
|
] | null,
|
||||||
|
Company: [
|
||||||
|
{
|
||||||
|
QuestionID: QuestionID;
|
||||||
|
}
|
||||||
|
] | null,
|
||||||
|
Customer: [
|
||||||
|
{
|
||||||
|
QuestionID: QuestionID;
|
||||||
|
}
|
||||||
|
] | null,
|
||||||
};
|
};
|
||||||
Deleted: boolean;
|
TagsToAdd: {
|
||||||
CreatedAt: number;
|
Lead: number[] | null;
|
||||||
|
Contact: number[] | null;
|
||||||
|
Company: number[] | null;
|
||||||
|
Customer: number[] | null;
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
export const getIntegrationRules = async (
|
export const getIntegrationRules = async (
|
||||||
|
@ -54,8 +54,6 @@ export const CustomRadioGroup: FC<CustomRadioGroupProps> = ({
|
|||||||
const boxRef = useRef(null);
|
const boxRef = useRef(null);
|
||||||
|
|
||||||
const handleChange = (event: React.ChangeEvent<HTMLInputElement>) => {
|
const handleChange = (event: React.ChangeEvent<HTMLInputElement>) => {
|
||||||
console.log("применился хенделчейндж")
|
|
||||||
console.log((event.target as HTMLInputElement).value)
|
|
||||||
setSelectedValue((event.target as HTMLInputElement).value);
|
setSelectedValue((event.target as HTMLInputElement).value);
|
||||||
setCurrentValue((event.target as HTMLInputElement).value);
|
setCurrentValue((event.target as HTMLInputElement).value);
|
||||||
};
|
};
|
||||||
@ -70,9 +68,6 @@ export const CustomRadioGroup: FC<CustomRadioGroupProps> = ({
|
|||||||
setPage((prevPage) => prevPage + 1);
|
setPage((prevPage) => prevPage + 1);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
console.log(type)
|
|
||||||
console.log(items)
|
|
||||||
console.log(type === "typeQuestions" && items && items.length !== 0)
|
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (type === "typeTags" && hasMoreItems && setTags !== undefined) {
|
if (type === "typeTags" && hasMoreItems && setTags !== undefined) {
|
||||||
@ -315,9 +310,6 @@ export const CustomRadioGroup: FC<CustomRadioGroupProps> = ({
|
|||||||
name="controlled-radio-buttons-group"
|
name="controlled-radio-buttons-group"
|
||||||
value={currentValue}
|
value={currentValue}
|
||||||
onChange={(e) => {
|
onChange={(e) => {
|
||||||
console.log("klick")
|
|
||||||
console.log(e.target.value)
|
|
||||||
console.log(typeof e.target.value)
|
|
||||||
handleChange(e)
|
handleChange(e)
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
|
@ -39,14 +39,16 @@ export const CustomSelect: FC<CustomSelectProps> = ({
|
|||||||
const selectWidth = ref.current ? ref.current.offsetWidth : undefined;
|
const selectWidth = ref.current ? ref.current.offsetWidth : undefined;
|
||||||
|
|
||||||
const [savedValue, setSavedValue] = useState<number | null>(null);
|
const [savedValue, setSavedValue] = useState<number | null>(null);
|
||||||
|
const [userName, setUserName] = useState<string>("");
|
||||||
|
|
||||||
const onSelectItem = useCallback(
|
const onSelectItem = useCallback(
|
||||||
(event: SelectChangeEvent<HTMLDivElement>) => {
|
(event: SelectChangeEvent<HTMLDivElement>) => {
|
||||||
const newValue = event.target.value.toString();
|
const newValue = event.target.value.toString();
|
||||||
const selectedUser = users.find((user) => user.Name === newValue);
|
const selectedUser = users.find((user) => user.amoUserID == Number(newValue));
|
||||||
|
setUserName(selectedUser.name)
|
||||||
if (selectedUser) {
|
if (selectedUser) {
|
||||||
//для сохранения ID выбранного пользователя в стейт или конфиг...
|
//для сохранения ID выбранного пользователя в стейт или конфиг...
|
||||||
setSavedValue(selectedUser.ID);
|
setSavedValue(selectedUser.id);
|
||||||
}
|
}
|
||||||
setCurrentValue(newValue);
|
setCurrentValue(newValue);
|
||||||
setSelectedItem(newValue);
|
setSelectedItem(newValue);
|
||||||
@ -90,12 +92,10 @@ export const CustomSelect: FC<CustomSelectProps> = ({
|
|||||||
|
|
||||||
const menuItems = useMemo(() => {
|
const menuItems = useMemo(() => {
|
||||||
if (type === "typeUsers" && users && users.length !== 0) {
|
if (type === "typeUsers" && users && users.length !== 0) {
|
||||||
console.log(type)
|
|
||||||
console.log(users)
|
|
||||||
return users.map((user) => (
|
return users.map((user) => (
|
||||||
<MenuItem
|
<MenuItem
|
||||||
key={user.ID}
|
key={user.amoUserID}
|
||||||
value={user.AmocrmID}
|
value={user.amoUserID}
|
||||||
sx={{
|
sx={{
|
||||||
padding: "6px 0",
|
padding: "6px 0",
|
||||||
zIndex: 2,
|
zIndex: 2,
|
||||||
@ -122,7 +122,7 @@ export const CustomSelect: FC<CustomSelectProps> = ({
|
|||||||
padding: isMobile ? "5px 0 5px 20px" : "10px 0 10px 20px",
|
padding: isMobile ? "5px 0 5px 20px" : "10px 0 10px 20px",
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
{user.Name}
|
{user.name}
|
||||||
</Typography>
|
</Typography>
|
||||||
<Typography
|
<Typography
|
||||||
sx={{
|
sx={{
|
||||||
@ -134,7 +134,7 @@ export const CustomSelect: FC<CustomSelectProps> = ({
|
|||||||
color: isMobile ? "#9A9AAF" : "#4D4D4D",
|
color: isMobile ? "#9A9AAF" : "#4D4D4D",
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
{user.Email}
|
{user.email}
|
||||||
</Typography>
|
</Typography>
|
||||||
<Typography
|
<Typography
|
||||||
sx={{
|
sx={{
|
||||||
@ -143,7 +143,7 @@ export const CustomSelect: FC<CustomSelectProps> = ({
|
|||||||
color: isMobile ? "#9A9AAF" : "#4D4D4D",
|
color: isMobile ? "#9A9AAF" : "#4D4D4D",
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
{user.Role}
|
{user.role}
|
||||||
</Typography>
|
</Typography>
|
||||||
</Box>
|
</Box>
|
||||||
</MenuItem>
|
</MenuItem>
|
||||||
@ -190,7 +190,7 @@ export const CustomSelect: FC<CustomSelectProps> = ({
|
|||||||
flexGrow: 1,
|
flexGrow: 1,
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
{currentValue || "Выберите ответственного за сделку"}
|
{userName || "Выберите ответственного за сделку"}
|
||||||
</Typography>
|
</Typography>
|
||||||
<img
|
<img
|
||||||
src={arrow_down}
|
src={arrow_down}
|
||||||
|
@ -71,12 +71,12 @@ export const AmoAccountInfo: FC<AmoAccountInfoProps> = ({
|
|||||||
gap: isMobile ? "10px" : "20px",
|
gap: isMobile ? "10px" : "20px",
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
{infoItem("Amo ID", accountInfo.AmoUserID)}
|
{infoItem("Amo ID", accountInfo.amoUserID)}
|
||||||
{infoItem("Имя аккаунта", accountInfo.Name)}
|
{infoItem("Имя аккаунта", accountInfo.name)}
|
||||||
{infoItem("Email аккаунта", accountInfo.Email)}
|
{infoItem("Email аккаунта", accountInfo.email)}
|
||||||
{infoItemLink("ЛК в amo", `https://${accountInfo.Subdomain}.amocrm.ru/dashboard/`)}
|
{infoItemLink("ЛК в amo", `https://${accountInfo.subdomain}.amocrm.ru/dashboard/`)}
|
||||||
{infoItemLink("Профиль пользователя в amo", `https://${accountInfo.Subdomain}.amocrm.ru/settings/users/`)}
|
{infoItemLink("Профиль пользователя в amo", `https://${accountInfo.subdomain}.amocrm.ru/settings/users/`)}
|
||||||
{infoItem("Страна пользователя", accountInfo.Country)}
|
{infoItem("Страна пользователя", accountInfo.country)}
|
||||||
</Box>
|
</Box>
|
||||||
<StepButtonsBlock
|
<StepButtonsBlock
|
||||||
isSmallBtnDisabled={true}
|
isSmallBtnDisabled={true}
|
||||||
|
@ -1,29 +1,32 @@
|
|||||||
|
import React, { FC, useEffect, useMemo, useState } from "react";
|
||||||
import {
|
import {
|
||||||
Dialog,
|
Dialog,
|
||||||
IconButton,
|
IconButton,
|
||||||
Typography,
|
Typography,
|
||||||
useMediaQuery,
|
useMediaQuery,
|
||||||
useTheme,
|
useTheme,
|
||||||
|
Box,
|
||||||
} from "@mui/material";
|
} from "@mui/material";
|
||||||
import React, { FC, useEffect, useMemo, useState } from "react";
|
|
||||||
import Box from "@mui/material/Box";
|
|
||||||
import CloseIcon from "@mui/icons-material/Close";
|
|
||||||
import { AmoRemoveAccount } from "./AmoRemoveAccount/AmoRemoveAccount";
|
|
||||||
import { AmoLogin } from "./AmoLogin/AmoLogin";
|
|
||||||
import { AmoStep2 } from "./AmoStep2/AmoStep2";
|
|
||||||
import { AmoStep3 } from "./AmoStep3/AmoStep3";
|
|
||||||
import { AmoStep4 } from "./AmoStep4/AmoStep4";
|
|
||||||
import { AmoStep6 } from "./IntegrationStep6/AmoStep6";
|
|
||||||
import { AmoStep7 } from "./IntegrationStep7/AmoStep7";
|
|
||||||
import { AmoModalTitle } from "./AmoModalTitle/AmoModalTitle";
|
|
||||||
import { AmoSettingsBlock } from "./SettingsBlock/AmoSettingsBlock";
|
|
||||||
import { AmoAccountInfo } from "./AmoAccountInfo/AmoAccountInfo";
|
|
||||||
import { AccountResponse, IntegrationRules, getAccount, getIntegrationRules, setIntegrationRules, updateIntegrationRules } from "@api/integration";
|
|
||||||
import { useQuestions } from "@/stores/questions/hooks";
|
import { useQuestions } from "@/stores/questions/hooks";
|
||||||
import { redirect } from "react-router-dom";
|
import { redirect } from "react-router-dom";
|
||||||
import { enqueueSnackbar } from "notistack";
|
import { enqueueSnackbar } from "notistack";
|
||||||
|
|
||||||
export type TitleKeys = "Contact" | "Company" | "Lead" | "Customer";
|
import CloseIcon from "@mui/icons-material/Close";
|
||||||
|
|
||||||
|
import { AmoRemoveAccount } from "./AmoRemoveAccount/AmoRemoveAccount";
|
||||||
|
import { AmoLogin } from "./AmoLogin/AmoLogin";
|
||||||
|
import { Pipelines } from "./Pipelines/Pipelines";
|
||||||
|
import { PipelineSteps } from "./PipelineSteps/PipelineSteps";
|
||||||
|
import { DealPerformers } from "./DealPerformers/DealPerformers";
|
||||||
|
import { AmoTags } from "./AmoTags/AmoTags";
|
||||||
|
import { AmoQuestions } from "./AmoQuestions/AmoQuestions";
|
||||||
|
import { AmoModalTitle } from "./AmoModalTitle/AmoModalTitle";
|
||||||
|
import { AmoSettingsBlock } from "./SettingsBlock/AmoSettingsBlock";
|
||||||
|
import { AmoAccountInfo } from "./AmoAccountInfo/AmoAccountInfo";
|
||||||
|
import { AccountResponse, IntegrationRules, Pipeline, Step, User, getAccount, getIntegrationRules, getPipelines, getSteps, getTags, getUsers, setIntegrationRules, updateIntegrationRules } from "@api/integration";
|
||||||
|
|
||||||
|
|
||||||
|
export type TitleKeys = "Company" | "Lead" | "Customer";
|
||||||
export type TagQuestionObject = {
|
export type TagQuestionObject = {
|
||||||
backendId: string;
|
backendId: string;
|
||||||
title: string;
|
title: string;
|
||||||
@ -57,22 +60,20 @@ export const AmoCRMModal: FC<IntegrationsModalProps> = ({
|
|||||||
const [isRemoveAccount, setIsRemoveAccount] = useState<boolean>(false);
|
const [isRemoveAccount, setIsRemoveAccount] = useState<boolean>(false);
|
||||||
|
|
||||||
const [firstRules, setFirstRules] = useState<boolean>(false);
|
const [firstRules, setFirstRules] = useState<boolean>(false);
|
||||||
|
|
||||||
const [accountInfo, setAccountInfo] = useState<AccountResponse | null>(null);
|
const [accountInfo, setAccountInfo] = useState<AccountResponse | null>(null);
|
||||||
const [selectedPipelinePerformer, setSelectedPipelinePerformer] = useState<
|
|
||||||
string | null
|
const [arrayOfPipelines, setArrayOfPipelines] = useState<Pipeline[]>([]);
|
||||||
>(null);
|
const [arrayOfPipelinesSteps, setArrayOfPipelinesSteps] = useState<Step[]>([]);
|
||||||
const [selectedPipeline, setSelectedPipeline] = useState<string | null>(null);
|
const [arrayOfUsers, setArrayOfUsers] = useState<User[]>([]);
|
||||||
const [selectedStepsPerformer, setSelectedStepsPerformer] = useState<
|
const [arrayOfTags, setArrayOfTags] = useState<TTags[]>([]);
|
||||||
string | null
|
|
||||||
>(null);
|
const [selectedPipeline, setSelectedPipeline] = useState<number | null>(null);
|
||||||
const [selectedStep, setSelectedStep] = useState<string | null>(null);
|
const [selectedPipelineStep, setSelectedPipelineStep] = useState<number | null>(null);
|
||||||
const [selectedDealPerformer, setSelectedDealPerformer] = useState<
|
const [selectedDealPerformer, setSelectedDealPerformer] = useState<number | null>(null);
|
||||||
string | null
|
|
||||||
>(null);
|
const [questionEntityBackend, setQuestionEntityBackend] = useState<TQuestionEntity>({});
|
||||||
const [questionEntity, setQuestionEntity] = useState<TQuestionEntity>({
|
const [questionEntity, setQuestionEntity] = useState<TQuestionEntity>({
|
||||||
Lead: [],
|
Lead: [],
|
||||||
Contact: [],
|
|
||||||
Company: [],
|
Company: [],
|
||||||
Customer: [],
|
Customer: [],
|
||||||
});
|
});
|
||||||
@ -82,8 +83,6 @@ export const AmoCRMModal: FC<IntegrationsModalProps> = ({
|
|||||||
Company: [],
|
Company: [],
|
||||||
Customer: [],
|
Customer: [],
|
||||||
});
|
});
|
||||||
console.log(questionEntity)
|
|
||||||
console.log(tags)
|
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (isModalOpen && quizID !== undefined && !isRemoveAccount) {
|
if (isModalOpen && quizID !== undefined && !isRemoveAccount) {
|
||||||
@ -106,16 +105,78 @@ export const AmoCRMModal: FC<IntegrationsModalProps> = ({
|
|||||||
if (!error.includes("Not Found") && !error.includes("first")) enqueueSnackbar(error);
|
if (!error.includes("Not Found") && !error.includes("first")) enqueueSnackbar(error);
|
||||||
}
|
}
|
||||||
if (settingsResponse) {
|
if (settingsResponse) {
|
||||||
console.log(settingsResponse);
|
if (settingsResponse.PipelineID) setSelectedPipeline(settingsResponse.PipelineID)
|
||||||
setFirstRules(false);
|
if (settingsResponse.StepID) setSelectedPipelineStep(settingsResponse.StepID)
|
||||||
|
if (settingsResponse.PerformerID) setSelectedDealPerformer(settingsResponse.PerformerID)
|
||||||
|
if (Boolean(settingsResponse.FieldsRule) &&
|
||||||
|
Object.keys(settingsResponse.FieldsRule).length > 0) {
|
||||||
|
const newRules = { ...questionEntity }
|
||||||
|
setQuestionEntityBackend(settingsResponse.FieldsRule)
|
||||||
|
for (let key in settingsResponse.FieldsRule) {
|
||||||
|
if (settingsResponse.FieldsRule[key] !== null && Array.isArray(settingsResponse.FieldsRule[key])) {
|
||||||
|
const gottenList = Object.keys(settingsResponse.FieldsRule[key][0].QuestionID)
|
||||||
|
newRules[key] = gottenList
|
||||||
|
}
|
||||||
|
}
|
||||||
|
setQuestionEntity(newRules)
|
||||||
|
}
|
||||||
|
if (Boolean(settingsResponse.TagsToAdd) &&
|
||||||
|
Object.keys(settingsResponse.TagsToAdd).length > 0) {
|
||||||
|
const newRules = { ...tags }
|
||||||
|
for (let key in settingsResponse.TagsToAdd) {
|
||||||
|
const gottenList = settingsResponse.TagsToAdd[key]
|
||||||
|
if (gottenList !== null && Array.isArray(gottenList)) {
|
||||||
|
newRules[key] = gottenList
|
||||||
|
}
|
||||||
|
}
|
||||||
|
setTags(newRules)
|
||||||
|
}
|
||||||
|
setFirstRules(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
getTags({
|
||||||
|
page: 1,
|
||||||
|
size: 9999,
|
||||||
|
}).then(([response]) => {
|
||||||
|
if (response && response.items !== null) {
|
||||||
|
setArrayOfTags(response.items);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
getUsers({
|
||||||
|
page: 1,
|
||||||
|
size: 9999,
|
||||||
|
}).then(([response]) => {
|
||||||
|
if (response && response.items !== null) {
|
||||||
|
setArrayOfUsers(response.items);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
getPipelines({
|
||||||
|
page: 1,
|
||||||
|
size: 9999,
|
||||||
|
}).then(([response]) => {
|
||||||
|
if (response && response.items !== null) {
|
||||||
|
setArrayOfPipelines(response.items);
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
fetchAccount();
|
fetchAccount();
|
||||||
fetchRules();
|
fetchRules();
|
||||||
}
|
}
|
||||||
}, [isModalOpen, isRemoveAccount]);
|
}, [isModalOpen, isRemoveAccount]);
|
||||||
|
useEffect(() => {
|
||||||
|
if (selectedPipeline !== null)
|
||||||
|
getSteps({
|
||||||
|
page: 1,
|
||||||
|
size: 9999,
|
||||||
|
pipelineId: selectedPipeline,
|
||||||
|
}).then(([response]) => {
|
||||||
|
if (response && response.items !== null) {
|
||||||
|
setArrayOfPipelinesSteps(response.items);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}, [selectedPipeline])
|
||||||
|
|
||||||
const handleNextStep = () => {
|
const handleNextStep = () => {
|
||||||
setStep((prevState) => prevState + 1);
|
setStep((prevState) => prevState + 1);
|
||||||
@ -126,51 +187,47 @@ export const AmoCRMModal: FC<IntegrationsModalProps> = ({
|
|||||||
const handleSave = () => {
|
const handleSave = () => {
|
||||||
console.log("На отправку")
|
console.log("На отправку")
|
||||||
console.log({
|
console.log({
|
||||||
PerformerID: selectedDealPerformer,
|
PipelineID: Number(selectedPipeline),
|
||||||
PipelineID: selectedPipeline,
|
StepID: Number(selectedPipelineStep),
|
||||||
StepID: selectedStep,
|
PerformerID: Number(selectedDealPerformer),
|
||||||
Fieldsrule: {
|
FieldsRule: questionEntity,
|
||||||
...questionEntity
|
TagsToAdd: tags
|
||||||
},
|
})
|
||||||
TagsToAdd: {
|
if (quizID === undefined) return
|
||||||
...tags
|
if (selectedPipeline === null) return enqueueSnackbar("Выберите воронку")
|
||||||
}
|
if (selectedPipeline === null) return enqueueSnackbar("Выберите этап воронки")
|
||||||
})
|
|
||||||
if (quizID === undefined) return
|
|
||||||
if (selectedPipeline?.toString().length === 0) return enqueueSnackbar("Выберите воронку")
|
|
||||||
if (selectedPipeline?.toString().length === 0) return enqueueSnackbar("Выберите этап воронки")
|
|
||||||
|
|
||||||
if (firstRules) {
|
const body = {
|
||||||
setIntegrationRules(quizID.toString(), {
|
PipelineID: Number(selectedPipeline),
|
||||||
PerformerID: Number(selectedDealPerformer),
|
StepID: Number(selectedPipelineStep),
|
||||||
PipelineID: Number(selectedPipeline),
|
PerformerID: Number(selectedDealPerformer),
|
||||||
StepID: Number(selectedStep),
|
FieldsRule: questionEntityBackend,
|
||||||
Fieldsrule: {
|
TagsToAdd: tags
|
||||||
...questionEntity
|
|
||||||
},
|
|
||||||
TagsToAdd: {
|
|
||||||
...tags
|
|
||||||
}
|
|
||||||
})
|
|
||||||
} else {
|
|
||||||
const body = {
|
|
||||||
|
|
||||||
Fieldsrule: {
|
|
||||||
...questionEntity
|
|
||||||
},
|
|
||||||
TagsToAdd: {
|
|
||||||
...tags
|
|
||||||
}
|
|
||||||
};
|
|
||||||
if (selectedDealPerformer?.toString() > 0) body.PerformerID = Number(selectedDealPerformer)
|
|
||||||
if (selectedPipeline?.toString() > 0) body.PipelineID = Number(selectedPipeline)
|
|
||||||
if (selectedStep?.toString() > 0) body.StepID = Number(selectedStep)
|
|
||||||
|
|
||||||
updateIntegrationRules(quizID.toString(), body)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// handleCloseModal();
|
|
||||||
// setStep(1);
|
for (let key in questionEntityBackend) {
|
||||||
|
if (key !== "Contact") {
|
||||||
|
|
||||||
|
if (body.FieldsRule[key] === null) body.FieldsRule[key] = [{ "QuestionID": {} }]
|
||||||
|
console.log(key)
|
||||||
|
console.log(questionEntity)
|
||||||
|
questionEntity[key].forEach((id) => {
|
||||||
|
body.FieldsRule[key][0].QuestionID[id] = 0
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
console.log(body)
|
||||||
|
|
||||||
|
if (firstRules) {
|
||||||
|
setIntegrationRules(quizID.toString(), body)
|
||||||
|
} else {
|
||||||
|
updateIntegrationRules(quizID.toString(), body)
|
||||||
|
}
|
||||||
|
|
||||||
|
handleCloseModal();
|
||||||
|
setStep(1);
|
||||||
};
|
};
|
||||||
const steps = useMemo(
|
const steps = useMemo(
|
||||||
() => [
|
() => [
|
||||||
@ -192,12 +249,11 @@ export const AmoCRMModal: FC<IntegrationsModalProps> = ({
|
|||||||
title: "Выбор воронки",
|
title: "Выбор воронки",
|
||||||
isSettingsAvailable: true,
|
isSettingsAvailable: true,
|
||||||
component: (
|
component: (
|
||||||
<AmoStep2
|
<Pipelines
|
||||||
handlePrevStep={handlePrevStep}
|
handlePrevStep={handlePrevStep}
|
||||||
handleNextStep={handleNextStep}
|
handleNextStep={handleNextStep}
|
||||||
selectedPipelinePerformer={selectedDealPerformer}
|
selectedPipelinePerformer={selectedDealPerformer}
|
||||||
setSelectedPipelinePerformer={setSelectedDealPerformer}
|
setSelectedPipelinePerformer={setSelectedDealPerformer}
|
||||||
setSelectedDealPerformer={setSelectedDealPerformer}
|
|
||||||
selectedPipeline={selectedPipeline}
|
selectedPipeline={selectedPipeline}
|
||||||
setSelectedPipeline={setSelectedPipeline}
|
setSelectedPipeline={setSelectedPipeline}
|
||||||
/>
|
/>
|
||||||
@ -207,13 +263,13 @@ export const AmoCRMModal: FC<IntegrationsModalProps> = ({
|
|||||||
title: "Выбор этапа воронки",
|
title: "Выбор этапа воронки",
|
||||||
isSettingsAvailable: true,
|
isSettingsAvailable: true,
|
||||||
component: (
|
component: (
|
||||||
<AmoStep3
|
<PipelineSteps
|
||||||
handlePrevStep={handlePrevStep}
|
handlePrevStep={handlePrevStep}
|
||||||
handleNextStep={handleNextStep}
|
handleNextStep={handleNextStep}
|
||||||
selectedStepsPerformer={selectedDealPerformer}
|
selectedStepsPerformer={selectedDealPerformer}
|
||||||
setSelectedStepsPerformer={setSelectedDealPerformer}
|
setSelectedStepsPerformer={setSelectedDealPerformer}
|
||||||
selectedStep={selectedStep}
|
selectedStep={selectedPipelineStep}
|
||||||
setSelectedStep={setSelectedStep}
|
setSelectedStep={setSelectedPipelineStep}
|
||||||
pipelineId={selectedPipeline}
|
pipelineId={selectedPipeline}
|
||||||
/>
|
/>
|
||||||
),
|
),
|
||||||
@ -222,7 +278,7 @@ export const AmoCRMModal: FC<IntegrationsModalProps> = ({
|
|||||||
title: "Сделка",
|
title: "Сделка",
|
||||||
isSettingsAvailable: true,
|
isSettingsAvailable: true,
|
||||||
component: (
|
component: (
|
||||||
<AmoStep4
|
<DealPerformers
|
||||||
handlePrevStep={handlePrevStep}
|
handlePrevStep={handlePrevStep}
|
||||||
handleNextStep={handleNextStep}
|
handleNextStep={handleNextStep}
|
||||||
selectedDealPerformer={selectedDealPerformer}
|
selectedDealPerformer={selectedDealPerformer}
|
||||||
@ -234,11 +290,12 @@ export const AmoCRMModal: FC<IntegrationsModalProps> = ({
|
|||||||
title: "Добавление тегов",
|
title: "Добавление тегов",
|
||||||
isSettingsAvailable: true,
|
isSettingsAvailable: true,
|
||||||
component: (
|
component: (
|
||||||
<AmoStep6
|
<AmoTags
|
||||||
tagsNames={tags}
|
tagsNames={tags}
|
||||||
handlePrevStep={handlePrevStep}
|
handlePrevStep={handlePrevStep}
|
||||||
handleNextStep={handleNextStep}
|
handleNextStep={handleNextStep}
|
||||||
setTagsNames={setTags}
|
setIdTags={setTags}
|
||||||
|
arrayOfTags={arrayOfTags}
|
||||||
/>
|
/>
|
||||||
),
|
),
|
||||||
},
|
},
|
||||||
@ -246,7 +303,7 @@ export const AmoCRMModal: FC<IntegrationsModalProps> = ({
|
|||||||
title: "Соотнесение вопросов и сущностей",
|
title: "Соотнесение вопросов и сущностей",
|
||||||
isSettingsAvailable: true,
|
isSettingsAvailable: true,
|
||||||
component: (
|
component: (
|
||||||
<AmoStep7
|
<AmoQuestions
|
||||||
questionEntity={questionEntity}
|
questionEntity={questionEntity}
|
||||||
setQuestionEntity={setQuestionEntity}
|
setQuestionEntity={setQuestionEntity}
|
||||||
handlePrevStep={handlePrevStep}
|
handlePrevStep={handlePrevStep}
|
||||||
@ -259,10 +316,8 @@ export const AmoCRMModal: FC<IntegrationsModalProps> = ({
|
|||||||
[
|
[
|
||||||
accountInfo,
|
accountInfo,
|
||||||
questionEntity,
|
questionEntity,
|
||||||
selectedPipelinePerformer,
|
|
||||||
selectedPipeline,
|
selectedPipeline,
|
||||||
selectedStepsPerformer,
|
selectedPipelineStep,
|
||||||
selectedStep,
|
|
||||||
selectedDealPerformer,
|
selectedDealPerformer,
|
||||||
tags,
|
tags,
|
||||||
],
|
],
|
||||||
@ -271,7 +326,7 @@ export const AmoCRMModal: FC<IntegrationsModalProps> = ({
|
|||||||
const stepTitles = steps.map((step) => step.title);
|
const stepTitles = steps.map((step) => step.title);
|
||||||
|
|
||||||
//Если нет контекста квиза, то и делать на этой страничке нечего
|
//Если нет контекста квиза, то и делать на этой страничке нечего
|
||||||
if (quizID === undefined) redirect("/list")
|
if (quizID === undefined) return redirect("/list")
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Dialog
|
<Dialog
|
||||||
@ -348,11 +403,9 @@ export const AmoCRMModal: FC<IntegrationsModalProps> = ({
|
|||||||
stepTitles={stepTitles}
|
stepTitles={stepTitles}
|
||||||
setIsSettingsBlock={setIsSettingsBlock}
|
setIsSettingsBlock={setIsSettingsBlock}
|
||||||
setStep={setStep}
|
setStep={setStep}
|
||||||
selectedDealPerformer={selectedDealPerformer}
|
selectedDealPerformer={arrayOfUsers.find(p => p.amoUserID == selectedDealPerformer)?.name || null}
|
||||||
selectedFunnelPerformer={selectedPipelinePerformer}
|
selectedFunnel={arrayOfPipelines.find(p => selectedPipeline)?.Name || null}
|
||||||
selectedFunnel={selectedPipeline}
|
selectedStage={arrayOfPipelinesSteps.find(p => selectedPipelineStep)?.Name || null}
|
||||||
selectedStagePerformer={selectedStepsPerformer}
|
|
||||||
selectedStage={selectedStep}
|
|
||||||
questionEntity={questionEntity}
|
questionEntity={questionEntity}
|
||||||
tags={tags}
|
tags={tags}
|
||||||
/>
|
/>
|
||||||
|
@ -27,7 +27,6 @@ export const AmoLogin: FC<IntegrationStep1Props> = ({ handleNextStep }) => {
|
|||||||
const isMobile = useMediaQuery(theme.breakpoints.down(600));
|
const isMobile = useMediaQuery(theme.breakpoints.down(600));
|
||||||
|
|
||||||
const onAmoClick = async () => {
|
const onAmoClick = async () => {
|
||||||
console.log("Amo click");
|
|
||||||
const [url, error] = await connectAmo();
|
const [url, error] = await connectAmo();
|
||||||
if (url && !error) {
|
if (url && !error) {
|
||||||
window.open(url, "_blank");
|
window.open(url, "_blank");
|
||||||
|
@ -24,7 +24,6 @@ export const AmoModalTitle: FC<AmoModalTitleProps> = ({
|
|||||||
const theme = useTheme();
|
const theme = useTheme();
|
||||||
const isMobile = useMediaQuery(theme.breakpoints.down(600));
|
const isMobile = useMediaQuery(theme.breakpoints.down(600));
|
||||||
|
|
||||||
console.log(isSettingsBlock)
|
|
||||||
const handleClick = useCallback(async () => {
|
const handleClick = useCallback(async () => {
|
||||||
if (isSettingsBlock) {
|
if (isSettingsBlock) {
|
||||||
startRemoveAccount();
|
startRemoveAccount();
|
||||||
|
@ -23,7 +23,7 @@ type Props = {
|
|||||||
questions: AllTypesQuestion[];
|
questions: AllTypesQuestion[];
|
||||||
};
|
};
|
||||||
|
|
||||||
export const AmoStep7: FC<Props> = ({
|
export const AmoQuestions: FC<Props> = ({
|
||||||
handlePrevStep,
|
handlePrevStep,
|
||||||
handleNextStep,
|
handleNextStep,
|
||||||
questionEntity,
|
questionEntity,
|
||||||
@ -56,16 +56,20 @@ export const AmoStep7: FC<Props> = ({
|
|||||||
[],
|
[],
|
||||||
);
|
);
|
||||||
const translatedQuestionEntity = useMemo(() => {
|
const translatedQuestionEntity = useMemo(() => {
|
||||||
const translated = {} as TQuestionEntity;
|
const translated = {
|
||||||
|
|
||||||
|
} as TQuestionEntity;
|
||||||
|
|
||||||
for (let key in questionEntity) {
|
for (let key in questionEntity) {
|
||||||
translated[key] = questionEntity[key].map((id) =>
|
if (questionEntity[key] !== "Contact") {
|
||||||
questions.find((q) => q.backendId === Number(id))?.title || id
|
console.log(translated)
|
||||||
)
|
console.log(translated[key])
|
||||||
|
console.log(questionEntity)
|
||||||
|
translated[key] = questionEntity[key].map((id) =>
|
||||||
|
questions.find((q) => q.backendId === Number(id))?.title || id)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
console.log("questionEntity", questionEntity)
|
|
||||||
console.log("translated", translated)
|
|
||||||
return translated
|
return translated
|
||||||
},
|
},
|
||||||
[questionEntity],
|
[questionEntity],
|
@ -21,6 +21,8 @@ export const AnswerItem: FC<AnswerItemProps> = ({ fieldName, fieldValue }) => {
|
|||||||
fontSize: "14px",
|
fontSize: "14px",
|
||||||
fontWeight: 500,
|
fontWeight: 500,
|
||||||
color: theme.palette.grey3.main,
|
color: theme.palette.grey3.main,
|
||||||
|
textOverflow: "ellipsis",
|
||||||
|
overflow: "hidden"
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
{fieldName}
|
{fieldName}
|
||||||
@ -30,6 +32,8 @@ export const AnswerItem: FC<AnswerItemProps> = ({ fieldName, fieldValue }) => {
|
|||||||
fontSize: "14px",
|
fontSize: "14px",
|
||||||
fontWeight: 400,
|
fontWeight: 400,
|
||||||
color: theme.palette.grey3.main,
|
color: theme.palette.grey3.main,
|
||||||
|
textOverflow: "ellipsis",
|
||||||
|
overflow: "hidden"
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
{fieldValue}
|
{fieldValue}
|
@ -9,11 +9,9 @@ type ItemProps = {
|
|||||||
onAddBtnClick: () => void;
|
onAddBtnClick: () => void;
|
||||||
data: TQuestionEntity | TTags;
|
data: TQuestionEntity | TTags;
|
||||||
};
|
};
|
||||||
export const Item: FC<ItemProps> = ({ title, onAddBtnClick, data }) => {
|
export const Item: FC<ItemProps> = ({ title, onAddBtnClick, data, tagsNamesList }) => {
|
||||||
const theme = useTheme();
|
const theme = useTheme();
|
||||||
|
|
||||||
console.log("title")
|
|
||||||
console.log(data)
|
|
||||||
const titleDictionary = {
|
const titleDictionary = {
|
||||||
Company: "Компания",
|
Company: "Компания",
|
||||||
Lead: "Сделка",
|
Lead: "Сделка",
|
||||||
@ -53,7 +51,7 @@ export const Item: FC<ItemProps> = ({ title, onAddBtnClick, data }) => {
|
|||||||
<AnswerItem
|
<AnswerItem
|
||||||
key={text + index}
|
key={text + index}
|
||||||
fieldValue={"Значение поля"}
|
fieldValue={"Значение поля"}
|
||||||
fieldName={text}
|
fieldName={tagsNamesList?.[title][index] || text}
|
||||||
/>
|
/>
|
||||||
))}
|
))}
|
||||||
|
|
@ -27,8 +27,6 @@ export const ItemsSelectionView: FC<ItemsSelectionViewProps> = ({
|
|||||||
parentTags,
|
parentTags,
|
||||||
setTags
|
setTags
|
||||||
}) => {
|
}) => {
|
||||||
console.log("items тегов")
|
|
||||||
console.log(items)
|
|
||||||
return (
|
return (
|
||||||
<Box
|
<Box
|
||||||
sx={{
|
sx={{
|
@ -9,9 +9,9 @@ import {
|
|||||||
useState,
|
useState,
|
||||||
} from "react";
|
} from "react";
|
||||||
|
|
||||||
import { TagKeys, TTags } from "../AmoCRMModal";
|
import { TagKeys, TagQuestionObject, TTags } from "../AmoCRMModal";
|
||||||
import Box from "@mui/material/Box";
|
import Box from "@mui/material/Box";
|
||||||
import { ItemsSelectionView } from "../IntegrationStep7/ItemsSelectionView/ItemsSelectionView";
|
import { ItemsSelectionView } from "../AmoQuestions/ItemsSelectionView/ItemsSelectionView";
|
||||||
import { TagsDetailsView } from "./TagsDetailsView/TagsDetailsView";
|
import { TagsDetailsView } from "./TagsDetailsView/TagsDetailsView";
|
||||||
import { Tag } from "@api/integration";
|
import { Tag } from "@api/integration";
|
||||||
|
|
||||||
@ -19,33 +19,40 @@ type Props = {
|
|||||||
handleNextStep: () => void;
|
handleNextStep: () => void;
|
||||||
handlePrevStep: () => void;
|
handlePrevStep: () => void;
|
||||||
tagsNames: TTags;
|
tagsNames: TTags;
|
||||||
setTagsNames: Dispatch<SetStateAction<TTags>>;
|
setIdTags: Dispatch<SetStateAction<TTags>>;
|
||||||
|
arrayOfTags: TTags[]
|
||||||
};
|
};
|
||||||
|
|
||||||
export const AmoStep6: FC<Props> = ({
|
export const AmoTags: FC<Props> = ({
|
||||||
handleNextStep,
|
handleNextStep,
|
||||||
handlePrevStep,
|
handlePrevStep,
|
||||||
tagsNames,
|
tagsNames,
|
||||||
setTagsNames
|
setIdTags,
|
||||||
|
arrayOfTags,
|
||||||
}) => {
|
}) => {
|
||||||
const theme = useTheme();
|
const theme = useTheme();
|
||||||
const [isSelection, setIsSelection] = useState<boolean>(false);
|
const [isSelection, setIsSelection] = useState<boolean>(false);
|
||||||
const [activeItem, setActiveItem] = useState<string | null>(null);
|
const [activeTag, setActiveItem] = useState<string | null>(null);
|
||||||
const [selectedValue, setSelectedValue] = useState<string | null>(null);
|
const [selectedValue, setSelectedValue] = useState<string | null>(null);
|
||||||
const [tags, setTags] = useState<Tag[]>([]);
|
const [tags, setTags] = useState<Tag[]>([]);
|
||||||
|
const [tagsNamesList, setTagsNamesList] = useState<Record<TagKeys, string[]>>({
|
||||||
|
Lead: [],
|
||||||
|
Contact: [],
|
||||||
|
Company: [],
|
||||||
|
Customer: [],
|
||||||
|
});
|
||||||
const handleAdd = useCallback(() => {
|
const handleAdd = useCallback(() => {
|
||||||
if (!activeItem || !selectedValue) return;
|
if (!activeTag || !selectedValue) return;
|
||||||
|
|
||||||
setTagsNames((prevState) => ({
|
setIdTags((prevState) => ({
|
||||||
...prevState,
|
...prevState,
|
||||||
[activeItem]: [...prevState[activeItem as TagKeys], Number(selectedValue)],
|
[activeTag]: [...prevState[activeTag as TagKeys], Number(selectedValue)],
|
||||||
}));
|
}));
|
||||||
}, [activeItem, setTagsNames, selectedValue]);
|
setTagsNamesList((prevState) => ({
|
||||||
|
...prevState,
|
||||||
const items = useMemo(
|
[activeTag]: [...prevState[activeTag as TagKeys], arrayOfTags.find((tag) => tag.AmoID == selectedValue).Name],
|
||||||
() => ["#тег с результатом 1", "#еще один тег с результатом 2", "#тег"],
|
}));
|
||||||
[],
|
}, [activeTag, setIdTags, selectedValue]);
|
||||||
);
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Box
|
<Box
|
||||||
@ -75,6 +82,7 @@ export const AmoStep6: FC<Props> = ({
|
|||||||
/>
|
/>
|
||||||
) : (
|
) : (
|
||||||
<TagsDetailsView
|
<TagsDetailsView
|
||||||
|
tagsNamesList={tagsNamesList}
|
||||||
setIsSelection={setIsSelection}
|
setIsSelection={setIsSelection}
|
||||||
handlePrevStep={handlePrevStep}
|
handlePrevStep={handlePrevStep}
|
||||||
handleNextStep={handleNextStep}
|
handleNextStep={handleNextStep}
|
@ -1,8 +1,8 @@
|
|||||||
import { Box, Typography, useTheme } from "@mui/material";
|
import { Box, Typography, useTheme } from "@mui/material";
|
||||||
import { StepButtonsBlock } from "../../StepButtonsBlock/StepButtonsBlock";
|
import { StepButtonsBlock } from "../../StepButtonsBlock/StepButtonsBlock";
|
||||||
import { FC } from "react";
|
import { FC } from "react";
|
||||||
import { TagKeys, TTags } from "../../AmoCRMModal";
|
import { TagKeys, TitleKeys, TTags } from "../../AmoCRMModal";
|
||||||
import { Item } from "../../IntegrationStep7/Item/Item";
|
import { Item } from "../../AmoQuestions/Item/Item";
|
||||||
|
|
||||||
type TagsDetailsViewProps = {
|
type TagsDetailsViewProps = {
|
||||||
setIsSelection: (value: boolean) => void;
|
setIsSelection: (value: boolean) => void;
|
||||||
@ -10,6 +10,7 @@ type TagsDetailsViewProps = {
|
|||||||
handleNextStep: () => void;
|
handleNextStep: () => void;
|
||||||
tagsNames: TTags;
|
tagsNames: TTags;
|
||||||
setActiveItem: (value: string | null) => void;
|
setActiveItem: (value: string | null) => void;
|
||||||
|
tagsNamesList: Record<TagKeys, string[]>
|
||||||
};
|
};
|
||||||
|
|
||||||
export const TagsDetailsView: FC<TagsDetailsViewProps> = ({
|
export const TagsDetailsView: FC<TagsDetailsViewProps> = ({
|
||||||
@ -18,6 +19,7 @@ export const TagsDetailsView: FC<TagsDetailsViewProps> = ({
|
|||||||
tagsNames,
|
tagsNames,
|
||||||
setActiveItem,
|
setActiveItem,
|
||||||
setIsSelection,
|
setIsSelection,
|
||||||
|
tagsNamesList,
|
||||||
}) => {
|
}) => {
|
||||||
const theme = useTheme();
|
const theme = useTheme();
|
||||||
|
|
||||||
@ -71,8 +73,9 @@ export const TagsDetailsView: FC<TagsDetailsViewProps> = ({
|
|||||||
{tagsNames &&
|
{tagsNames &&
|
||||||
Object.keys(tagsNames).map((item) => (
|
Object.keys(tagsNames).map((item) => (
|
||||||
<Item
|
<Item
|
||||||
|
tagsNamesList={tagsNamesList}
|
||||||
key={item}
|
key={item}
|
||||||
title={item as TagKeys}
|
title={item as TitleKeys}
|
||||||
onAddBtnClick={() => {
|
onAddBtnClick={() => {
|
||||||
setIsSelection(true);
|
setIsSelection(true);
|
||||||
setActiveItem(item);
|
setActiveItem(item);
|
@ -3,14 +3,14 @@ import { FC } from "react";
|
|||||||
import { StepButtonsBlock } from "../StepButtonsBlock/StepButtonsBlock";
|
import { StepButtonsBlock } from "../StepButtonsBlock/StepButtonsBlock";
|
||||||
import { CustomSelect } from "../../../../components/CustomSelect/CustomSelect";
|
import { CustomSelect } from "../../../../components/CustomSelect/CustomSelect";
|
||||||
|
|
||||||
type AmoStep4Props = {
|
type Props = {
|
||||||
handlePrevStep: () => void;
|
handlePrevStep: () => void;
|
||||||
handleNextStep: () => void;
|
handleNextStep: () => void;
|
||||||
selectedDealPerformer: string | null;
|
selectedDealPerformer: number | null;
|
||||||
setSelectedDealPerformer: (value: string | null) => void;
|
setSelectedDealPerformer: (value: number | null) => void;
|
||||||
};
|
};
|
||||||
|
|
||||||
export const AmoStep4: FC<AmoStep4Props> = ({
|
export const DealPerformers: FC<Props> = ({
|
||||||
handlePrevStep,
|
handlePrevStep,
|
||||||
handleNextStep,
|
handleNextStep,
|
||||||
selectedDealPerformer,
|
selectedDealPerformer,
|
@ -4,17 +4,17 @@ import { StepButtonsBlock } from "../StepButtonsBlock/StepButtonsBlock";
|
|||||||
import { CustomSelect } from "../../../../components/CustomSelect/CustomSelect";
|
import { CustomSelect } from "../../../../components/CustomSelect/CustomSelect";
|
||||||
import { CustomRadioGroup } from "../../../../components/CustomRadioGroup/CustomRadioGroup";
|
import { CustomRadioGroup } from "../../../../components/CustomRadioGroup/CustomRadioGroup";
|
||||||
|
|
||||||
type AmoStep3Props = {
|
type Props = {
|
||||||
handlePrevStep: () => void;
|
handlePrevStep: () => void;
|
||||||
handleNextStep: () => void;
|
handleNextStep: () => void;
|
||||||
selectedStepsPerformer: string | null;
|
selectedStepsPerformer: number | null;
|
||||||
setSelectedStepsPerformer: (value: string | null) => void;
|
setSelectedStepsPerformer: (value: number | null) => void;
|
||||||
selectedStep: string | null;
|
selectedStep: number | null;
|
||||||
setSelectedStep: (value: string | null) => void;
|
setSelectedStep: (value: number | null) => void;
|
||||||
pipelineId: string | null;
|
pipelineId: number | null;
|
||||||
};
|
};
|
||||||
|
|
||||||
export const AmoStep3: FC<AmoStep3Props> = ({
|
export const PipelineSteps: FC<Props> = ({
|
||||||
handlePrevStep,
|
handlePrevStep,
|
||||||
handleNextStep,
|
handleNextStep,
|
||||||
selectedStepsPerformer,
|
selectedStepsPerformer,
|
@ -4,17 +4,17 @@ import { StepButtonsBlock } from "../StepButtonsBlock/StepButtonsBlock";
|
|||||||
import { CustomSelect } from "../../../../components/CustomSelect/CustomSelect";
|
import { CustomSelect } from "../../../../components/CustomSelect/CustomSelect";
|
||||||
import { CustomRadioGroup } from "../../../../components/CustomRadioGroup/CustomRadioGroup";
|
import { CustomRadioGroup } from "../../../../components/CustomRadioGroup/CustomRadioGroup";
|
||||||
|
|
||||||
type AmoStep2Props = {
|
type Props = {
|
||||||
handlePrevStep: () => void;
|
handlePrevStep: () => void;
|
||||||
handleNextStep: () => void;
|
handleNextStep: () => void;
|
||||||
selectedPipelinePerformer: string | null;
|
selectedPipelinePerformer: number | null;
|
||||||
setSelectedPipelinePerformer: (value: string | null) => void;
|
setSelectedPipelinePerformer: (value: number | null) => void;
|
||||||
selectedPipeline: string | null;
|
selectedPipeline: number | null;
|
||||||
setSelectedPipeline: (value: string | null) => void;
|
setSelectedPipeline: (value: number | null) => void;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
export const AmoStep2: FC<AmoStep2Props> = ({
|
export const Pipelines: FC<Props> = ({
|
||||||
handlePrevStep,
|
handlePrevStep,
|
||||||
handleNextStep,
|
handleNextStep,
|
||||||
selectedPipelinePerformer,
|
selectedPipelinePerformer,
|
@ -8,10 +8,8 @@ type AmoSettingsBlockProps = {
|
|||||||
stepTitles: string[];
|
stepTitles: string[];
|
||||||
setStep: (value: number) => void;
|
setStep: (value: number) => void;
|
||||||
setIsSettingsBlock: (value: boolean) => void;
|
setIsSettingsBlock: (value: boolean) => void;
|
||||||
selectedFunnelPerformer: string | null;
|
selectedFunnel: number | null;
|
||||||
selectedFunnel: string | null;
|
selectedStage: number | null;
|
||||||
selectedStagePerformer: string | null;
|
|
||||||
selectedStage: string | null;
|
|
||||||
selectedDealPerformer: string | null;
|
selectedDealPerformer: string | null;
|
||||||
questionEntity: TQuestionEntity;
|
questionEntity: TQuestionEntity;
|
||||||
tags: TTags;
|
tags: TTags;
|
||||||
@ -21,9 +19,7 @@ export const AmoSettingsBlock: FC<AmoSettingsBlockProps> = ({
|
|||||||
stepTitles,
|
stepTitles,
|
||||||
setStep,
|
setStep,
|
||||||
setIsSettingsBlock,
|
setIsSettingsBlock,
|
||||||
selectedFunnelPerformer,
|
|
||||||
selectedFunnel,
|
selectedFunnel,
|
||||||
selectedStagePerformer,
|
|
||||||
selectedDealPerformer,
|
selectedDealPerformer,
|
||||||
selectedStage,
|
selectedStage,
|
||||||
questionEntity,
|
questionEntity,
|
||||||
@ -61,10 +57,8 @@ export const AmoSettingsBlock: FC<AmoSettingsBlockProps> = ({
|
|||||||
title={title}
|
title={title}
|
||||||
setIsSettingsBlock={setIsSettingsBlock}
|
setIsSettingsBlock={setIsSettingsBlock}
|
||||||
setStep={setStep}
|
setStep={setStep}
|
||||||
selectedFunnelPerformer={selectedFunnelPerformer}
|
|
||||||
selectedFunnel={selectedFunnel}
|
|
||||||
selectedStagePerformer={selectedStagePerformer}
|
|
||||||
selectedDealPerformer={selectedDealPerformer}
|
selectedDealPerformer={selectedDealPerformer}
|
||||||
|
selectedFunnel={selectedFunnel}
|
||||||
selectedStage={selectedStage}
|
selectedStage={selectedStage}
|
||||||
questionEntity={questionEntity}
|
questionEntity={questionEntity}
|
||||||
tags={tags}
|
tags={tags}
|
||||||
|
@ -35,7 +35,6 @@ export const SettingItem: FC<SettingItemProps> = ({
|
|||||||
}) => {
|
}) => {
|
||||||
const theme = useTheme();
|
const theme = useTheme();
|
||||||
const isMobile = useMediaQuery(theme.breakpoints.down(600));
|
const isMobile = useMediaQuery(theme.breakpoints.down(600));
|
||||||
|
|
||||||
if (step === 0) {
|
if (step === 0) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -44,7 +43,7 @@ export const SettingItem: FC<SettingItemProps> = ({
|
|||||||
if (step === 1) {
|
if (step === 1) {
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<ResponsiblePerson performer={selectedFunnelPerformer} />
|
<ResponsiblePerson performer={selectedDealPerformer} />
|
||||||
<SelectedParameter parameter={selectedFunnel} />
|
<SelectedParameter parameter={selectedFunnel} />
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
@ -52,7 +51,7 @@ export const SettingItem: FC<SettingItemProps> = ({
|
|||||||
if (step === 2) {
|
if (step === 2) {
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<ResponsiblePerson performer={selectedStagePerformer} />
|
<ResponsiblePerson performer={selectedDealPerformer} />
|
||||||
<SelectedParameter parameter={selectedStage} />
|
<SelectedParameter parameter={selectedStage} />
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
|
@ -72,16 +72,6 @@ export default function AvailablePrivilege() {
|
|||||||
);
|
);
|
||||||
|
|
||||||
const currentDate = moment();
|
const currentDate = moment();
|
||||||
console.log(quizUnlimDays);
|
|
||||||
console.log(moment());
|
|
||||||
console.log(
|
|
||||||
moment(
|
|
||||||
moment(userPrivileges?.quizUnlimTime?.created_at).add(
|
|
||||||
quizUnlimTime,
|
|
||||||
"days",
|
|
||||||
),
|
|
||||||
),
|
|
||||||
);
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Box
|
<Box
|
||||||
|
@ -82,10 +82,6 @@ export const createUntypedQuestion = (
|
|||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
console.log(
|
|
||||||
33,
|
|
||||||
useQuestionsStore.getState().questions.map((q) => q.type),
|
|
||||||
);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const removeQuestion = (questionId: string) =>
|
const removeQuestion = (questionId: string) =>
|
||||||
|
@ -110,7 +110,6 @@ export const ExportResults = async (
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
console.log(typeof data);
|
|
||||||
|
|
||||||
const blob = new Blob([data as BlobPart], {
|
const blob = new Blob([data as BlobPart], {
|
||||||
type: "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet;charset=utf-8",
|
type: "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet;charset=utf-8",
|
||||||
@ -118,7 +117,6 @@ export const ExportResults = async (
|
|||||||
|
|
||||||
const link = document.createElement("a");
|
const link = document.createElement("a");
|
||||||
link.href = window.URL.createObjectURL(data as Blob);
|
link.href = window.URL.createObjectURL(data as Blob);
|
||||||
console.log(link);
|
|
||||||
link.download = `report_${new Date().getTime()}.xlsx`;
|
link.download = `report_${new Date().getTime()}.xlsx`;
|
||||||
link.click();
|
link.click();
|
||||||
};
|
};
|
||||||
|
@ -28,7 +28,6 @@ export function CheckFastlink() {
|
|||||||
const [discounts, setDiscounts] = useState<Discount[]>([]);
|
const [discounts, setDiscounts] = useState<Discount[]>([]);
|
||||||
const [askToChange, setAskToChange] = useState(false);
|
const [askToChange, setAskToChange] = useState(false);
|
||||||
const [promocode, setPromocode] = useState("");
|
const [promocode, setPromocode] = useState("");
|
||||||
console.log(user.userAccount, user.customerAccount);
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
const get = async () => {
|
const get = async () => {
|
||||||
if (!user.userId) {
|
if (!user.userId) {
|
||||||
|
@ -25,7 +25,7 @@ const translateMessage: Record<string, string> = {
|
|||||||
|
|
||||||
export const parseAxiosError = (nativeError: unknown): [string, number?] => {
|
export const parseAxiosError = (nativeError: unknown): [string, number?] => {
|
||||||
const error = nativeError as AxiosError;
|
const error = nativeError as AxiosError;
|
||||||
console.log(error)
|
console.error(error)
|
||||||
if (process.env.NODE_ENV !== "production") console.error(error);
|
if (process.env.NODE_ENV !== "production") console.error(error);
|
||||||
if (error.message === "Failed to fetch") return ["Ошибка сети"];
|
if (error.message === "Failed to fetch") return ["Ошибка сети"];
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user