From 4014926f90643321c34cac481205a35bf5b3e69d Mon Sep 17 00:00:00 2001 From: "Siddhesh.More" Date: Fri, 2 Aug 2024 16:56:53 +0530 Subject: [PATCH] updated --- src/Components/FormField.jsx | 2 +- src/Components/FormInputView.jsx | 28 +++- src/Components/ImageViewer.jsx | 56 +++++--- .../IO_Management/CreateIO/IOArtifacts.jsx | 46 +++--- .../CreateIO/InvestmentDocument.jsx | 6 +- .../IO_Management/CreateIO/KeyMerits.jsx | 16 +-- .../CreateIO/SetDisplayOrder.jsx | 38 +++-- src/Pages/IO_Management/IOArtifactsAdd.jsx | 4 +- src/Pages/IO_Management/KeyMeritsAdd.jsx | 52 ++++--- src/Pages/IO_Management/KeyMeritsEdit.jsx | 132 +++++++----------- .../IO_Management/ViewIO/ViewIOdataHeader.jsx | 11 +- .../Master/InvestmentType/InvestmentType.jsx | 6 +- src/Services/api.service.js | 65 ++++----- 13 files changed, 227 insertions(+), 235 deletions(-) diff --git a/src/Components/FormField.jsx b/src/Components/FormField.jsx index fd7726b..76ef002 100644 --- a/src/Components/FormField.jsx +++ b/src/Components/FormField.jsx @@ -402,7 +402,7 @@ const FormField = ({ w={6} h={6} src={ - " https://admin.tanami.betadelivery.com/" + + " https://tanami.betadelivery.com/" + item?.logo } /> diff --git a/src/Components/FormInputView.jsx b/src/Components/FormInputView.jsx index 5e7a580..6b83d86 100644 --- a/src/Components/FormInputView.jsx +++ b/src/Components/FormInputView.jsx @@ -1,4 +1,21 @@ -import { Box, Button, Divider, FormHelperText, FormLabel, Heading, Image, Input, InputGroup, InputRightAddon, Table, Tbody, Td, Th, Thead, Tr } from "@chakra-ui/react"; +import { + Box, + Button, + Divider, + FormHelperText, + FormLabel, + Heading, + Image, + Input, + InputGroup, + InputRightAddon, + Table, + Tbody, + Td, + Th, + Thead, + Tr, +} from "@chakra-ui/react"; import React from "react"; const FormInputView = ({ @@ -45,7 +62,7 @@ const FormInputView = ({ w={6} h={6} src={ - " https://admin.tanami.betadelivery.com/" + + " https://tanami.betadelivery.com/" + item?.logo } /> @@ -115,16 +132,14 @@ const FormInputView = ({ pt={1.5} pb={1.5} rounded={"xs"} - textAlign={arabic ? "right" : align? align : "left"} + textAlign={arabic ? "right" : align ? align : "left"} fontSize={"sm"} > - {type === "number" ? value : value} + {type === "number" ? value : value} - ) )} - {/* */} {index < @@ -132,7 +147,6 @@ const FormInputView = ({ )} - ) )} {children} diff --git a/src/Components/ImageViewer.jsx b/src/Components/ImageViewer.jsx index 717bc15..08e7bbe 100644 --- a/src/Components/ImageViewer.jsx +++ b/src/Components/ImageViewer.jsx @@ -1,24 +1,38 @@ -import { Button, Image, Modal, ModalBody, ModalCloseButton, ModalContent, ModalFooter, ModalHeader, ModalOverlay, useDisclosure } from '@chakra-ui/react' -import React from 'react' +import { + Button, + Image, + Modal, + ModalBody, + ModalCloseButton, + ModalContent, + ModalFooter, + ModalHeader, + ModalOverlay, + useDisclosure, +} from "@chakra-ui/react"; +import React from "react"; -const ImageViewer = ({src, isOpen, onClose}) => { - -return ( - <> - {/* */} +const ImageViewer = ({ src, isOpen, onClose }) => { + return ( + <> + {/* */} - - - - {/* */} - - - + + + + {/* */} + + + + + + + ); +}; - - - - ) -} - -export default ImageViewer \ No newline at end of file +export default ImageViewer; diff --git a/src/Pages/IO_Management/CreateIO/IOArtifacts.jsx b/src/Pages/IO_Management/CreateIO/IOArtifacts.jsx index bacb66c..391cdc0 100644 --- a/src/Pages/IO_Management/CreateIO/IOArtifacts.jsx +++ b/src/Pages/IO_Management/CreateIO/IOArtifacts.jsx @@ -170,22 +170,20 @@ const IOArtifacts = ({ enableNextTab, index, data }) => { colorScheme={"forestGreen"} > - { - // setImageSrc(item?.artifactPathName); - // onOpenImageViewer(); - // }} - as="span" - cursor={'pointer'} - > - View - {" "} - + { + // setImageSrc(item?.artifactPathName); + // onOpenImageViewer(); + // }} + as="span" + cursor={"pointer"} + > + View + {" "} + @@ -205,9 +203,9 @@ const IOArtifacts = ({ enableNextTab, index, data }) => { color="blue.400" rounded={"sm"} size={"xs"} - onClick={()=>{ - setActionId(item?.id) - onOpen() + onClick={() => { + setActionId(item?.id); + onOpen(); }} > @@ -303,11 +301,10 @@ const IOArtifacts = ({ enableNextTab, index, data }) => { color="blue.400" rounded={"sm"} size={"xs"} - - onClick={()=>{ - setActionId(item?.id) - onOpenVideo() - }} + onClick={() => { + setActionId(item?.id); + onOpenVideo(); + }} > @@ -361,8 +358,6 @@ const IOArtifacts = ({ enableNextTab, index, data }) => { isOpen={isOpen} onClose={onClose} firstField={firstField} - - actionId={actionId} setActionId={setActionId} data={IObyID?.data?.artifactsImage} @@ -399,9 +394,6 @@ const IOArtifacts = ({ enableNextTab, index, data }) => { isOpen={isOpenVideo} onClose={onCloseVideo} secondField={secondField} - - - actionId={actionId} setActionId={setActionId} data={IObyID?.data?.artifactsVideo} diff --git a/src/Pages/IO_Management/CreateIO/InvestmentDocument.jsx b/src/Pages/IO_Management/CreateIO/InvestmentDocument.jsx index a30ffd7..4b7f1d8 100644 --- a/src/Pages/IO_Management/CreateIO/InvestmentDocument.jsx +++ b/src/Pages/IO_Management/CreateIO/InvestmentDocument.jsx @@ -36,9 +36,9 @@ import { TbFileTypeDocx } from "react-icons/tb"; import SetDisplayOrder from "./SetDisplayOrder"; const downloadFile = (filePath, fileName) => { - console.log("https://admin.tanami.betadelivery.com/" + filePath); + console.log("https://tanami.betadelivery.com/" + filePath); - fetch("https://admin.tanami.betadelivery.com/" + filePath) + fetch("https://tanami.betadelivery.com/" + filePath) .then((response) => { if (!response.ok) { throw new Error("Network response was not ok"); @@ -294,8 +294,6 @@ const InvestmentDocument = ({ control, errors, enableNextTab, index }) => { return ( - - { /> { - const toast = useToast() + const toast = useToast(); const { isOpen, onOpen, onClose } = useDisclosure(); - const [ isLoading, setIsLoading ] = useState(false) + const [isLoading, setIsLoading] = useState(false); const tableHeadRow = ["", "Title", "Icon"]; const [extractedArray, setExtractedArray] = useState([]); - const [ displayOrder, setDisplayOrder ] = useState(null) - const [ resetDisplayOrder ] = useSetDisplayOrderMutation() + const [displayOrder, setDisplayOrder] = useState(null); + const [resetDisplayOrder] = useSetDisplayOrderMutation(); // Update state when `data` prop changes useEffect(() => { @@ -63,7 +63,7 @@ const SetDisplayOrder = ({ data }) => { p={1} justifyContent={"center"} alignItems={"center"} - src={"https://admin.tanami.betadelivery.com/" + item?.icon?.iconFilePath} + src={"https://tanami.betadelivery.com/" + item?.icon?.iconFilePath} w={8} h={8} /> @@ -79,37 +79,31 @@ const SetDisplayOrder = ({ data }) => { id: item.id, displayOrder: index + 1, })); - setDisplayOrder(displayOrderArray) + setDisplayOrder(displayOrderArray); }, [extractedArray]); - - const handleSetOrder = async () => { - setIsLoading(true) + setIsLoading(true); const data = { - displayOrder:displayOrder - } + displayOrder: displayOrder, + }; try { - const res = await resetDisplayOrder({data}) + const res = await resetDisplayOrder({ data }); console.log(res?.data?.statusCode); if (res?.data?.statusCode === 200) { toast({ render: () => , - }); - onClose() - + }); + onClose(); } - - setIsLoading(false) - + + setIsLoading(false); } catch (error) { console.log(res); - setIsLoading(false) + setIsLoading(false); } - } - - + }; return ( <> diff --git a/src/Pages/IO_Management/IOArtifactsAdd.jsx b/src/Pages/IO_Management/IOArtifactsAdd.jsx index 355a076..513a196 100644 --- a/src/Pages/IO_Management/IOArtifactsAdd.jsx +++ b/src/Pages/IO_Management/IOArtifactsAdd.jsx @@ -232,7 +232,7 @@ const IOArtifactsAdd = ({ Image Preview { return ( <> { Key Merits - - - - + + Title (English) ( - )}/> + )} + /> {errors.meritsHeader?.message} - - @@ -211,7 +216,9 @@ const KeyMeritsAdd = ({ isOpen, onClose, firstField, id, icons }) => { - @@ -234,8 +241,9 @@ const KeyMeritsAdd = ({ isOpen, onClose, firstField, id, icons }) => { - - @@ -259,7 +267,12 @@ const KeyMeritsAdd = ({ isOpen, onClose, firstField, id, icons }) => { - + Select Icon { render={({ field }) => ( { > {selectedImageIcon} { - + {icons?.map(({ iconName, id, iconFilePath }) => ( handleIconSelect(id, iconName, iconFilePath) @@ -305,7 +317,7 @@ const KeyMeritsAdd = ({ isOpen, onClose, firstField, id, icons }) => { > {iconName} { (!selectedImageIcon && errors.icon_xid?.message)} - - diff --git a/src/Pages/IO_Management/KeyMeritsEdit.jsx b/src/Pages/IO_Management/KeyMeritsEdit.jsx index ead7b61..6b241f4 100644 --- a/src/Pages/IO_Management/KeyMeritsEdit.jsx +++ b/src/Pages/IO_Management/KeyMeritsEdit.jsx @@ -39,10 +39,18 @@ const keyMeritsSchema = yup.object().shape({ meritsDescriptionArabic: yup .string() .required("Arabic Description is required"), - icon_xid: yup.mixed().required("Icon is required"), // Adjust based on file or string + icon_xid: yup.mixed().required("Icon is required"), // Adjust based on file or string }); -const KeyMeritsEdit = ({ isOpen, onClose, firstField, id, actionId, data, icons }) => { +const KeyMeritsEdit = ({ + isOpen, + onClose, + firstField, + id, + actionId, + data, + icons, +}) => { const toast = useToast(); const [alert, setAlert] = useState(false); const [isLoading, setIsLoading] = useState(false); @@ -54,7 +62,8 @@ const KeyMeritsEdit = ({ isOpen, onClose, firstField, id, actionId, data, icons const { control, - reset,setValue, + reset, + setValue, handleSubmit, formState: { errors }, } = useForm({ @@ -66,8 +75,8 @@ const KeyMeritsEdit = ({ isOpen, onClose, firstField, id, actionId, data, icons reset({ meritsHeader: found?.meritsHeader, meritsDescription: found?.meritsDescription, - meritsHeaderArabic:found?.meritsHeaderArabic, - meritsDescriptionArabic:found?.meritsDescriptionArabic, + meritsHeaderArabic: found?.meritsHeaderArabic, + meritsDescriptionArabic: found?.meritsDescriptionArabic, iconImage: null, }); } @@ -126,20 +135,16 @@ const KeyMeritsEdit = ({ isOpen, onClose, firstField, id, actionId, data, icons console.log(errors); - const handleIconSelect = (id, iconName, iconFilePath) => { setValue("icon_xid", id); setSelectedIcon(iconName); // Update selected icon name setSelectedImageIcon(iconFilePath); }; - - - return ( <> Edit Key Merits - - + + Title (English) - - - - @@ -179,7 +188,7 @@ const KeyMeritsEdit = ({ isOpen, onClose, firstField, id, actionId, data, icons control={control} render={({ field }) => ( - - - - - @@ -219,8 +226,9 @@ const KeyMeritsEdit = ({ isOpen, onClose, firstField, id, actionId, data, icons - - @@ -230,8 +238,8 @@ const KeyMeritsEdit = ({ isOpen, onClose, firstField, id, actionId, data, icons control={control} render={({ field }) => (