merging
This commit is contained in:
@@ -3,7 +3,6 @@ import {
|
||||
Box,
|
||||
Button,
|
||||
HStack,
|
||||
Input,
|
||||
Link,
|
||||
Text,
|
||||
Tooltip,
|
||||
@@ -19,13 +18,13 @@ import {
|
||||
DeleteIcon,
|
||||
EditIcon,
|
||||
ExternalLinkIcon,
|
||||
ViewIcon,
|
||||
} from "@chakra-ui/icons";
|
||||
import IOArtifactsAdd from "../IOArtifactsAdd";
|
||||
import IOArtifactsVideo from "./IOArtifactsVideo";
|
||||
import SetDisplayOrder from "./SetDisplayOrder";
|
||||
import { useParams } from "react-router-dom";
|
||||
import {
|
||||
useDeleteImageArtifactsMutation,
|
||||
useDeleteVideoArtifactsMutation,
|
||||
useGetIOByIdQuery,
|
||||
} from "../../../Services/io.service";
|
||||
@@ -41,9 +40,6 @@ const IOArtifacts = ({ enableNextTab, index, data }) => {
|
||||
error: IObyIDerror,
|
||||
} = useGetIOByIdQuery(id, { skip: !id });
|
||||
|
||||
console.log(IObyID?.data?.artifactsImage);
|
||||
console.log(IObyID?.data?.artifactsVideo);
|
||||
|
||||
const { iOArtifacts, setIOArtifacts, slideFromRight } =
|
||||
useContext(GlobalStateContext);
|
||||
const { iOArtifactsTwo, setIOArtifactsTwo } = useContext(GlobalStateContext);
|
||||
@@ -53,13 +49,15 @@ const IOArtifacts = ({ enableNextTab, index, data }) => {
|
||||
const [searchTermTwo, setSearchTermTwo] = useState("");
|
||||
const [isLoading, setIsLoading] = useState(true);
|
||||
const [isLoadingBtn, setIsLoadingBtn] = useState(false);
|
||||
const [deleteAlert, setDeleteAlert] = useState(false);
|
||||
const [deleteAlertImage, setDeleteAlertImage] = useState(false);
|
||||
const [deleteAlertVideo, setDeleteAlertVideo] = useState(false);
|
||||
const [actionId, setActionId] = useState(false);
|
||||
const [mouseEntered, setMouseEntered] = useState(false);
|
||||
const [mouseEnteredId, setMouseEnteredId] = useState("");
|
||||
|
||||
const { isOpen, onOpen, onClose } = useDisclosure();
|
||||
const [deleteVideoArtifacts] = useDeleteVideoArtifactsMutation();
|
||||
const [deleteImageArtifacts] = useDeleteImageArtifactsMutation();
|
||||
|
||||
const {
|
||||
isOpen: isOpenVideo,
|
||||
@@ -93,7 +91,7 @@ const IOArtifacts = ({ enableNextTab, index, data }) => {
|
||||
)
|
||||
);
|
||||
toast({
|
||||
render: () => <ToastBox message={"Status changed succesfully.!"} />,
|
||||
render: () => <ToastBox message={"Status changed successfully.!"} />,
|
||||
});
|
||||
}, 300);
|
||||
|
||||
@@ -103,8 +101,7 @@ const IOArtifacts = ({ enableNextTab, index, data }) => {
|
||||
const res = await deleteVideoArtifacts(id);
|
||||
console.log(res?.data?.statusCode);
|
||||
if (res?.data?.statusCode === 200) {
|
||||
setDeleteAlert(false);
|
||||
onCloseVideo();
|
||||
setDeleteAlertVideo(false);
|
||||
setIsLoadingBtn(false);
|
||||
}
|
||||
} catch (error) {
|
||||
@@ -112,15 +109,13 @@ const IOArtifacts = ({ enableNextTab, index, data }) => {
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
const handleDeleteImage = async (id) => {
|
||||
setIsLoadingBtn(true);
|
||||
try {
|
||||
const res = await deleteVideoArtifacts(id);
|
||||
const res = await deleteImageArtifacts(id);
|
||||
console.log(res?.data?.statusCode);
|
||||
if (res?.data?.statusCode === 200) {
|
||||
setDeleteAlert(false);
|
||||
onCloseVideo();
|
||||
setDeleteAlertImage(false);
|
||||
setIsLoadingBtn(false);
|
||||
}
|
||||
} catch (error) {
|
||||
@@ -128,14 +123,9 @@ const IOArtifacts = ({ enableNextTab, index, data }) => {
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
const tableHeadRow = [
|
||||
"Sr.no",
|
||||
"File Name",
|
||||
// "Document",
|
||||
"View image",
|
||||
"Action",
|
||||
];
|
||||
@@ -159,17 +149,6 @@ const IOArtifacts = ({ enableNextTab, index, data }) => {
|
||||
</Text>
|
||||
</Box>
|
||||
),
|
||||
Document: (
|
||||
<Text
|
||||
color={"green.500"}
|
||||
justifyContent={slideFromRight ? "right" : "left"}
|
||||
as={"span"}
|
||||
fontWeight={"500"}
|
||||
className="d-flex align-items-center web-text-small"
|
||||
>
|
||||
{getFileNameFromPath(item.artifactPathName)}
|
||||
</Text>
|
||||
),
|
||||
"View image": (
|
||||
<Text
|
||||
color={"green.500"}
|
||||
@@ -200,27 +179,6 @@ const IOArtifacts = ({ enableNextTab, index, data }) => {
|
||||
),
|
||||
Action: (
|
||||
<Box display={"flex"} justifyContent={"center"} gap={3}>
|
||||
{/* <Tooltip
|
||||
rounded={"sm"}
|
||||
fontSize={"xs"}
|
||||
label="View"
|
||||
bg="#fff"
|
||||
color={"green.500"}
|
||||
placement="top"
|
||||
>
|
||||
<Button
|
||||
_hover={{ color: "green.500" }}
|
||||
// transition={"0.5s all"}
|
||||
onClick={() => {
|
||||
navigate(`view-investment/${item.id}`);
|
||||
}}
|
||||
color="green.300"
|
||||
rounded={"sm"}
|
||||
size={"xs"}
|
||||
>
|
||||
<ViewIcon />
|
||||
</Button>
|
||||
</Tooltip> */}
|
||||
<Tooltip
|
||||
rounded={"sm"}
|
||||
fontSize={"xs"}
|
||||
@@ -231,7 +189,6 @@ const IOArtifacts = ({ enableNextTab, index, data }) => {
|
||||
>
|
||||
<Button
|
||||
_hover={{ color: "blue.500" }}
|
||||
// transition={"0.5s all"}
|
||||
color="blue.400"
|
||||
rounded={"sm"}
|
||||
size={"xs"}
|
||||
@@ -250,10 +207,9 @@ const IOArtifacts = ({ enableNextTab, index, data }) => {
|
||||
<Button
|
||||
onClick={() => {
|
||||
setActionId(item?.id);
|
||||
setDeleteAlert(true);
|
||||
setDeleteAlertImage(true);
|
||||
}}
|
||||
_hover={{ color: "red.500" }}
|
||||
// transition={"0.5s all"}
|
||||
color="red.300"
|
||||
rounded={"sm"}
|
||||
size={"xs"}
|
||||
@@ -268,7 +224,7 @@ const IOArtifacts = ({ enableNextTab, index, data }) => {
|
||||
const tableHeadRowTwo = [
|
||||
"Sr.no",
|
||||
"File Name",
|
||||
"Video streaming uRL",
|
||||
"Video streaming URL",
|
||||
"Action",
|
||||
];
|
||||
|
||||
@@ -292,7 +248,7 @@ const IOArtifacts = ({ enableNextTab, index, data }) => {
|
||||
</Text>
|
||||
</Box>
|
||||
),
|
||||
"Video streaming uRL": (
|
||||
"Video streaming URL": (
|
||||
<Text
|
||||
color={"green.500"}
|
||||
justifyContent={slideFromRight ? "right" : "left"}
|
||||
@@ -317,27 +273,6 @@ const IOArtifacts = ({ enableNextTab, index, data }) => {
|
||||
),
|
||||
Action: (
|
||||
<Box display={"flex"} justifyContent={"center"} gap={3}>
|
||||
{/* <Tooltip
|
||||
rounded={"sm"}
|
||||
fontSize={"xs"}
|
||||
label="View"
|
||||
bg="#fff"
|
||||
color={"green.500"}
|
||||
placement="top"
|
||||
>
|
||||
<Button
|
||||
_hover={{ color: "green.500" }}
|
||||
// transition={"0.5s all"}
|
||||
onClick={() => {
|
||||
navigate(`view-investment/${item.id}`);
|
||||
}}
|
||||
color="green.300"
|
||||
rounded={"sm"}
|
||||
size={"xs"}
|
||||
>
|
||||
<ViewIcon />
|
||||
</Button>
|
||||
</Tooltip> */}
|
||||
<Tooltip
|
||||
rounded={"sm"}
|
||||
fontSize={"xs"}
|
||||
@@ -348,7 +283,6 @@ const IOArtifacts = ({ enableNextTab, index, data }) => {
|
||||
>
|
||||
<Button
|
||||
_hover={{ color: "blue.500" }}
|
||||
// transition={"0.5s all"}
|
||||
color="blue.400"
|
||||
rounded={"sm"}
|
||||
size={"xs"}
|
||||
@@ -367,10 +301,9 @@ const IOArtifacts = ({ enableNextTab, index, data }) => {
|
||||
<Button
|
||||
onClick={() => {
|
||||
setActionId(item?.id);
|
||||
setDeleteAlert(true);
|
||||
setDeleteAlertVideo(true);
|
||||
}}
|
||||
_hover={{ color: "red.500" }}
|
||||
// transition={"0.5s all"}
|
||||
color="red.300"
|
||||
rounded={"sm"}
|
||||
size={"xs"}
|
||||
@@ -389,9 +322,6 @@ const IOArtifacts = ({ enableNextTab, index, data }) => {
|
||||
<Box fontSize={"sm"} fontWeight={500}>
|
||||
Manage iO images
|
||||
</Box>
|
||||
|
||||
{/* <Box display="flex" justifyContent="end" mb={4} gap={2}> */}
|
||||
|
||||
<HStack>
|
||||
<SetDisplayOrder data={IObyID?.data?.artifactsImage} />
|
||||
<Button
|
||||
@@ -425,7 +355,6 @@ const IOArtifacts = ({ enableNextTab, index, data }) => {
|
||||
<Box fontSize={"sm"} fontWeight={500}>
|
||||
Manage IO videos
|
||||
</Box>
|
||||
|
||||
<HStack>
|
||||
<SetDisplayOrder data={IObyID?.data?.artifactsImage} />
|
||||
<Button
|
||||
@@ -455,14 +384,17 @@ const IOArtifacts = ({ enableNextTab, index, data }) => {
|
||||
setMouseEnteredId={setMouseEnteredId}
|
||||
setMouseEntered={setMouseEntered}
|
||||
/>
|
||||
|
||||
{/* <HStack justifyContent={'flex-end'}>
|
||||
<Button ps={8} pe={8} colorScheme="forestGreen" size={'sm'} rounded={'sm'} onClick={()=> enableNextTab(index)}>Next</Button>
|
||||
</HStack> */}
|
||||
<CustomAlertDialog
|
||||
onClose={() => setDeleteAlert(false)}
|
||||
isOpen={deleteAlert}
|
||||
message={"Are you sure you want to delete sponers?"}
|
||||
onClose={() => setDeleteAlertImage(false)}
|
||||
isOpen={deleteAlertImage}
|
||||
message={"Are you sure you want to delete this image?"}
|
||||
alertHandler={() => handleDeleteImage(actionId)}
|
||||
isLoading={isLoadingBtn}
|
||||
/>
|
||||
<CustomAlertDialog
|
||||
onClose={() => setDeleteAlertVideo(false)}
|
||||
isOpen={deleteAlertVideo}
|
||||
message={"Are you sure you want to delete this video?"}
|
||||
alertHandler={() => handleDeleteVideo(actionId)}
|
||||
isLoading={isLoadingBtn}
|
||||
/>
|
||||
|
||||
@@ -71,6 +71,7 @@ const IOArtifactsAdd = ({ isOpen, onClose, firstField }) => {
|
||||
render: () => <ToastBox message={res?.data?.message} />,
|
||||
});
|
||||
reset()
|
||||
setFile(null)
|
||||
setIsLoading(false)
|
||||
setAlert(false);
|
||||
onClose();
|
||||
|
||||
@@ -159,6 +159,14 @@ export const ioService = createApi({
|
||||
invalidatesTags: ["getIOById"],
|
||||
}),
|
||||
|
||||
deleteImageArtifacts: builder.mutation({
|
||||
query: (id) => ({
|
||||
url: `/io/artifact/image/${id}`,
|
||||
method: "DELETE",
|
||||
}),
|
||||
invalidatesTags: ["getIOById"],
|
||||
}),
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -210,6 +218,7 @@ export const {
|
||||
useGetArtifactsVideoQuery,
|
||||
useCreateVideoArtifactsMutation,
|
||||
useDeleteVideoArtifactsMutation,
|
||||
useDeleteImageArtifactsMutation,
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user