This commit is contained in:
2024-07-25 12:26:18 +05:30
parent 012d4b4a7e
commit 9176f2078f
20 changed files with 370 additions and 319 deletions

View File

@@ -129,6 +129,7 @@ const DataTable = ({
textOverflow: "ellipsis",
}}
className="web-text-small"
w={400}
>
<Skeleton display={'flex'} alignItems={'center'} justifyContent={tableHeadRow.length - 1 === i || centered ? "center" : "start"} h={5} fadeDuration={index / 12} isLoaded={!isLoading}>
{item[heading]}

View File

@@ -28,7 +28,6 @@ import { TiWarning } from "react-icons/ti";
import { motion } from "framer-motion";
import { AddIcon, CloseIcon } from "@chakra-ui/icons";
const today = new Date().toISOString().split("T")[0];
const formatDate = (dateString) => {
@@ -43,7 +42,6 @@ const defaultDate = "8/2/2024";
// Format the default date as YYYY-MM-DD
const formattedDate = formatDate(defaultDate);
console.log(formattedDate);
const FormField = ({
label,
@@ -381,14 +379,35 @@ const FormField = ({
} else if (type === "table") {
return (
<Table w={"100%"} variant="simple">
<Thead >
<Tr >
{value.map((item, index) => (
<Th
border={'none'} p={2} textTransform={"none"} key={index}>
<Box as="span" display={'flex'} alignItems={'center'} gap={2} >
<Image opacity={0.9} rounded={'full'} w={5} h={5} src={item?.logo} />
{item.country}
<Thead>
<Tr>
{value?.map((item, index) => (
<Th
border={"none"}
p={2}
textTransform={"none"}
key={index}
>
<Box
as="span"
display={"flex"}
alignItems={"center"}
gap={2}
>
<Image
objectFit={"cover"}
opacity={0.9}
rounded={"full"}
w={6}
h={6}
src={
" https://admin.tanami.betadelivery.com/" +
item?.logo
}
/>
{item.country === "United Arab Emirates"
? "UAE"
: item.country}
</Box>
</Th>
))}
@@ -396,9 +415,9 @@ const FormField = ({
</Thead>
<Tbody>
<Tr>
{value.map((item, index) => (
{value?.map((item, index) => (
<Td
p={2}
p={2}
color={"gray.600"}
style={{
whiteSpace: "nowrap",
@@ -406,30 +425,34 @@ const FormField = ({
}}
className="web-text-small"
key={index}
border={'none'}
border={"none"}
>
<InputGroup size='sm'>
<Input
bg={"#F5F8F6"}
focusBorderColor="forestGreen.300"
// border="1px solid #000"
size={"sm"}
fontSize={"sm"}
rounded={"sm"}
type="number"
value={item.value}
textAlign={"right"}
placeholder={"00.00"}
onChange={(e) =>
handleInputChange(index, e.target.value)
}
border={"1px solid #e2e8f0"}
/>
<InputRightAddon fontSize={"xs"} fontWeight={600} color={"forestGreen.500"}>{item?.curr}</InputRightAddon>
</InputGroup>
<InputGroup size="sm">
<Input
isRequired={true}
bg={"#F5F8F6"}
focusBorderColor="forestGreen.300"
// border="1px solid #000"
size={"sm"}
fontSize={"sm"}
rounded={"sm"}
type="number"
value={item.value}
textAlign={"right"}
placeholder={"00.00"}
onChange={(e) =>
handleInputChange(index, e.target.value)
}
border={"1px solid #e2e8f0"}
/>
<InputRightAddon
fontSize={"xs"}
fontWeight={600}
color={"forestGreen.500"}
>
{item?.curr}
</InputRightAddon>
</InputGroup>
</Td>
))}
</Tr>

View File

@@ -56,7 +56,7 @@ const FormInputMain = ({
multiple,
width,
value,
handleInputChange
handleInputChange,
},
key
) => (

View File

@@ -1,4 +1,4 @@
import { Box, Button, Divider, FormLabel, Heading } from "@chakra-ui/react";
import { Box, Button, Divider, FormLabel, Heading, Image, Input, InputGroup, InputRightAddon, Table, Tbody, Td, Th, Thead, Tr } from "@chakra-ui/react";
import React from "react";
const FormInputView = ({
@@ -9,7 +9,6 @@ const FormInputView = ({
onSubmit,
children,
}) => {
return (
<form>
{Object?.entries(groupedFields, groupedFieldsTwo).map(
@@ -19,21 +18,112 @@ const FormInputView = ({
{section}
</Heading>
{/* <Box display={"flex"} gap={0}> */}
<Box
width={"100%"}
display={"flex"}
flexWrap={"wrap"}
gap={4}
>
{fields.map(({ value, label, id, width, btn, arabic, type }, key) => (
<Box w={!width ? "49%" : width}>
<FormLabel key={id} color={"gray.500"} fontSize={"xs"}>
{label}
</FormLabel>
<FormLabel border={'1px solid #E4EAF1'} bg={'#ccc3'} p={2} pt={1.5} pb={1.5} rounded={'xs'} textAlign={arabic? 'right':'left'} fontSize={'sm'}>{type==="number" ? value+" /-" : value }</FormLabel>
</Box>
))}
</Box>
<Box width={"100%"} display={"flex"} flexWrap={"wrap"} gap={4}>
{fields.map(
({ value, label, id, width, btn, arabic, type }, key) =>
type === "table" ? (
<Table w={"100%"} variant="simple">
<Thead>
<Tr>
{value?.map((item, index) => (
<Th
border={"none"}
p={2}
textTransform={"none"}
key={index}
>
<Box
as="span"
display={"flex"}
alignItems={"center"}
gap={2}
>
<Image
objectFit={"cover"}
opacity={0.9}
rounded={"full"}
w={6}
h={6}
src={
" https://admin.tanami.betadelivery.com/" +
item?.logo
}
/>
{item.country === "United Arab Emirates"
? "UAE"
: item.country}
</Box>
</Th>
))}
</Tr>
</Thead>
<Tbody>
<Tr>
{value?.map((item, index) => (
<Td
p={2}
color={"gray.600"}
style={{
whiteSpace: "nowrap",
textOverflow: "ellipsis",
}}
className="web-text-small"
key={index}
border={"none"}
>
<InputGroup size="sm">
<Input
readOnly={true}
isRequired={true}
bg={"#F5F8F6"}
focusBorderColor="forestGreen.300"
// border="1px solid #000"
size={"sm"}
fontSize={"sm"}
rounded={"sm"}
type="number"
value={item.value}
textAlign={"right"}
placeholder={"00.00"}
// color={"#000"}
color={"#1A202C"}
fontWeight={500}
border={"1px solid #e2e8f0"}
/>
<InputRightAddon
fontSize={"xs"}
fontWeight={600}
color={"forestGreen.500"}
>
{item?.curr}
</InputRightAddon>
</InputGroup>
</Td>
))}
</Tr>
</Tbody>
</Table>
) : (
<Box w={!width ? "49%" : width}>
<FormLabel key={id} color={"gray.500"} fontSize={"xs"}>
{label}
</FormLabel>
<FormLabel
border={"1px solid #E4EAF1"}
bg={"#ccc3"}
p={2}
pt={1.5}
pb={1.5}
rounded={"xs"}
textAlign={arabic ? "right" : "left"}
fontSize={"sm"}
>
{type === "number" ? value : value}
</FormLabel>
</Box>
)
)}
</Box>
{/* </Box> */}
{index <
Object.entries(groupedFields, groupedFieldsTwo).length - 1 && (

View File

@@ -14,72 +14,13 @@ import InvestmentDocument from "./InvestmentDocument"; // Ensure this is the cor
import ViewIOdataHeader from "../ViewIO/ViewIOdataHeader";
import { useParams } from "react-router-dom";
import FullscreenLoaders from "../../../Components/Loaders/FullscreenLoaders";
const schema = yup.object().shape({
ioName: yup.string().required("IO name english is required"),
ioNameArabic: yup.string().required("IO name arabic is required"),
discription: yup.string().required("Discription in english is required"),
discriptionArabic: yup.string().required("Discription in Arabic is required"),
typeName: yup.string().required("Investment type in english is required"),
typeNameArabic: yup
.string()
.required("Investment type in arabic is required"),
sponserName: yup.string().required("Sponser name is required"),
sponserNameArabic: yup.string().required("Sponser name arabic is required"),
goalAmount: yup.string().required("Goal amount is required"),
holdingPeriod: yup.string().required("Sponser name is required"),
ioStatus: yup.string().required("Investment Object name is required"),
ioStartusArabic: yup.string().required("Sponser name is required"),
closingDate: yup.string().required("Investment Object name is required"),
minInvestment: yup.string().required("Sponser name is required"),
maxInvestment: yup.string().required("Arabic name is required"),
expectedReturn: yup.string().required("Investment Object name is required"),
originalValue: yup.string().required("Sponser name is required"),
keyname: yup.string().required("Arabic name is required"),
keyNameArabic: yup.string().required("Investment Object name is required"),
keyDescription: yup.string().required("Sponser name is required"),
keyDescriptionArabic: yup.string().required("Sponser name is required"),
docType: yup.string().required("Sponser name is required"),
destributedAmount: yup
.number()
.required("Distributed Amount is required")
.positive("Must be a positive number"),
year: yup.string().required("Year is required"),
tenure: yup
.number()
.required("Tenure is required")
.positive("Must be a positive number"),
annualReturn: yup
.number()
.required("Annual Return is required")
.positive("Must be a positive number"),
miniInvest: yup
.number()
.required("Minimum Invest is required")
.positive("Must be a positive number"),
quaterly: yup.string().required("Quaterly is required"),
targetClose: yup.date().required("Target close date is required"),
annualyield: yup
.number()
.required("Annual Yield is required")
.positive("Must be a positive number"),
iconUpload: yup.mixed().required("Profile image is required"),
bannerImages: yup.mixed().required("Profile image is required"),
otherImage: yup.mixed().required("Profile image is required"),
docAttach: yup.mixed().required("Profile image is required"),
videos: yup.mixed().required("Profile image is required"),
});
import { useGetIOprepopulateDataQuery } from "../../../Services/io.service";
const CreateIO = () => {
const id = useParams()?.id;
const {
control,
handleSubmit,
formState: { errors },
} = useForm({
resolver: yupResolver(schema),
});
const { data, error, isLoading } = useGetIOprepopulateDataQuery();
// console.log(data?.data);
const enableNextTab = (index) => {
setTabs((prevTabs) => {
@@ -96,55 +37,55 @@ const CreateIO = () => {
{
label: "IO Details",
Content: IODetails,
isDisabled: id ? false : false ,
isDisabled: id ? false : false,
},
{
label: "Investment documents",
Content: InvestmentDocument,
isDisabled: id ? false : true ,
isDisabled: id ? false : true,
},
{
label: "Key merits",
Content: KeyMerits,
isDisabled: id ? false : true ,
isDisabled: id ? false : true,
},
{
label: "IO artifacts",
Content: IOArtifacts,
isDisabled: id ? false : true ,
isDisabled: id ? false : true,
},
{
label: "Investors",
Content: Investors,
isDisabled: id ? false : false ,
isDisabled: id ? false : false,
},
{
label: "IO Cash Details",
Content: IOCashDetails,
isDisabled: id ? false : false ,
isDisabled: id ? false : false,
},
{
label: "IO NAV Details",
Content: IONAVDetails,
isDisabled: id ? false : false ,
isDisabled: id ? false : false,
},
];
const [tabs, setTabs] = useState(initialTabsState);
const [activeIndex, setActiveIndex] = useState(0);
const [isLoading, setIsLoading] = useState(true);
const onSubmit = (data) => {
data.preventDefault();
enableNextTab(0);
};
return (
<Box {...OPACITY_ON_LOAD} w={"100%"} overflowY={"scroll"} overflowX={'hidden'} height={"100vh"} pb={10}>
<Box paddingInline={"12px"} mt={2} >
return isLoading ? (
<FullscreenLoaders />
) : (
<Box
{...OPACITY_ON_LOAD}
w={"100%"}
overflowY={"scroll"}
overflowX={"hidden"}
height={"100vh"}
pb={10}
>
<Box paddingInline={"12px"} mt={2}>
{/* <span
onClick={() => navigate(-1)}
style={{ fontSize: "15px", cursor: "pointer" }}
@@ -177,10 +118,7 @@ const CreateIO = () => {
<TabPanels>
{tabs.map(({ Content }, index) => (
<TabPanel key={index}>
<Content
index={index}
enableNextTab={enableNextTab}
/>
<Content index={index} enableNextTab={enableNextTab} data={data?.data} />
</TabPanel>
))}
</TabPanels>

View File

@@ -15,15 +15,24 @@ import {
useUpdateIOMutation,
} from "../../../Services/io.service";
import ToastBox from "../../../Components/ToastBox";
import { Input, Table, Tbody, Td, Th, Thead, Tr, useToast } from "@chakra-ui/react";
import {
Input,
Table,
Tbody,
Td,
Th,
Thead,
Tr,
useToast,
} from "@chakra-ui/react";
import { formatDate } from "../../Master/Sponser/Sponsers";
import behrain from "../../../assets/bahrain_flag.png"
import kuwait from "../../../assets/kuwait_flag.png"
import oman from "../../../assets/oman_flag.png"
import qatar from "../../../assets/qatar_flag.png"
import uae from "../../../assets/uae_flag.png"
import saudi from "../../../assets/saudi_arabia_flag.png"
import behrain from "../../../assets/bahrain_flag.png";
import kuwait from "../../../assets/kuwait_flag.png";
import oman from "../../../assets/oman_flag.png";
import qatar from "../../../assets/qatar_flag.png";
import uae from "../../../assets/uae_flag.png";
import saudi from "../../../assets/saudi_arabia_flag.png";
const schema = yup.object().shape({
investmentNameEnglish: yup
@@ -61,9 +70,7 @@ const schema = yup.object().shape({
.required("Closing date is required")
.min(new Date(), "Closing date cannot be in the past"),
holdingPeriod: yup
.string()
.required("Holding period is required"),
holdingPeriod: yup.string().required("Holding period is required"),
// minInvestmentAmount: yup
// .number()
@@ -85,52 +92,13 @@ const schema = yup.object().shape({
});
const miniValue = [
{
country: "Behrain",
value: 1220,
logo: behrain,
curr:"BHD"
},
{
country: "Kuwait",
value: 1220,
logo: kuwait,
curr:"KWD"
},
{
country: "Oman",
value: 1220,
logo: oman,
curr:"OMR"
},
{
country: "Qatar",
value: 1220,
logo: qatar,
curr:"QAR"
},
{
country: "Saudi Arabia",
value: 1220,
logo: saudi,
curr:"SAR"
},
{
country: "UAE",
value: 1220,
logo: uae,
curr:"AED"
},
]
const IODetails = ({ enableNextTab, index, data }) => {
const IODetails = ({ enableNextTab, index }) => {
const params = useParams();
const navigate = useNavigate();
const toast = useToast();
const [values, setValues] = useState(miniValue);
console.log(values);
const handleInputChange = (index, newValue) => {
const updatedValues = [...values];
@@ -149,17 +117,7 @@ const IODetails = ({ enableNextTab, index }) => {
useContext(GlobalStateContext);
// ======================[ RTK Querry Api ]
const {
data: investmentTypes,
isLoading: investmentTypesLoading,
error,
} = useGetInvestmentTypesQuery({ page: 1, size: 10 })
const {
data: activeSponsers,
isLoading: activeSponsersIsLoading,
error: activeSponsersError,
} = useGetActiveSponserMasterQuery();
const {
data: IObyID,
isLoading: IObyIDisLoading,
@@ -168,9 +126,8 @@ const IODetails = ({ enableNextTab, index }) => {
const [creatIO] = useCreateIOMutation();
const [updateIO] = useUpdateIOMutation();
// ======================[ Selector filter ]
const investmentTypeOptions = investmentTypes?.data?.rows?.map(
const investmentTypeOptions = data?.investmentType.map(
({ investmentTypeName, id }) => {
return {
label: investmentTypeName,
@@ -179,13 +136,39 @@ const IODetails = ({ enableNextTab, index }) => {
}
);
const sponserNameOption = activeSponsers?.data?.map(({ sponsorName, id }) => {
const sponserNameOption = data?.sponsor?.map(({ sponsorName, id }) => {
return {
label: sponsorName,
value: Number(id),
};
});
const miniValue = data?.country?.map(
({ countryName, flagIcon, minInvestmentAmt, countryCode, id }, index) => {
return {
id:id,
country: countryName,
value: minInvestmentAmt,
logo: flagIcon,
curr: countryCode,
};
}
);
const minInvestmentById = IObyID?.data?.minInvestmentAmt?.map(({minInvestmentAmt, country, country_xid})=>{
return{
id:country_xid,
country: country?.countryName,
value: minInvestmentAmt,
logo: country?.flagIcon,
curr: country?.countryCode,
}
})
const [values, setValues] = useState(id?minInvestmentById:miniValue);
// console.log(values);
// ======================[ Validator filter ]
const {
control,
@@ -198,7 +181,6 @@ const IODetails = ({ enableNextTab, index }) => {
});
useEffect(() => {
setIODetails({
...IObyID?.data,
});
@@ -222,6 +204,10 @@ const IODetails = ({ enableNextTab, index }) => {
}
}, [id, IObyID]);
// const minInvestmentById =
//=======================[ Creator ]
const formFields = [
{
@@ -341,7 +327,6 @@ const IODetails = ({ enableNextTab, index }) => {
value: IObyID?.data?.InvestmentDetails,
},
{
label: "Minimum Investment",
placeHolder: "Enter comment here",
@@ -349,14 +334,13 @@ const IODetails = ({ enableNextTab, index }) => {
type: "table",
section: " ",
width: "100%",
isRequired:true,
isRequired: true,
options: investmentTypeOptions,
type: "table",
handleInputChange:handleInputChange,
handleInputChange: handleInputChange,
value: values,
},
{
label: "Comment",
placeHolder: "Enter comment here",
@@ -522,43 +506,50 @@ const IODetails = ({ enableNextTab, index }) => {
return groups;
}, {});
const onSubmit = async (data) => {
setIsLoading(true)
console.log(data);
delete data.table;
setIsLoading(true);
// console.log(data);
const updatedMinAmount = values?.map(({id, value})=>{
return {
country_xid:id,
minInvestmentAmt: Number(value)
}
})
const formData = {
...data,
investmentType_xid: Number(data.investmentType),
sponsor_xid: Number(data.sponserName),
minInvestmentAmt:updatedMinAmount
};
console.log(formData);
// console.log(formData);
// console.log(formData);
if (id) {
const res = await updateIO({ data : formData, id });
const res = await updateIO({ data: formData, id });
console.log(res);
if (res?.error?.status === 400 || res?.error?.status===500 ) {
setIsLoading(false)
if (res?.error?.status === 400 || res?.error?.status === 500) {
setIsLoading(false);
toast({
render: () => (
<ToastBox message={res?.error?.data?.message} status={"error"} />
),
});
navigate(`/view-io/${id}`);
setIsLoading(false)
setIsLoading(false);
}
navigate(`/view-io/${id}`);
setIsLoading(false)
setIsLoading(false);
} else {
try {
const res = await creatIO(formData);
console.log(res);
if (res?.data?.statusCode === 200) {
setIsLoading(false)
setIsLoading(false);
toast({
render: () => <ToastBox message={res?.data?.message} />,
});
@@ -566,13 +557,13 @@ const IODetails = ({ enableNextTab, index }) => {
enableNextTab(index);
}
} catch (error) {
setIsLoading(false)
setIsLoading(false);
console.log(error);
}
}
// ==========================
// if (params?.id) {
// return enableNextTab(index);
// }
@@ -591,7 +582,6 @@ const IODetails = ({ enableNextTab, index }) => {
return IObyIDisLoading ? (
<FullscreenLoaders />
) : (
<FormInputMain
p={0.1}
w={250}
@@ -602,8 +592,7 @@ const IODetails = ({ enableNextTab, index }) => {
onSubmit={handleSubmit(onSubmit)}
btnLoading={isLoading}
submitTitle={id ? "Update" : "Submit"}
>
</FormInputMain>
></FormInputMain>
);
};

View File

@@ -26,12 +26,14 @@ import { GrDocumentPdf } from "react-icons/gr";
import { AiOutlineFileGif, AiOutlineFileWord } from "react-icons/ai";
import InvestmentView from "../ViewIO/InvestmentView";
import InvestmentEdit from "../EditIO/InvestmentEdit";
import { useDeleteIODocsMutation, useGetInvestmentDocumentsQuery } from "../../../Services/io.service";
import {
useDeleteIODocsMutation,
useGetInvestmentDocumentsQuery,
} from "../../../Services/io.service";
import ToastBox from "../../../Components/ToastBox";
import { getFileNameFromPath } from "../../../Constants/Constants";
import { TbFileTypeDocx } from "react-icons/tb";
const downloadFile = (filePath, fileName) => {
console.log("https://admin.tanami.betadelivery.com/" + filePath);
@@ -69,10 +71,9 @@ const downloadFile = (filePath, fileName) => {
});
};
const InvestmentDocument = ({ control, errors, enableNextTab, index }) => {
const params = useParams()
const id = params?.id
const params = useParams();
const id = params?.id;
const { slideFromRight, create, setCreate } = useContext(GlobalStateContext);
const firstField = useRef();
const secondField = useRef();
@@ -97,32 +98,15 @@ const InvestmentDocument = ({ control, errors, enableNextTab, index }) => {
const navigate = useNavigate();
const toast = useToast();
const [ deleteIODocs] = useDeleteIODocsMutation()
console.log(id);
const [deleteIODocs] = useDeleteIODocsMutation();
const {
data,
error,
isLoading : isIODocLoading
} = useGetInvestmentDocumentsQuery(id)
console.log(error);
console.log(data?.data);
isLoading: isIODocLoading,
} = useGetInvestmentDocumentsQuery(id, {
skip: !id,
});
const tableHeadRow = ["Sr.no", "Type", "File Name", "Document", "Action"];
@@ -155,35 +139,30 @@ console.log(id);
onEditOpen();
};
const handleDelete = async () => {
setIsLoading(true)
setIsLoading(true);
try {
const res = await deleteIODocs(actionId)
if (res?.data?.statusCode === 200) {
toast({
render: () => (
<ToastBox message={res?.data?.message} />
),
});
setIsLoading(false)
setDeleteAlert(false)
}else if(res?.error) {
toast({
render: () => (
<ToastBox message={res?.error?.data?.message} status={"error"} />
),
});
setIsLoading(false)
setDeleteAlert(false)
}
const res = await deleteIODocs(actionId);
if (res?.data?.statusCode === 200) {
toast({
render: () => <ToastBox message={res?.data?.message} />,
});
setIsLoading(false);
setDeleteAlert(false);
} else if (res?.error) {
toast({
render: () => (
<ToastBox message={res?.error?.data?.message} status={"error"} />
),
});
setIsLoading(false);
setDeleteAlert(false);
}
} catch (error) {
console.log(error);
}
}
};
const extractedArray = filteredData?.map((item, index) => ({
"Sr.no": (
<Text
@@ -205,7 +184,11 @@ console.log(id);
className="d-flex align-items-center"
fontSize={"xl"}
>
{item.documentType === "application/pdf" ? <GrDocumentPdf /> : <TbFileTypeDocx fontSize={21} />}
{item.documentType === "application/pdf" ? (
<GrDocumentPdf />
) : (
<TbFileTypeDocx fontSize={21} />
)}
</Text>
),
"File Name": (
@@ -277,7 +260,7 @@ console.log(id);
color="blue.400"
rounded="sm"
size="xs"
onClick={()=>downloadFile(item?.documentPath, item?.documentName)}
onClick={() => downloadFile(item?.documentPath, item?.documentName)}
>
<DownloadIcon />
</Button>
@@ -307,8 +290,6 @@ console.log(id);
),
}));
return (
<Box>
<Box display="flex" justifyContent="space-between" mb={4}>
@@ -328,11 +309,12 @@ console.log(id);
size="sm"
fontSize="xs"
rounded="sm"
colorScheme="forestGreen"
colorScheme="forestGreen"
>
Add Document
</Button>
<InvestmentDocuments
<InvestmentDocuments
data={data?.data}
create={create}
setCreate={setCreate}
isOpen={isOpen}

View File

@@ -37,9 +37,10 @@ const KeyMerits = ({ enableNextTab, index }) => {
// =====================[ variables ]
const id = params?.id;
const { data, isLoading, error } = useGetKeyMeritsQuery(id);
const { data, isLoading, error } = useGetKeyMeritsQuery(id, {
skip: !id,
});
console.log(data?.data);
const { keyMerits, setKeyMerits, slideFromRight } =
useContext(GlobalStateContext);

View File

@@ -62,7 +62,6 @@ const SetDisplayOrder = ({data,}) => {
),
})))
console.log(extractedArray);

View File

@@ -67,6 +67,7 @@ const InvestmentDocuments = ({
firstField,
create,
setCreate,
data
}) => {
const toast = useToast();
const params = useParams();
@@ -78,12 +79,17 @@ const InvestmentDocuments = ({
// =====================[ variables ]
const id = params?.id;
const filterObject = data?.find((item)=> item?.id === id)
console.log(filterObject);
// =====================[ RTK Api calls ]
const [createInvestmentDocument] = useCreateInvestmentDocumentsMutation();
const navigate = useNavigate();
console.log(data);
const {
register,
handleSubmit,
@@ -93,7 +99,6 @@ const InvestmentDocuments = ({
resolver: yupResolver(investmentDocSchema),
});
console.log(errors);
const onSubmit = async (data) => {
console.log("sibmited");

View File

@@ -109,7 +109,6 @@ const KeyMeritsAdd = ({ isOpen, onClose, firstField, id }) => {
}
};
console.log(file);
return (
<>

View File

@@ -30,14 +30,13 @@ const keyMeritsSchema = yup.object().shape({
});
const KeyMeritsEdit = ({ isOpen, onClose, firstField, id, actionId, data }) => {
console.log(actionId);
const toast = useToast()
const [alert, setAlert] = useState(false);
const [isLoading, setIsLoading] = useState(false);
const [ editKeyMerits ] = useUpdateKeyMeritsMutation()
const found = data?.find((item)=> item?.id === actionId)
console.log(found);
const {
control,

View File

@@ -46,7 +46,6 @@ const ViewIOdataHeader = () => {
const { isOpen, onOpen, onClose } = useDisclosure();
const btnRef = useRef();
const { IODetails } = useContext(GlobalStateContext);
console.log(IODetails);
const {
isOpen: isInvestmentOpen,

View File

@@ -119,6 +119,16 @@ const ViewIOdetails = () => {
}, [id, IObyID]);
console.log(IObyID);
const minInvestmentById = IObyID?.data?.minInvestmentAmt?.map(({minInvestmentAmt, country, id})=>{
return{
id:id,
country: country?.countryName,
value: minInvestmentAmt,
logo: country?.flagIcon,
curr: country?.countryCode,
}
})
//=======================[ Editor ]
const formFields = [
{
@@ -233,19 +243,7 @@ const ViewIOdetails = () => {
: "---",
section: " ",
width: "32.3%",
},
{
label: "Minimum Investment Amount",
placeHolder: "$00.00",
name: "minInvestmentAmount",
value: IObyID?.data?.minInvestmentAmount
? IObyID?.data?.minInvestmentAmount
: "---",
type: "number",
isRequired: true,
section: " ",
width: "32.3%",
},
},
{
label: "ISIN",
placeHolder: "$00.00",
@@ -266,6 +264,18 @@ const ViewIOdetails = () => {
section: " ",
width: "32.3%",
},
{
label: "Minimum Investment",
placeHolder: "Enter comment here",
name: "table",
type: "table",
section: " ",
width: "100%",
isRequired: true,
type: "table",
value: minInvestmentById,
},
{
label: "Comment",

View File

@@ -176,13 +176,13 @@ const AddInvestmentType = () => {
type: "text",
isRequired: true,
section: "Add Details",
isArabic: true,
arabic: true,
},
{
label: "Description (English)",
placeHolder: " ",
name: "note",
type: "text",
type: "textarea",
isRequired: true,
section: "Add Details",
},
@@ -190,9 +190,9 @@ const AddInvestmentType = () => {
label: "Description (Arabic)",
placeHolder: " ",
name: "noteArabic",
type: "text",
type: "textarea",
isRequired: true,
isArabic: true,
arabic: true,
section: "Add Details",
},
];
@@ -215,7 +215,7 @@ const AddInvestmentType = () => {
type: "text",
isRequired: true,
section: "Add Details",
isArabic: true,
arabic: true,
},
{
label: "Description (English)",
@@ -231,7 +231,7 @@ const AddInvestmentType = () => {
name: "noteArabic",
type: "text",
isRequired: true,
isArabic: true,
arabic: true,
section: "Add Details",
},
];

View File

@@ -9,7 +9,7 @@ import CustomAlertDialog from "../../../Components/CustomAlertDialog";
import ToastBox from "../../../Components/ToastBox";
import { debounce } from "./AddInvestmentType";
import DataTable from "../../../Components/DataTable/DataTable";
import {useDeleteInvestmentTypeMutation,useGetInvestmentTypesQuery,} from "../../../Services/investment.type.service";
import {useDeleteInvestmentTypeMutation, useGetInvestmentTypesQuery,} from "../../../Services/investment.type.service";
const formatDate = (date) => new Date(date).toLocaleDateString(); // Simple date formatter
@@ -94,11 +94,9 @@ const InvestmentType = () => {
</Text>
),
Description: (
<Box w={'250px'} isTruncated={true}>
<Text as={"span"} color={"teal.900"} fontWeight={"500"}>
<Text as={"span"} w={'400px'} isTruncated={true} color={"teal.900"} fontWeight={"500"}>
{item.note}
</Text>
</Box>
),
Status: (
<Box isTruncated={true}>

View File

@@ -164,7 +164,7 @@ const AddSponser = () => {
type: "text",
isRequired: true,
section: "Add Details",
isArabic: true,
arabic: true,
right: true,
},
{
@@ -195,7 +195,7 @@ const AddSponser = () => {
type: "text",
isRequired: true,
section: "Add Details",
isArabic: true,
arabic: true,
},
{
label: "Email adress",

View File

@@ -8,12 +8,18 @@ export const ioService = createApi({
reducerPath: "ioService",
baseQuery: fetchBaseQuery({ baseUrl }),
tagTypes: ["getInvestmentDocuments"],
endpoints: (builder) => ({
// =====[get]
getInvestmentDocuments: builder.query({
query: ({id}) => `/io/admin/document/${id}`,
providesTags: ["getInvestmentDocuments"],
}),

View File

@@ -23,7 +23,7 @@ export const investmentType = createApi({
getInvestmentTypeById: builder.query({
query: (id) => `/investmentType/admin/${id}`,
providesTags: ["getInvestmentType"],
invalidatesTags: ["getInvestmentType"],
}),
// ========[Create Investment]========
@@ -55,7 +55,7 @@ export const investmentType = createApi({
url: `/investmentType/admin/delete/${id}`,
method: "DELETE",
}),
invalidatesTags: ["getSponser"],
invalidatesTags: ["getInvestmentType"],
}),
}),

View File

@@ -7,11 +7,19 @@ const baseUrl = api?.defaults.baseURL;
export const ioService = createApi({
reducerPath: "ioService",
baseQuery: fetchBaseQuery({ baseUrl }),
tagTypes: ["getIO", "getKeyMerits", "getArtifacts", "getInvestmentDocuments"],
tagTypes: ["prePopulate","getIO", "getKeyMerits", "getArtifacts", "getInvestmentDocuments"],
endpoints: (builder) => ({
// =====[get prepopulate data]
getIOprepopulateData: builder.query({
query: () => `/io/admin/pre-populate`,
providesTags: ["prePopulate"],
}),
// =====[get]
getIOs: builder.query({
query: ({ page, size }) => `/io/admin?page=${page}&size=${size}`,
@@ -130,6 +138,10 @@ export const ioService = createApi({
// Export hooks for usage in functional components
export const {
useGetIOprepopulateDataQuery,
useGetIOsQuery,
useGetIOByIdQuery,
useCreateIOMutation ,