2024-04-16 10:57:38 +00:00
|
|
|
import { Box, useTheme } from "@mui/material";
|
2024-04-15 16:30:40 +00:00
|
|
|
import { Item } from "../Item/Item";
|
|
|
|
import { StepButtonsBlock } from "../../StepButtonsBlock/StepButtonsBlock";
|
|
|
|
import { FC } from "react";
|
|
|
|
import { TQuestionEntity } from "../../IntegrationsModal";
|
|
|
|
|
|
|
|
type TitleKeys = "contacts" | "company" | "deal" | "users" | "buyers";
|
|
|
|
|
|
|
|
type ItemDetailsViewProps = {
|
|
|
|
setIsSelection: (value: boolean) => void;
|
|
|
|
handlePrevStep: () => void;
|
|
|
|
handleNextStep: () => void;
|
|
|
|
questionEntity: TQuestionEntity;
|
|
|
|
setActiveItem: (value: string | null) => void;
|
|
|
|
};
|
|
|
|
|
|
|
|
export const ItemDetailsView: FC<ItemDetailsViewProps> = ({
|
|
|
|
handlePrevStep,
|
|
|
|
handleNextStep,
|
|
|
|
questionEntity,
|
|
|
|
setActiveItem,
|
|
|
|
setIsSelection,
|
|
|
|
}) => {
|
2024-04-16 10:57:38 +00:00
|
|
|
const theme = useTheme();
|
|
|
|
|
2024-04-15 16:30:40 +00:00
|
|
|
return (
|
|
|
|
<Box
|
|
|
|
sx={{
|
|
|
|
marginTop: "20px",
|
|
|
|
display: "flex",
|
|
|
|
flexDirection: "column",
|
|
|
|
alignItems: "center",
|
2024-04-16 10:57:38 +00:00
|
|
|
height: "100%",
|
2024-04-15 16:30:40 +00:00
|
|
|
flexGrow: 1,
|
|
|
|
}}
|
|
|
|
>
|
|
|
|
<Box
|
|
|
|
sx={{
|
|
|
|
width: "100%",
|
2024-04-16 10:57:38 +00:00
|
|
|
height: "400px",
|
2024-04-15 16:30:40 +00:00
|
|
|
flexGrow: 1,
|
|
|
|
borderRadius: "10px",
|
|
|
|
padding: "10px",
|
|
|
|
boxShadow: "0 0 20px rgba(0, 0, 0, 0.15)",
|
|
|
|
display: "flex",
|
|
|
|
overflowY: "auto",
|
|
|
|
flexWrap: "wrap",
|
2024-04-16 10:57:38 +00:00
|
|
|
justifyContent: "start",
|
2024-04-15 16:30:40 +00:00
|
|
|
}}
|
|
|
|
>
|
|
|
|
{questionEntity &&
|
|
|
|
Object.keys(questionEntity).map((item) => (
|
|
|
|
<Item
|
|
|
|
key={item}
|
2024-04-16 10:57:38 +00:00
|
|
|
title={item as TitleKeys}
|
2024-04-15 16:30:40 +00:00
|
|
|
onAddBtnClick={() => {
|
|
|
|
setIsSelection(true);
|
|
|
|
setActiveItem(item);
|
|
|
|
}}
|
2024-04-16 10:57:38 +00:00
|
|
|
data={questionEntity}
|
2024-04-15 16:30:40 +00:00
|
|
|
/>
|
|
|
|
))}
|
|
|
|
</Box>
|
|
|
|
|
|
|
|
<Box
|
|
|
|
sx={{
|
|
|
|
marginTop: "20px",
|
|
|
|
alignSelf: "end",
|
|
|
|
}}
|
|
|
|
>
|
|
|
|
<StepButtonsBlock
|
|
|
|
onSmallBtnClick={handlePrevStep}
|
|
|
|
onLargeBtnClick={handleNextStep}
|
|
|
|
/>
|
|
|
|
</Box>
|
|
|
|
</Box>
|
|
|
|
);
|
|
|
|
};
|