Merge branch 'dev' of http://git.wdipl.com/Siddhesh.More/tanami-admin-panel into dev
This commit is contained in:
@@ -402,7 +402,7 @@ const FormField = ({
|
||||
w={6}
|
||||
h={6}
|
||||
src={
|
||||
" https://admin.tanami.betadelivery.com/" +
|
||||
" https://tanami.betadelivery.com/" +
|
||||
item?.logo
|
||||
}
|
||||
/>
|
||||
|
||||
@@ -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}
|
||||
</FormLabel>
|
||||
|
||||
</Box>
|
||||
)
|
||||
)}
|
||||
|
||||
</Box>
|
||||
{/* </Box> */}
|
||||
{index <
|
||||
@@ -132,7 +147,6 @@ const FormInputView = ({
|
||||
<Divider />
|
||||
)}
|
||||
</Box>
|
||||
|
||||
)
|
||||
)}
|
||||
{children}
|
||||
|
||||
@@ -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 (
|
||||
<>
|
||||
{/* <Button onClick={onOpen}>Open Modal</Button> */}
|
||||
const ImageViewer = ({ src, isOpen, onClose }) => {
|
||||
return (
|
||||
<>
|
||||
{/* <Button onClick={onOpen}>Open Modal</Button> */}
|
||||
|
||||
<Modal size={'xl'} isCentered isOpen={isOpen} onClose={onClose}>
|
||||
<ModalOverlay />
|
||||
<ModalContent>
|
||||
{/* <ModalCloseButton /> */}
|
||||
<ModalBody p={4} >
|
||||
<Image rounded={6} w={'100%'} h={'100%'} src={"https://admin.tanami.betadelivery.com/" + src} />
|
||||
</ModalBody>
|
||||
<Modal size={"xl"} isCentered isOpen={isOpen} onClose={onClose}>
|
||||
<ModalOverlay />
|
||||
<ModalContent>
|
||||
{/* <ModalCloseButton /> */}
|
||||
<ModalBody p={4}>
|
||||
<Image
|
||||
rounded={6}
|
||||
w={"100%"}
|
||||
h={"100%"}
|
||||
src={"https://tanami.betadelivery.com/" + src}
|
||||
/>
|
||||
</ModalBody>
|
||||
</ModalContent>
|
||||
</Modal>
|
||||
</>
|
||||
);
|
||||
};
|
||||
|
||||
</ModalContent>
|
||||
</Modal>
|
||||
</>
|
||||
)
|
||||
}
|
||||
|
||||
export default ImageViewer
|
||||
export default ImageViewer;
|
||||
|
||||
@@ -170,22 +170,20 @@ const IOArtifacts = ({ enableNextTab, index, data }) => {
|
||||
colorScheme={"forestGreen"}
|
||||
>
|
||||
<Link
|
||||
href={
|
||||
"https://admin.tanami.betadelivery.com/" + item?.artifactPathName
|
||||
}
|
||||
href={"https://tanami.betadelivery.com/" + item?.artifactPathName}
|
||||
isExternal
|
||||
>
|
||||
<Box
|
||||
// onClick={() => {
|
||||
// setImageSrc(item?.artifactPathName);
|
||||
// onOpenImageViewer();
|
||||
// }}
|
||||
as="span"
|
||||
cursor={'pointer'}
|
||||
>
|
||||
View
|
||||
</Box>{" "}
|
||||
<ExternalLinkIcon />
|
||||
<Box
|
||||
// onClick={() => {
|
||||
// setImageSrc(item?.artifactPathName);
|
||||
// onOpenImageViewer();
|
||||
// }}
|
||||
as="span"
|
||||
cursor={"pointer"}
|
||||
>
|
||||
View
|
||||
</Box>{" "}
|
||||
<ExternalLinkIcon />
|
||||
</Link>
|
||||
</Badge>
|
||||
</Text>
|
||||
@@ -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();
|
||||
}}
|
||||
>
|
||||
<EditIcon />
|
||||
@@ -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();
|
||||
}}
|
||||
>
|
||||
<EditIcon />
|
||||
</Button>
|
||||
@@ -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}
|
||||
|
||||
@@ -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 (
|
||||
<Box>
|
||||
<Box display="flex" justifyContent="end" mb={4} gap={2}>
|
||||
|
||||
|
||||
<SetDisplayOrder data={filteredData} />
|
||||
<Button
|
||||
leftIcon={<AddIcon />}
|
||||
|
||||
@@ -34,11 +34,10 @@ import ToastBox from "../../../Components/ToastBox";
|
||||
import KeyMeritsEdit from "../KeyMeritsEdit";
|
||||
import SetDisplayOrder from "./SetDisplayOrder";
|
||||
|
||||
const KeyMerits = ({ enableNextTab, index, data:prepopData }) => {
|
||||
const KeyMerits = ({ enableNextTab, index, data: prepopData }) => {
|
||||
const toast = useToast();
|
||||
const params = useParams();
|
||||
|
||||
|
||||
// =====================[ variables ]
|
||||
const id = params?.id;
|
||||
const { data, isLoading, error } = useGetKeyMeritsQuery(id, {
|
||||
@@ -50,7 +49,6 @@ const KeyMerits = ({ enableNextTab, index, data:prepopData }) => {
|
||||
const { keyMerits, setKeyMerits, slideFromRight } =
|
||||
useContext(GlobalStateContext);
|
||||
|
||||
|
||||
const firstField = useRef();
|
||||
const [searchTerm, setSearchTerm] = useState("");
|
||||
const [deleteAlert, setDeleteAlert] = useState(false);
|
||||
@@ -91,7 +89,9 @@ const KeyMerits = ({ enableNextTab, index, data:prepopData }) => {
|
||||
});
|
||||
|
||||
// console.log(filteredData);
|
||||
const sortedData = filteredData?.sort((a, b) => a.displayOder - b.displayOder);
|
||||
const sortedData = filteredData?.sort(
|
||||
(a, b) => a.displayOder - b.displayOder
|
||||
);
|
||||
|
||||
const handleDelete = async () => {
|
||||
setIsBtnLoading(true);
|
||||
@@ -146,13 +146,13 @@ const KeyMerits = ({ enableNextTab, index, data:prepopData }) => {
|
||||
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}
|
||||
/>
|
||||
),
|
||||
|
||||
// https://admin.tanami.betadelivery.com/public/icons/linkedin.png
|
||||
// https://tanami.betadelivery.com/public/icons/linkedin.png
|
||||
Action: (
|
||||
<Box display={"flex"} justifyContent={"center"} gap={2}>
|
||||
{/* <Tooltip
|
||||
@@ -255,7 +255,7 @@ const KeyMerits = ({ enableNextTab, index, data:prepopData }) => {
|
||||
</Button>
|
||||
</Box>
|
||||
<KeyMeritsAdd
|
||||
icons={prepopData?.icons}
|
||||
icons={prepopData?.icons}
|
||||
id={id}
|
||||
isOpen={isOpen}
|
||||
onClose={onClose}
|
||||
@@ -263,7 +263,7 @@ const KeyMerits = ({ enableNextTab, index, data:prepopData }) => {
|
||||
/>
|
||||
|
||||
<KeyMeritsEdit
|
||||
icons={prepopData?.icons}
|
||||
icons={prepopData?.icons}
|
||||
id={id}
|
||||
actionId={actionId}
|
||||
isOpen={isEditOpen}
|
||||
|
||||
@@ -22,15 +22,15 @@ import { useSetDisplayOrderMutation } from "../../../Services/io.service";
|
||||
import ToastBox from "../../../Components/ToastBox";
|
||||
|
||||
const SetDisplayOrder = ({ data }) => {
|
||||
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: () => <ToastBox message={res?.data?.message} />,
|
||||
});
|
||||
onClose()
|
||||
|
||||
});
|
||||
onClose();
|
||||
}
|
||||
|
||||
setIsLoading(false)
|
||||
|
||||
|
||||
setIsLoading(false);
|
||||
} catch (error) {
|
||||
console.log(res);
|
||||
setIsLoading(false)
|
||||
setIsLoading(false);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
};
|
||||
|
||||
return (
|
||||
<>
|
||||
|
||||
@@ -232,7 +232,7 @@ const IOArtifactsAdd = ({
|
||||
<Image
|
||||
rounded={"md"}
|
||||
src={
|
||||
"https://admin.tanami.betadelivery.com/" +
|
||||
"https://tanami.betadelivery.com/" +
|
||||
watch()?.artifactPathName
|
||||
}
|
||||
alt="Image Preview"
|
||||
@@ -277,4 +277,4 @@ const IOArtifactsAdd = ({
|
||||
);
|
||||
};
|
||||
|
||||
export default IOArtifactsAdd;
|
||||
export default IOArtifactsAdd;
|
||||
|
||||
@@ -159,7 +159,7 @@ const KeyMeritsAdd = ({ isOpen, onClose, firstField, id, icons }) => {
|
||||
return (
|
||||
<>
|
||||
<Drawer
|
||||
size={"xl"}
|
||||
size={"xl"}
|
||||
isOpen={isOpen}
|
||||
placement="right"
|
||||
initialFocusRef={firstField}
|
||||
@@ -171,24 +171,29 @@ const KeyMeritsAdd = ({ isOpen, onClose, firstField, id, icons }) => {
|
||||
<DrawerHeader fontSize={"sm"}>Key Merits </DrawerHeader>
|
||||
|
||||
<DrawerBody>
|
||||
<HStack spacing={2} w={'100%'} flexWrap={'wrap'}>
|
||||
|
||||
|
||||
<FormControl w={'49%'} mb={2} isInvalid={!!errors.meritsHeader} isRequired={true}>
|
||||
<HStack spacing={2} w={"100%"} flexWrap={"wrap"}>
|
||||
<FormControl
|
||||
w={"49%"}
|
||||
mb={2}
|
||||
isInvalid={!!errors.meritsHeader}
|
||||
isRequired={true}
|
||||
>
|
||||
<FormLabel fontSize={"sm"}>Title (English)</FormLabel>
|
||||
<Controller
|
||||
name="meritsHeader"
|
||||
control={control}
|
||||
render={({ field }) => (
|
||||
<Input {...field} fontSize={"sm"} type="text" size={"sm"} />
|
||||
)}/>
|
||||
)}
|
||||
/>
|
||||
<FormErrorMessage fontSize={"xs"} fontWeight={500}>
|
||||
{errors.meritsHeader?.message}
|
||||
</FormErrorMessage>
|
||||
</FormControl>
|
||||
|
||||
|
||||
<FormControl w={'49%'} mb={2}
|
||||
<FormControl
|
||||
w={"49%"}
|
||||
mb={2}
|
||||
isInvalid={!!errors.meritsHeaderArabic}
|
||||
isRequired={true}
|
||||
>
|
||||
@@ -211,7 +216,9 @@ const KeyMeritsAdd = ({ isOpen, onClose, firstField, id, icons }) => {
|
||||
</FormErrorMessage>
|
||||
</FormControl>
|
||||
|
||||
<FormControl w={'49%'} mb={2}
|
||||
<FormControl
|
||||
w={"49%"}
|
||||
mb={2}
|
||||
isInvalid={!!errors.meritsDescription}
|
||||
isRequired={true}
|
||||
>
|
||||
@@ -234,8 +241,9 @@ const KeyMeritsAdd = ({ isOpen, onClose, firstField, id, icons }) => {
|
||||
</FormErrorMessage>
|
||||
</FormControl>
|
||||
|
||||
|
||||
<FormControl w={'49%'} mb={2}
|
||||
<FormControl
|
||||
w={"49%"}
|
||||
mb={2}
|
||||
isInvalid={!!errors.meritsDescriptionArabic}
|
||||
isRequired={true}
|
||||
>
|
||||
@@ -259,7 +267,12 @@ const KeyMeritsAdd = ({ isOpen, onClose, firstField, id, icons }) => {
|
||||
</FormErrorMessage>
|
||||
</FormControl>
|
||||
|
||||
<FormControl w={'49%'} mb={2} isInvalid={!!errors.icon_xid} isRequired={true}>
|
||||
<FormControl
|
||||
w={"49%"}
|
||||
mb={2}
|
||||
isInvalid={!!errors.icon_xid}
|
||||
isRequired={true}
|
||||
>
|
||||
<FormLabel fontSize={"sm"}>Select Icon</FormLabel>
|
||||
<Controller
|
||||
name="icon_xid"
|
||||
@@ -267,9 +280,9 @@ const KeyMeritsAdd = ({ isOpen, onClose, firstField, id, icons }) => {
|
||||
render={({ field }) => (
|
||||
<Menu>
|
||||
<MenuButton
|
||||
h={34}
|
||||
bg={'transparent'}
|
||||
className="border"
|
||||
h={34}
|
||||
bg={"transparent"}
|
||||
className="border"
|
||||
size={"sm"}
|
||||
fontWeight={500}
|
||||
rounded={"sm"}
|
||||
@@ -284,7 +297,7 @@ const KeyMeritsAdd = ({ isOpen, onClose, firstField, id, icons }) => {
|
||||
>
|
||||
<Box display="flex" alignItems="center">
|
||||
<Image
|
||||
src={`https://admin.tanami.betadelivery.com/${selectedImageIcon}`}
|
||||
src={`https://tanami.betadelivery.com/${selectedImageIcon}`}
|
||||
alt={selectedImageIcon}
|
||||
boxSize="1rem"
|
||||
mr="12px"
|
||||
@@ -294,10 +307,9 @@ const KeyMeritsAdd = ({ isOpen, onClose, firstField, id, icons }) => {
|
||||
</Text>
|
||||
</Box>
|
||||
</MenuButton>
|
||||
<MenuList minW='415px' size={"sm"} fontWeight={500}>
|
||||
<MenuList minW="415px" size={"sm"} fontWeight={500}>
|
||||
{icons?.map(({ iconName, id, iconFilePath }) => (
|
||||
<MenuItem
|
||||
|
||||
key={id}
|
||||
onClick={() =>
|
||||
handleIconSelect(id, iconName, iconFilePath)
|
||||
@@ -305,7 +317,7 @@ const KeyMeritsAdd = ({ isOpen, onClose, firstField, id, icons }) => {
|
||||
>
|
||||
<Box display="flex" alignItems="center">
|
||||
<Image
|
||||
src={`https://admin.tanami.betadelivery.com/${iconFilePath}`}
|
||||
src={`https://tanami.betadelivery.com/${iconFilePath}`}
|
||||
alt={iconName}
|
||||
boxSize="1rem"
|
||||
mr="12px"
|
||||
@@ -329,8 +341,6 @@ const KeyMeritsAdd = ({ isOpen, onClose, firstField, id, icons }) => {
|
||||
(!selectedImageIcon && errors.icon_xid?.message)}
|
||||
</FormErrorMessage>
|
||||
</FormControl>
|
||||
|
||||
|
||||
</HStack>
|
||||
</DrawerBody>
|
||||
|
||||
|
||||
@@ -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 (
|
||||
<>
|
||||
<Drawer
|
||||
size={"xl"}
|
||||
size={"xl"}
|
||||
isOpen={isOpen}
|
||||
placement="right"
|
||||
initialFocusRef={firstField}
|
||||
@@ -151,8 +156,13 @@ const KeyMeritsEdit = ({ isOpen, onClose, firstField, id, actionId, data, icons
|
||||
<DrawerHeader fontSize={"sm"}>Edit Key Merits</DrawerHeader>
|
||||
|
||||
<DrawerBody>
|
||||
<HStack spacing={2} w={'100%'} flexWrap={'wrap'} >
|
||||
<FormControl mb={2} w={"49%"} isInvalid={!!errors.meritsHeader} isRequired={true}>
|
||||
<HStack spacing={2} w={"100%"} flexWrap={"wrap"}>
|
||||
<FormControl
|
||||
mb={2}
|
||||
w={"49%"}
|
||||
isInvalid={!!errors.meritsHeader}
|
||||
isRequired={true}
|
||||
>
|
||||
<FormLabel fontSize={"sm"}>Title (English)</FormLabel>
|
||||
<Controller
|
||||
name="meritsHeader"
|
||||
@@ -166,10 +176,9 @@ const KeyMeritsEdit = ({ isOpen, onClose, firstField, id, actionId, data, icons
|
||||
</FormErrorMessage>
|
||||
</FormControl>
|
||||
|
||||
|
||||
|
||||
|
||||
<FormControl mb={2} w={"49%"}
|
||||
<FormControl
|
||||
mb={2}
|
||||
w={"49%"}
|
||||
isInvalid={!!errors.meritsHeaderArabic}
|
||||
isRequired={true}
|
||||
>
|
||||
@@ -179,7 +188,7 @@ const KeyMeritsEdit = ({ isOpen, onClose, firstField, id, actionId, data, icons
|
||||
control={control}
|
||||
render={({ field }) => (
|
||||
<Input
|
||||
textAlign={'right'}
|
||||
textAlign={"right"}
|
||||
{...field}
|
||||
fontSize={"sm"}
|
||||
type="textarea"
|
||||
@@ -192,11 +201,9 @@ const KeyMeritsEdit = ({ isOpen, onClose, firstField, id, actionId, data, icons
|
||||
</FormErrorMessage>
|
||||
</FormControl>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<FormControl mb={2} w={"49%"}
|
||||
<FormControl
|
||||
mb={2}
|
||||
w={"49%"}
|
||||
isInvalid={!!errors.meritsDescription}
|
||||
isRequired={true}
|
||||
>
|
||||
@@ -219,8 +226,9 @@ const KeyMeritsEdit = ({ isOpen, onClose, firstField, id, actionId, data, icons
|
||||
</FormErrorMessage>
|
||||
</FormControl>
|
||||
|
||||
|
||||
<FormControl mb={2} w={"49%"}
|
||||
<FormControl
|
||||
mb={2}
|
||||
w={"49%"}
|
||||
isInvalid={!!errors.meritsDescriptionArabic}
|
||||
isRequired={true}
|
||||
>
|
||||
@@ -230,8 +238,8 @@ const KeyMeritsEdit = ({ isOpen, onClose, firstField, id, actionId, data, icons
|
||||
control={control}
|
||||
render={({ field }) => (
|
||||
<Textarea
|
||||
rows={2}
|
||||
textAlign={'right'}
|
||||
rows={2}
|
||||
textAlign={"right"}
|
||||
{...field}
|
||||
fontSize={"sm"}
|
||||
type="textarea"
|
||||
@@ -244,45 +252,11 @@ const KeyMeritsEdit = ({ isOpen, onClose, firstField, id, actionId, data, icons
|
||||
</FormErrorMessage>
|
||||
</FormControl>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<FormControl w={"49%"} isInvalid={!!errors.icon_xid} isRequired={true}>
|
||||
<FormControl
|
||||
w={"49%"}
|
||||
isInvalid={!!errors.icon_xid}
|
||||
isRequired={true}
|
||||
>
|
||||
<FormLabel fontSize={"sm"}>Select Icon</FormLabel>
|
||||
<Controller
|
||||
name="icon_xid"
|
||||
@@ -290,8 +264,8 @@ const KeyMeritsEdit = ({ isOpen, onClose, firstField, id, actionId, data, icons
|
||||
render={({ field }) => (
|
||||
<Menu>
|
||||
<MenuButton
|
||||
h={34}
|
||||
className="border"
|
||||
h={34}
|
||||
className="border"
|
||||
bg="transparent"
|
||||
size={"sm"}
|
||||
fontWeight={500}
|
||||
@@ -300,11 +274,14 @@ const KeyMeritsEdit = ({ isOpen, onClose, firstField, id, actionId, data, icons
|
||||
textAlign={"left"}
|
||||
as={Button}
|
||||
rightIcon={<ChevronDownIcon />}
|
||||
border={!errors.icon_xid?.message || !selectedImageIcon && "2px solid #e53e3e"}
|
||||
border={
|
||||
!errors.icon_xid?.message ||
|
||||
(!selectedImageIcon && "2px solid #e53e3e")
|
||||
}
|
||||
>
|
||||
<Box display="flex" alignItems="center">
|
||||
<Image
|
||||
src={`https://admin.tanami.betadelivery.com/${selectedImageIcon}`}
|
||||
src={`https://tanami.betadelivery.com/${selectedImageIcon}`}
|
||||
alt={selectedImageIcon}
|
||||
boxSize="1rem"
|
||||
mr="12px"
|
||||
@@ -314,7 +291,7 @@ const KeyMeritsEdit = ({ isOpen, onClose, firstField, id, actionId, data, icons
|
||||
</Text>
|
||||
</Box>
|
||||
</MenuButton>
|
||||
<MenuList minW='415px' size={"sm"} fontWeight={500}>
|
||||
<MenuList minW="415px" size={"sm"} fontWeight={500}>
|
||||
{icons?.map(({ iconName, id, iconFilePath }) => (
|
||||
<MenuItem
|
||||
key={id}
|
||||
@@ -324,7 +301,7 @@ const KeyMeritsEdit = ({ isOpen, onClose, firstField, id, actionId, data, icons
|
||||
>
|
||||
<Box display="flex" alignItems="center">
|
||||
<Image
|
||||
src={`https://admin.tanami.betadelivery.com/${iconFilePath}`}
|
||||
src={`https://tanami.betadelivery.com/${iconFilePath}`}
|
||||
alt={iconName}
|
||||
boxSize="1rem"
|
||||
mr="12px"
|
||||
@@ -344,23 +321,14 @@ const KeyMeritsEdit = ({ isOpen, onClose, firstField, id, actionId, data, icons
|
||||
)}
|
||||
/>
|
||||
<FormErrorMessage fontSize={"xs"} fontWeight={500}>
|
||||
{!errors.icon_xid?.message || !selectedImageIcon && errors.icon_xid?.message}
|
||||
{!errors.icon_xid?.message ||
|
||||
(!selectedImageIcon && errors.icon_xid?.message)}
|
||||
{errors.icon_xid?.message && errors.icon_xid?.message}
|
||||
</FormErrorMessage>
|
||||
</FormControl>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</HStack>
|
||||
</DrawerBody>
|
||||
|
||||
|
||||
<DrawerFooter>
|
||||
<Button
|
||||
variant="outline"
|
||||
|
||||
@@ -125,14 +125,17 @@ const ViewIOdataHeader = () => {
|
||||
position={"relative"}
|
||||
>
|
||||
<Box h={100} w={200} p={1.5}>
|
||||
{/* <Image rounded={'md'} h={"100%"} src={ " https://admin.tanami.betadelivery.com/" + IODetails?.ioName} alt={IODetails?.ioName}/> */}
|
||||
{/* <Image rounded={'md'} h={"100%"} src={ " https://tanami.betadelivery.com/" + IODetails?.ioName} alt={IODetails?.ioName}/> */}
|
||||
{IODetails?.artifactsImage?.[0]?.artifactPathName ? (
|
||||
<Image
|
||||
rounded={"md"}
|
||||
h={"100%"}
|
||||
w={"100%"}
|
||||
objectFit={'cover'}
|
||||
src={" https://tanami.betadelivery.com/" + IODetails?.artifactsImage?.[0]?.artifactPathName}
|
||||
objectFit={"cover"}
|
||||
src={
|
||||
" https://tanami.betadelivery.com/" +
|
||||
IODetails?.artifactsImage?.[0]?.artifactPathName
|
||||
}
|
||||
alt={IODetails?.ioName}
|
||||
/>
|
||||
) : (
|
||||
@@ -178,7 +181,7 @@ const ViewIOdataHeader = () => {
|
||||
</Text>
|
||||
</Box>
|
||||
|
||||
<Box display={"flex"} flexDirection={"column"} gap={2}>
|
||||
<Box display={"flex"} flexDirection={"column"} gap={2}>
|
||||
<Text as={"span"} fontSize={"xs"} color={"gray.500"} fontWeight={"500"}>
|
||||
Sponsorer Name
|
||||
</Text>
|
||||
|
||||
@@ -116,6 +116,8 @@ const InvestmentType = () => {
|
||||
</Text>
|
||||
),
|
||||
Description: (
|
||||
|
||||
<Tooltip hasArrow bg={"#fff"} fontSize={"xs"} label={item.note} placement="top-start" color={"blue.800"} >
|
||||
<Text
|
||||
as={"span"}
|
||||
color={"teal.900"}
|
||||
@@ -127,11 +129,11 @@ const InvestmentType = () => {
|
||||
textOverflow="ellipsis"
|
||||
cursor={"grab"}
|
||||
>
|
||||
<Tooltip bg={"#fff"} fontSize={"xs"} label={item.note} placement="top-start" color={"#000"} >
|
||||
|
||||
{item.note}
|
||||
</Tooltip>
|
||||
|
||||
</Text>
|
||||
</Tooltip>
|
||||
),
|
||||
Status: (
|
||||
<Box isTruncated={true}>
|
||||
|
||||
@@ -2,7 +2,7 @@ import axios from "axios";
|
||||
|
||||
// Create an Axios instance for API calls
|
||||
export const api = axios.create({
|
||||
// baseURL: `https://admin.tanami.betadelivery.com/api/v1`,
|
||||
// baseURL: `https://tanami.betadelivery.com/api/v1`,
|
||||
baseURL: `https://tanami.betadelivery.com/api/v1`, // Replace with your API base URL
|
||||
timeout: 10000, // Adjust timeout as needed
|
||||
headers: {
|
||||
@@ -27,43 +27,40 @@ api.interceptors.request.use(
|
||||
);
|
||||
|
||||
// // Add Axios response interceptor to handle token refreshing
|
||||
api.interceptors.response.use(
|
||||
(response) => {
|
||||
return response;
|
||||
},
|
||||
async (error) => {
|
||||
const originalRequest = error.config;
|
||||
api.interceptors.response.use(
|
||||
(response) => {
|
||||
return response;
|
||||
},
|
||||
async (error) => {
|
||||
const originalRequest = error.config;
|
||||
|
||||
// Example logic for handling token expiration and refreshing
|
||||
if (
|
||||
error.response.status === 401 &&
|
||||
!originalRequest._retry &&
|
||||
localStorage.getItem("refreshToken")
|
||||
) {
|
||||
originalRequest._retry = true;
|
||||
// Example logic for handling token expiration and refreshing
|
||||
if (
|
||||
error.response.status === 401 &&
|
||||
!originalRequest._retry &&
|
||||
localStorage.getItem("refreshToken")
|
||||
) {
|
||||
originalRequest._retry = true;
|
||||
|
||||
try {
|
||||
const response = await api.post("/refresh_token", {
|
||||
refreshToken: localStorage.getItem("refreshToken"),
|
||||
});
|
||||
try {
|
||||
const response = await api.post("/refresh_token", {
|
||||
refreshToken: localStorage.getItem("refreshToken"),
|
||||
});
|
||||
|
||||
if (response.status === 200) {
|
||||
// Update tokens in local storage
|
||||
localStorage.setItem("accessToken", response.data.accessToken);
|
||||
localStorage.setItem(
|
||||
"refreshToken",
|
||||
response.data.refreshToken
|
||||
);
|
||||
if (response.status === 200) {
|
||||
// Update tokens in local storage
|
||||
localStorage.setItem("accessToken", response.data.accessToken);
|
||||
localStorage.setItem("refreshToken", response.data.refreshToken);
|
||||
|
||||
// Retry the original request with the new tokens
|
||||
return api(originalRequest);
|
||||
}
|
||||
} catch (error) {
|
||||
console.error("Failed to refresh token:", error);
|
||||
// Handle token refresh failure (e.g., redirect to login)
|
||||
// Retry the original request with the new tokens
|
||||
return api(originalRequest);
|
||||
}
|
||||
} catch (error) {
|
||||
console.error("Failed to refresh token:", error);
|
||||
// Handle token refresh failure (e.g., redirect to login)
|
||||
}
|
||||
|
||||
return Promise.reject(error);
|
||||
}
|
||||
);
|
||||
|
||||
return Promise.reject(error);
|
||||
}
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user