This commit is contained in:
YasinShaikh123
2024-08-16 15:12:42 +05:30
22 changed files with 423 additions and 281 deletions

View File

@@ -20,17 +20,19 @@ export const formatCurrency = (value) => {
};
const CurrencyInput = forwardRef(({ value, onChange, ...props }, ref) => {
console.log(props);
const handleChange = (event) => {
let { value } = event.target;
let { value } = event?.target;
// Remove non-numeric characters except decimal point
value = value.replace(/[^0-9.]/g, '');
value = value?.replace(/[^0-9.]/g, '');
// Ensure only one decimal point
const parts = value.split('.');
const parts = value?.split('.');
if (parts.length > 2) {
value = parts[0] + '.' + parts.slice(1).join('');
value = parts[0] + '.' + parts?.slice(1)?.join('');
}
onChange(value); // Pass the raw value to parent or use it directly

View File

@@ -51,6 +51,8 @@ const DataTable = ({
whiteSpace="normal" // Allow text to wrap
wordBreak="normal" // Ensure long words break properly
overflowWrap="normal" // Break long words if necessary
textTransform={'none'}
>
{isLoading ? <Skeleton height="20px" /> : heading}
{/* {heading} */}

View File

@@ -136,7 +136,7 @@ const DashboardLayout = ({ isOnline }) => {
case path.startsWith("/sponser"):
return (
<span className="d-flex align-items-end gap-2">
<RiMoneyDollarBoxLine className="h4 m-0" /> Sponsorer
<RiMoneyDollarBoxLine className="h4 m-0" /> Sponsor
</span>
);
case path.startsWith("/investment-type"):

View File

@@ -70,15 +70,6 @@ const DepositRequest = () => {
} = useGetDepositRequestQuery({ page: currentPage, size: pageSize });
useEffect(() => {
// Simulate loading
const timer = setTimeout(() => {
setIsLoading(false);
}, 1500);
// Cleanup the timer on component unmount
return () => clearTimeout(timer);
}, []);
// ====================================================[Table Setup]================================================================
const tableHeadRow = [
@@ -109,7 +100,7 @@ const DepositRequest = () => {
// ====================================================[Table Filter]================================================================
const filteredData = data?.data?.rows.filter((item) => {
// Filter by name (case insensitive)
const name = item?.createdAt;
const name = [item.firstName, item.lastName, item.countryName].filter(Boolean).join(' ');
const searchLower = searchTerm.toLowerCase();
const nameMatches = name.toLowerCase().includes(searchLower);
@@ -148,34 +139,34 @@ const DepositRequest = () => {
fontWeight={"500"}
className="d-flex align-items-center web-text-small"
>
{item?.principal?.investor_details?.clientReference_id}
{item?.clientReference_id}
</Text>
),
"First Name": (
<Box isTruncated={true} w={"70px"}>
<Text as={"span"} color={"teal.900"} fontWeight={"500"}>
{item?.principal?.firstName}
{item?.firstName}
</Text>
</Box>
),
"Last Name": (
<Box w={"70px"} isTruncated={true}>
<Text as={"span"} color={"teal.900"}>
{item?.principal?.lastName}
{item?.lastName}
</Text>
</Box>
),
Country: (
<Box w={"100px"} isTruncated={true}>
<Text as={"span"} color={"teal.900"}>
{item?.principal?.investor_details?.country?.countryName}
{item?.countryName}
</Text>
</Box>
),
"Phone Number": (
<Box w={"80px"} isTruncated={true}>
<Text as={"span"} color={"teal.900"}>
{item?.principal?.mobileNumber}
{item?.mobileNumber}
</Text>
</Box>
),
@@ -311,7 +302,7 @@ const DepositRequest = () => {
emptyMessage={`We don't have any Investment type `}
tableHeadRow={tableHeadRow}
data={extractedArray}
isLoading={isLoading}
isLoading={depositRequestLoading}
viewActionId={actionId}
setViewActionId={setActionId}
// totalPages={10}

View File

@@ -28,7 +28,7 @@ const FILE_TYPES = ["image/jpeg", "image/png", "image/gif"];
export const conformModalSchema = yup.object().shape({
investorAmount: yup.string().required("Investor amount is required"),
comment: yup.string().required("Comment is required"),
comment: yup.string().notRequired(),
supporting_FileName: yup.mixed().required("File is required"),
// .test("fileType", "Unsupported File Format", (value) => {
// return value && FILE_TYPES.includes(value.type);
@@ -64,10 +64,6 @@ const DepositRequestApprove = ({ isOpen, onClose, firstField, id, data:requestDa
}, [requestData, id])
const onSubmit = async(data) => {
setIsBtnLoading(true)
const formData = new FormData();

View File

@@ -64,15 +64,6 @@ const DepositHistory = () => {
} = useGetDepositHistoryQuery({ page: currentPage, size: pageSize });
useEffect(() => {
// Simulate loading
const timer = setTimeout(() => {
setIsLoading(false);
}, 1500);
// Cleanup the timer on component unmount
return () => clearTimeout(timer);
}, []);
// ====================================================[Table Setup]================================================================
const tableHeadRow = [
@@ -101,15 +92,15 @@ const DepositHistory = () => {
});
}, 300);
// ====================================================[Table Filter]================================================================
const filteredData = data?.data?.rows.filter((item) => {
// Filter by name (case insensitive)
const name = item.createdAt;
const searchLower = searchTerm.toLowerCase();
const nameMatches = name.toLowerCase().includes(searchLower);
// ====================================================[Table Filter]================================================================
const filteredData = data?.data?.rows.filter((item) => {
// Combine firstName, lastName, and countryName for filtering
const name = [item.firstName, item.lastName, item.countryName].filter(Boolean).join(' ');
const searchLower = searchTerm.toLowerCase();
const nameMatches = name.toLowerCase().includes(searchLower);
return nameMatches;
});
return nameMatches;
});
// const handleView = (id) => {
// setActionId(id);
@@ -139,34 +130,34 @@ const DepositHistory = () => {
fontWeight={"500"}
className="d-flex align-items-center web-text-small"
>
{item?.principal?.investor_details?.clientReference_id}
{item?.clientReference_id}
</Text>
),
"First Name": (
<Box isTruncated={true} w={"60px"}>
<Text as={"span"} color={"teal.900"} fontWeight={"500"}>
{item?.principal?.firstName}
{item?.firstName}
</Text>
</Box>
),
"Last Name": (
<Box w={"70px"} isTruncated={true}>
<Text as={"span"} color={"teal.900"}>
{item?.principal?.lastName}
{item?.lastName}
</Text>
</Box>
),
Country: (
<Box w={"80px"} isTruncated={true}>
<Text as={"span"} color={"teal.900"}>
{item?.principal?.investor_details?.country?.countryName}
{item?.countryName}
</Text>
</Box>
),
"Phone Number": (
<Box w={"80px"} isTruncated={true}>
<Text as={"span"} color={"teal.900"}>
{item?.principal?.mobileNumber}
{item?.mobileNumber}
</Text>
</Box>
),
@@ -304,7 +295,7 @@ const DepositHistory = () => {
tableHeadRow={tableHeadRow}
// setData={setExtractedArray}
data={extractedArray}
isLoading={isLoading}
isLoading={depositHistoryLoading}
viewActionId={actionId}
setViewActionId={setActionId}
setMouseEnteredId={setMouseEnteredId}

View File

@@ -15,6 +15,7 @@ import ViewIOdataHeader from "../ViewIO/ViewIOdataHeader";
import { useParams } from "react-router-dom";
import FullscreenLoaders from "../../../Components/Loaders/FullscreenLoaders";
import { useGetIOprepopulateDataQuery } from "../../../Services/io.service";
import UnderConstruction from "../../UnderConstruction";
const CreateIO = () => {
const id = useParams()?.id;
@@ -57,7 +58,8 @@ const CreateIO = () => {
},
{
label: "Investors",
Content: Investors,
// Content: Investors,
Content: UnderConstruction,
isDisabled: id ? false : true,
},
{

View File

@@ -27,7 +27,10 @@ import ToastBox from "../../../Components/ToastBox";
const investmentVideoSchema = yup.object().shape({
artifactName: yup.string().required("Artifact name is required"),
artifactStreamingURL: yup.string().required("Artifact streaming URL is required").url("Invalid URL format"),
artifactStreamingURL: yup.string()
.required("Artifact streaming URL is required")
.url("Invalid URL format")
.matches(/\.mp4$/, "URL must end with .mp4"),
});
const IOArtifactsAdd = ({ isOpen, onClose, firstField, actionId, setActionId, data }) => {

View File

@@ -286,6 +286,8 @@ const IODetails = ({ enableNextTab, index, data }) => {
section: " ",
width: "49%",
value: IObyID?.data?.holdingPeriod,
maxLength:20,
helperText:`Maximum length should be 20 characters. You have entered ${watch()?.holdingPeriod?.length || 0} characters.`
},
{
label: "Holding Period (Arabic)",
@@ -297,6 +299,8 @@ const IODetails = ({ enableNextTab, index, data }) => {
section: " ",
width: "49%",
value: IObyID?.data?.holdingPeriodArabic,
maxLength:20,
helperText:`Maximum length should be 20 characters. You have entered ${watch()?.holdingPeriodArabic?.length || 0} characters.`
},

View File

@@ -78,7 +78,7 @@ const IONAVDetails = () => {
fontWeight={"500"}
className="d-flex align-items-center web-text-small"
>
{`$ ${item.transactionAmount}`}
{`${item.transactionAmount}`}
</Text>
),
"Last NAV update": (
@@ -89,7 +89,7 @@ const IONAVDetails = () => {
fontWeight={"500"}
className="d-flex align-items-center web-text-small"
>
{item.previousNAVvalue && `$ ${item.previousNAVvalue}`}
{item.previousNAVvalue && `${item.previousNAVvalue}`}
</Text>
),
"Investment Closed": (
@@ -100,7 +100,7 @@ const IONAVDetails = () => {
fontWeight={"500"}
className="d-flex align-items-center web-text-small"
>
{item.initialNAVvalue&&`$ ${item.initialNAVvalue}`}
{item.initialNAVvalue&& `${item.initialNAVvalue}`}
</Text>
),
"Comments": (

View File

@@ -80,32 +80,26 @@ const KeyMeritsAdd = ({ isOpen, onClose, firstField, id, icons }) => {
setIsLoading(true);
try {
const res = await createKeyMerits({ data: formData, id });
console.log(res?.error?.status);
if (res?.data?.statusCode === 201) {
toast({
render: () => <ToastBox message={res?.data?.message} />,
});
setAlert(false);
onClose();
setIsLoading(false);
reset();
handleClose()
return;
}
if (res?.error?.data?.code === 400) {
if (res?.error?.status === 400 || res?.error?.status === 500 ) {
toast({
render: () => (
<ToastBox message={res?.error?.data?.message} status={"error"} />
),
});
setIsLoading(false);
onClose();
setAlert(false);
reset();
setFile(null);
setSelectedImageIcon(null);
setSelectedIcon("Select Icon");
return;
}
}
} catch (error) {
if (error) {
toast({
@@ -118,12 +112,7 @@ const KeyMeritsAdd = ({ isOpen, onClose, firstField, id, icons }) => {
});
}
setIsLoading(false);
onClose();
setAlert(false);
reset();
setFile(null);
setSelectedImageIcon(null);
setSelectedIcon("Select Icon");
handleClose()
}
reset();
};
@@ -147,6 +136,7 @@ const KeyMeritsAdd = ({ isOpen, onClose, firstField, id, icons }) => {
const handleClose = () => {
onClose();
setIsLoading(false);
setAlert(false);
reset();
setFile(null);

View File

@@ -59,6 +59,8 @@ const KeyMeritsEdit = ({
const [selectedImageIcon, setSelectedImageIcon] = useState(null);
const found = data?.find((item) => item?.id === actionId);
console.log(found);
const {
control,
@@ -71,6 +73,9 @@ const KeyMeritsEdit = ({
});
// useEffect to reset the form when `found` changes
useEffect(() => {
setValue("icon_xid", found?.icon?.id);
setSelectedIcon(found?.icon?.iconName); // Update selected icon name
setSelectedImageIcon(found?.icon?.iconFilePath);
if (found) {
reset({
meritsHeader: found?.meritsHeader,
@@ -91,10 +96,7 @@ const KeyMeritsEdit = ({
toast({
render: () => <ToastBox message={res?.data?.message} />,
});
setAlert(false);
onClose();
setIsLoading(false);
reset();
handleClose()
return;
}
if (res?.error?.data?.code === 400) {
@@ -103,10 +105,7 @@ const KeyMeritsEdit = ({
<ToastBox message={res?.error?.data?.message} status={"error"} />
),
});
setAlert(false);
onClose();
setIsLoading(false);
reset();
handleClose()
return;
}
} catch (error) {
@@ -121,10 +120,7 @@ const KeyMeritsEdit = ({
),
});
}
setIsLoading(false);
setAlert(false);
onClose();
reset();
handleClose()
}
reset();
};
@@ -140,6 +136,14 @@ const KeyMeritsEdit = ({
setSelectedImageIcon(iconFilePath);
};
const handleClose = () => {
setIsLoading(false);
setAlert(false);
onClose();
reset();
}
return (
<>
<Drawer

View File

@@ -1,3 +1,4 @@
import React, { useContext, useEffect, useState } from 'react';
import {
Box,
Button,
@@ -12,10 +13,93 @@ import {
ModalHeader,
ModalOverlay,
Text,
Textarea,
useToast,
} from "@chakra-ui/react";
import { useForm } from 'react-hook-form';
import * as yup from 'yup';
import { yupResolver } from '@hookform/resolvers/yup';
import GlobalStateContext from '../../../../Contexts/GlobalStateContext';
import { useParams } from 'react-router-dom';
import { useAmountIvestmentMutation } from '../../../../Services/io.service';
import ToastBox from '../../../../Components/ToastBox';
// Validation schema
const validationSchema = yup.object().shape({
transactionDate: yup.date().required('Date is required'),
Total_Amount: yup.number().required('Amount is required'),
amountInvested: yup.number().required('Amount to invest is required'),
IoCash: yup.number().positive('IO Cash must be positive').required('IO Cash is required'),
});
// Function to format currency
const formatCurrency = (value) => {
if (isNaN(value)) return '';
const formatted = parseFloat(value).toFixed(2).toString();
const [integer, decimal] = formatted.split('.');
const formattedInteger = integer.replace(/\B(?=(\d{3})+(?!\d))/g, ',');
return decimal ? `${formattedInteger}.${decimal}` : formattedInteger;
};
const AmountInvested = ({ isOpen, onClose }) => {
const params = useParams();
const toast = useToast();
const id = params?.id;
const { control, register, handleSubmit, reset, watch, formState: { errors } } = useForm({
resolver: yupResolver(validationSchema),
});
const [isLoading, setIsLoading] = useState(false);
const { IODetails } = useContext(GlobalStateContext);
const [amountInvested] = useAmountIvestmentMutation();
useEffect(() => {
if (IODetails?.goalAmount) {
const totalAmount = parseFloat(IODetails.goalAmount);
const ioCashUpdate = parseFloat(IODetails.goalAmount)
reset({
Total_Amount: totalAmount,
IoCash: ioCashUpdate,
});
}
}, [IODetails, reset]);
const onSubmit = async (data) => {
console.log(data);
setIsLoading(true);
try {
const res = await amountInvested({ data, id });
console.log(res);
if (res?.data?.statusCode === 200) {
toast({
render: () => <ToastBox message={res?.data?.message} />,
});
setIsLoading(false);
onClose();
} else if (res?.error?.status === 400) {
toast({
render: () => (
<ToastBox message={res?.error?.data?.message} status={"error"} />
),
});
setIsLoading(false);
}
} catch (error) {
setIsLoading(false);
}
};
const handleAmountChange = (e) => {
const amount = parseFloat(e.target.value) || 0;
const totalAmount = parseFloat(IODetails?.goalAmount) || 0;
const ioCash = (totalAmount - amount).toFixed(2);
reset({
amountInvested: parseFloat(amount),
IoCash: parseFloat(ioCash),
Total_Amount: IODetails?.goalAmount
});
};
return (
<Modal isOpen={isOpen} onClose={onClose}>
<ModalOverlay />
@@ -23,73 +107,92 @@ const AmountInvested = ({ isOpen, onClose }) => {
<ModalHeader fontSize={'md'}>Amount Invested</ModalHeader>
<ModalCloseButton />
<ModalBody>
<FormControl mb={"15px"}>
<FormLabel as={"label"} fontSize={"sm"} fontWeight={500}>
Date
</FormLabel>
<Input
placeholder="Select Date"
size="sm"
rounded={'sm'}
fontSize={"sm"}
focusBorderColor="forestGreen.300"
type="date"
/>
</FormControl>
<form onSubmit={handleSubmit(onSubmit)}>
<FormControl mb={"15px"} isInvalid={!!errors.transactionDate} isRequired>
<FormLabel as={"label"} fontSize={"sm"} fontWeight={500}>
Date
</FormLabel>
<Input
type="date"
{...register('transactionDate')}
size="sm"
rounded={'sm'}
fontSize={"sm"}
focusBorderColor="forestGreen.300"
/>
{errors.transactionDate && <Text color="red.500">{errors.transactionDate.message}</Text>}
</FormControl>
<FormControl mb={"15px"} >
<FormLabel as={"label"} fontSize={"sm"} fontWeight={500}>Amount</FormLabel>
<Input
size="sm"
rounded={'sm'}
textAlign={'end'}
readOnly
value={"$ 100000"}
focusBorderColor="forestGreen.300"
fontSize={"sm"} placeholder="$00.00" />
</FormControl>
<FormControl mb={"15px"} isInvalid={!!errors.Total_Amount} isReadOnly>
<FormLabel as={"label"} fontSize={"sm"} fontWeight={500}>Amount</FormLabel>
<Input
type="text"
value={formatCurrency(watch('Total_Amount'))}
size="sm"
rounded={'sm'}
textAlign={'end'}
focusBorderColor="forestGreen.300"
fontSize={"sm"}
readOnly
/>
{errors.Total_Amount && <Text color="red.500">{errors.Total_Amount.message}</Text>}
</FormControl>
<FormControl mb={"15px"} >
<FormLabel as={"label"} fontSize={"sm"} fontWeight={500}>Amount to invest</FormLabel>
<Input
size="sm"
rounded={'sm'}
textAlign={'end'}
focusBorderColor="forestGreen.300"
fontSize={"sm"} placeholder="$00.00" />
</FormControl>
<FormControl mb={"15px"} isInvalid={!!errors.amountInvested} isRequired>
<FormLabel as={"label"} fontSize={"sm"} fontWeight={500}>Amount to invest</FormLabel>
<Input
type="number"
{...register('amountInvested')}
size="sm"
rounded={'sm'}
textAlign={'end'}
focusBorderColor="forestGreen.300"
fontSize={"sm"}
onChange={handleAmountChange}
/>
{errors.amountInvested && <Text color="red.500">{errors.amountInvested.message}</Text>}
</FormControl>
<FormControl mb={"15px"}>
<FormLabel as={"label"} fontSize={"sm"} fontWeight={500}>
IO Cash
</FormLabel>
<Input
size="sm"
rounded={'sm'}
placeholder="$00.00"
focusBorderColor="forestGreen.300"
fontSize={"sm"} />
</FormControl>
<FormControl mb={"15px"} isInvalid={!!errors.IoCash}>
<FormLabel as={"label"} fontSize={"sm"} fontWeight={500}>
IO Cash
</FormLabel>
<Input
type="text"
value={formatCurrency(watch('IoCash'))}
size="sm"
rounded={'sm'}
focusBorderColor="forestGreen.300"
fontSize={"sm"}
textAlign={'right'}
readOnly
/>
{errors.IoCash && <Text color="red.500">{errors.IoCash.message}</Text>}
</FormControl>
<ModalFooter>
<Button
type="submit"
bg={"hsla(139, 100%, 14%, 1)"}
mr={3}
color={"#fff"}
_hover={{
bg: "hsl(139deg 98.99% 26.59%)",
}}
size={'sm'}
rounded={"sm"}
isLoading={isLoading}
>
Save
</Button>
<Button
size={'sm'}
rounded={"sm"} mr={3} onClick={onClose}>
Close
</Button>
</ModalFooter>
</form>
</ModalBody>
<ModalFooter>
<Button
bg={"hsla(139, 100%, 14%, 1)"}
mr={3}
color={"#fff"}
_hover={{
bg: "hsl(139deg 98.99% 26.59%)",
}}
size={'sm'}
rounded={"sm"}
>
Save
</Button>
<Button
size={'sm'}
rounded={"sm"} mr={3} onClick={onClose}>
Close
</Button>
</ModalFooter>
</ModalContent>
</Modal>
);

View File

@@ -1,9 +1,9 @@
import { ChevronDownIcon } from "@chakra-ui/icons";
import React, { useEffect, useState } from "react";
import {
Badge,
Button,
FormControl,
FormLabel,
Menu,
MenuButton,
@@ -16,39 +16,41 @@ import {
ModalFooter,
ModalHeader,
ModalOverlay,
FormErrorMessage
} from "@chakra-ui/react";
import {
useGetIOByIdQuery,
useGetIOprepopulateDataQuery,
useUpdateStatusIoMutation,
} from "../../../../Services/io.service";
import { useParams } from "react-router-dom";
const UpdateIOStatus = ({ isOpen, onClose , status}) => {
const UpdateIOStatus = ({ isOpen, onClose, status }) => {
const params = useParams();
const id = params?.id;
const [selectedItem, setSelectedItem] = useState(status?.[0]?.statusAdmin);
const [selectedItem, setSelectedItem] = useState();
const [isLoadingg, setIsLoading] = useState(false);
const { data, error, isLoading } = useGetIOprepopulateDataQuery();
const [error, setError] = useState("");
const [selectedStatusId, setSelectedStatusId] = useState(status?.[0]?.id);
useEffect(() => {
setSelectedItem(status?.[0]?.statusAdmin)
setSelectedStatusId(status?.[0]?.id)
}, [status])
const { data } = useGetIOprepopulateDataQuery();
const [updateStatusIo] = useUpdateStatusIoMutation();
useEffect(() => {
setSelectedStatusId(status?.[0]?.id);
}, [status]);
const handleMenuItemClick = (item, id) => {
setSelectedItem(item);
setSelectedStatusId(id);
};
const handleSubmit = async () => {
setIsLoading(true)
if (!selectedStatusId) {
setError("Status is required.");
return;
}
setError("");
setIsLoading(true);
try {
const res = await updateStatusIo({
data: {
@@ -57,109 +59,117 @@ const UpdateIOStatus = ({ isOpen, onClose , status}) => {
id,
});
console.log(res);
setIsLoading(false)
onClose()
} catch (error) {}
setIsLoading(false);
handleClose();
} catch (error) {
setIsLoading(false);
}
};
const handleClose = () => {
setSelectedItem("")
onClose()
}
return (
<Modal isOpen={isOpen} onClose={onClose}>
<Modal isOpen={isOpen} onClose={handleClose}>
<ModalOverlay />
<ModalContent>
<ModalHeader fontSize={"md"}>Update IO Status Transaction</ModalHeader>
<ModalCloseButton />
<ModalBody>
<FormLabel as={"label"} fontSize={"sm"} fontWeight={500}>
Status
</FormLabel>
<Menu>
<MenuButton
as={Button}
rightIcon={<ChevronDownIcon />}
fontSize={"sm"}
fontWeight={500}
w={"100%"}
textAlign={"left"}
>
<Badge
rounded={"full"}
pt={1.5}
pb={1.5}
ps={4}
pe={4}
mt={1.5}
mb={1.5}
textTransform={"none"}
colorScheme={
selectedItem === "Draft"
? "gray"
: selectedItem === "Processing"
? "yellow"
: selectedItem === "Open"
? "blue"
: selectedItem === "Closed"
? "green"
: selectedItem === "Exited"
? "red"
: selectedItem === "Canclled"
? "orange"
: "purple"
}
py={"3px"} px={"8px"}>
{selectedItem ? selectedItem: "No action"}
</Badge>
</MenuButton>
<MenuList w={"400px"}>
{status?.map(({ id, statusAdmin }) => (
<MenuItem
key={id}
fontSize={"sm"}
onClick={() => handleMenuItemClick(statusAdmin, id)}
>
<FormControl isInvalid={!!error}>
<FormLabel as={"label"} fontSize={"sm"} fontWeight={500}>
Status
</FormLabel>
<Menu>
<MenuButton
as={Button}
rightIcon={<ChevronDownIcon />}
fontSize={"sm"}
fontWeight={500}
w={"100%"}
textAlign={"left"}
>
{selectedItem ? (
<Badge
rounded={"full"}
pt={1.5}
pb={1.5}
ps={4}
pe={4}
mt={1.5}
mb={1.5}
textTransform={"none"}
// variant={"solid"}
colorScheme={
statusAdmin === "Draft"
? "gray"
: statusAdmin === "Processing"
? "yellow"
: statusAdmin === "Open"
? "blue"
: statusAdmin === "Closed"
? "green"
: statusAdmin === "Exited"
? "red"
: statusAdmin === "Canclled"
? "orange"
: "purple"
}
py={"1px"} px={"8px"}>
{statusAdmin}
rounded={"full"}
pt={1.5}
pb={1.5}
ps={4}
pe={4}
mt={1.5}
mb={1.5}
textTransform={"none"}
colorScheme={
selectedItem === "Draft"
? "gray"
: selectedItem === "Processing"
? "yellow"
: selectedItem === "Open"
? "blue"
: selectedItem === "Closed"
? "green"
: selectedItem === "Exited"
? "red"
: selectedItem === "Canclled"
? "orange"
: "purple"
}
py={"3px"} px={"8px"}
>
{selectedItem}
</Badge>
</MenuItem>
))}
</MenuList>
</Menu>
) : "Select Item"}
</MenuButton>
{status?.length > 0 ?<MenuList w={"400px"}>
{status?.map(({ id, statusAdmin }) => (
<MenuItem
key={id}
fontSize={"sm"}
onClick={() => handleMenuItemClick(statusAdmin, id)}
>
<Badge
rounded={"full"}
pt={1.5}
pb={1.5}
ps={4}
pe={4}
mt={1.5}
mb={1.5}
textTransform={"none"}
colorScheme={
statusAdmin === "Draft"
? "gray"
: statusAdmin === "Processing"
? "yellow"
: statusAdmin === "Open"
? "blue"
: statusAdmin === "Closed"
? "green"
: statusAdmin === "Exited"
? "red"
: statusAdmin === "Canclled"
? "orange"
: "purple"
}
py={"1px"} px={"8px"}
>
{statusAdmin}
</Badge>
</MenuItem>
))}
</MenuList>:""}
</Menu>
<FormErrorMessage fontSize={'xs'} fontWeight={600} >{error}</FormErrorMessage>
</FormControl>
</ModalBody>
<ModalFooter>
<Button
// bg={"hsla(139, 100%, 14%, 1)"}
colorScheme="forestGreen"
mr={3}
color={"#fff"}
// _hover={{
// bg: "hsl(139deg 98.99% 26.59%)",
// }}
size={"sm"}
rounded={"sm"}
onClick={handleSubmit}
@@ -167,7 +177,7 @@ const UpdateIOStatus = ({ isOpen, onClose , status}) => {
>
Save
</Button>
<Button size={"sm"} rounded={"sm"} mr={3} onClick={onClose}>
<Button size={"sm"} rounded={"sm"} mr={3} onClick={handleClose}>
Close
</Button>
</ModalFooter>

View File

@@ -35,6 +35,7 @@ import IOArtifacts from "../CreateIO/IOArtifacts";
import IOCashDetails from "../CreateIO/IOCashDetails";
import IONAVDetails from "../CreateIO/IONAVDetails";
import { useGetIOprepopulateDataQuery } from "../../../Services/io.service";
import UnderConstruction from "../../UnderConstruction";
const ViewIOdata = () => {
@@ -51,10 +52,12 @@ const ViewIOdata = () => {
{ label: "Investment documents", content: <InvestmentDocument data={data?.data} /> },
{ label: "Key merits", content: <KeyMerits data={data?.data} /> },
{ label: "IO artifacts", content: <IOArtifacts data={data?.data} /> },
{ label: "Investors", content: <Investors data={data?.data} /> },
// { label: "Investors", content: <Investors data={data?.data} /> },
{ label: "Investors", content: <UnderConstruction h={'75vh'} /> },
{ label: "IO Cash Details", content: <IOCashDetails data={data?.data} /> },
{ label: "IO NAV Details", content: <IONAVDetails data={data?.data} /> },
{ label: "Distribution to Investors", content: <IONAVDetails data={data?.data} /> },
// { label: "Distribution to Investors", content: <IONAVDetails data={data?.data} /> },
{ label: "Distribution to Investors", content: <UnderConstruction h={'75vh'} /> },
];
return (

View File

@@ -23,6 +23,7 @@ import {
Badge,
Box,
Icon,
HStack,
} from "@chakra-ui/react";
import header from "../../../assets/IOheader.png";
import { HiDotsVertical } from "react-icons/hi";
@@ -40,6 +41,7 @@ import Cancle from "./HeaderModal/Cancle";
import { AddIcon } from "@chakra-ui/icons";
import { GrGallery } from "react-icons/gr";
import Loader01 from "../../../Components/Loaders/Loader01";
import { formatCurrency } from "../../../Components/CurrencyInput";
const ViewIOdataHeader = ({data, isLoading}) => {
const params = useParams();
@@ -156,7 +158,9 @@ const filteredMenu = menu?.filter(item => apiTransactionTitles?.includes(item.id
console.log(isLoading);
console.log(IODetails?.ioNAV);
console.log(IODetails?.ioCash);
console.log(IODetails?.ioMVNAV);
@@ -166,7 +170,7 @@ console.log(isLoading);
<Box
display={"flex"}
alignItems={"center"}
justifyContent={"start"}
justifyContent={"space-between"}
gap={8}
bg={
IODetails?.ioStatus?.statusAdmin === "Draft"
@@ -198,7 +202,7 @@ console.log(isLoading);
<HStack gap={8}>
<Box h={100} w={200} p={1.5}>
{/* <Image rounded={'md'} h={"100%"} src={ " https://tanami.betadelivery.com/" + IODetails?.ioName} alt={IODetails?.ioName}/> */}
{IODetails?.artifactsImage?.[0]?.artifactPathName ? (
@@ -249,6 +253,10 @@ console.log(isLoading);
: "---"}
</Text>
</Box>
</HStack>
<HStack gap={8} me={20}>
<Box display={"flex"} flexDirection={"column"} gap={2}>
<Text as={"span"} textAlign={'center'} fontSize={"xs"} color={"gray.500"} fontWeight={"500"}>
@@ -290,7 +298,7 @@ console.log(isLoading);
IO NAV
</Text>
<Text as={"span"} fontSize={"sm"} fontWeight={"500"}>
{IODetails?.currentValuation ? IODetails?.currentValuation : "00.00"}
{IODetails?.ioNAV ? formatCurrency(IODetails?.ioNAV) : "00.00"}
</Text>
</Box>
@@ -308,10 +316,12 @@ console.log(isLoading);
IO MV NAV
</Text>
<Text as={"span"} fontSize={"sm"} fontWeight={"500"}>
{IODetails?.marketValue ? IODetails?.marketValue : "00.00"}
{IODetails?.ioMVNAV ? formatCurrency(IODetails?.ioMVNAV) : "00.00"}
</Text>
</Box>
</HStack>
<Box
position={"absolute"}
right={3}

View File

@@ -108,7 +108,7 @@ const InvestorDetails = () => {
// ====================================================[Table Filter]================================================================
const filteredData = investorDetails?.data?.rows?.filter((item) => {
// Filter by name (case insensitive)
const name = item.clientReference_id;
const name = [item?.principal?.firstName, item?.principal?.lastName, item?.country?.countryName, item?.principal?.mobileNumber, item?.principal?.emailAddress].filter(Boolean).join(' ');
const searchLower = searchTerm.toLowerCase();
const nameMatches = name?.toLowerCase().includes(searchLower);

View File

@@ -54,7 +54,7 @@ const AddSponser = () => {
const [isLoadingBtn, setIsLoadingBtn] = useState(false);
const [alert, setAlert] = useState(false);
const [form, setForm] = useState();
const [isSwitchOn, setIsSwitchOn] = useState();
const [isSwitchOn, setIsSwitchOn] = useState(true);
const [createSponser] = useCreateSponserMutation();
const [updateSponser] = useUpdateSponserMutation();
@@ -62,9 +62,6 @@ const AddSponser = () => {
// Fetch sponsor data only if id exists
const {data: sponserByIdData,error,isLoading,} = useGetSponserByIdQuery(id, {skip: !id,});
console.log(sponserByIdData);
// ======================== [validators] ===========================
const {
@@ -124,15 +121,15 @@ const AddSponser = () => {
setIsLoadingBtn(false);
setAlert(false);
navigate("/sponser");
} else {
} else if(response?.error?.status === 400) {
toast({
render: () => (
<ToastBox message={"Something Went Wrong"} status={"error"} />
<ToastBox message={response?.error?.data?.message} status={"error"} />
),
});
setIsLoadingBtn(false);
navigate("/sponser");
setAlert(false)
}
});
} catch (error) {
@@ -179,22 +176,22 @@ const AddSponser = () => {
const formFields = [
{
label: "Sponser name (English)",
label: "Sponsor name (English)",
placeHolder: " ",
name: "sponsorName",
type: "text",
isRequired: true,
section: "Add Details",
section: "",
maxLength:50,
helperText:`Maximum length should be 50 characters. You have entered ${watch()?.sponsorName?.length || 0} characters.`
},
{
label: "Sponser name (Arabic)",
label: "Sponsor name (Arabic)",
name: "sponsorNameArabic",
placeHolder: " ",
type: "text",
isRequired: true,
section: "Add Details",
section: "",
arabic: true,
right: true,
maxLength:55,
@@ -206,7 +203,7 @@ const AddSponser = () => {
placeHolder: " ",
type: "email",
// isRequired: true,
section: "Add Details",
section: "",
},
];
@@ -214,22 +211,22 @@ const AddSponser = () => {
const formEditFields = [
{
label: "Sponser name",
label: "Sponsor name",
placeHolder: " ",
name: "sponsorName",
type: "text",
isRequired: true,
section: "Add Details",
section: "",
maxLength:55,
helperText:`Maximum length should be 55 characters. You have entered ${watch()?.sponsorName?.length || 0} characters.`
},
{
label: "Sponser name (Arabic)",
label: "Sponsor name (Arabic)",
name: "sponsorNameArabic",
placeHolder: " ",
type: "text",
isRequired: true,
section: "Add Details",
section: "",
arabic: true,
maxLength:55,
helperText:`Maximum length should be 55 characters. You have entered ${watch()?.sponsorNameArabic?.length || 0} characters.`
@@ -240,7 +237,7 @@ const AddSponser = () => {
placeHolder: " ",
type: "email",
// isRequired: true,
section: "Add Details",
section: "",
},
];

View File

@@ -158,9 +158,21 @@ const Sponser = () => {
setIsLoading(true);
try {
const response = await deleteSponser(actionId);
console.log(response);
setIsLoading(false);
setDeleteAlert(false);
console.log(response?.data);
if(response?.error?.data?.code === 400){
toast({
render: () => <ToastBox message={response?.error?.data?.message} status={'error'} />,
});
setIsLoading(false);
setDeleteAlert(false);
} else if(response?.data?.statusCode === 201 || response?.data?.statusCode === 200){
toast({
render: () => <ToastBox message={response?.data?.message} status={'error'} />,
});
setIsLoading(false);
setDeleteAlert(false);
}
} catch (error) {}
};

View File

@@ -3,10 +3,10 @@ import React from 'react'
// import noInternet from "../assets/Error.svg"
import robot from "../assets/under-construction.png"
const UnderConstruction = ({title}) => {
const UnderConstruction = ({title, h}) => {
return (
<Box
h={'100vh'}
h={h?h:'100vh'}
display={'flex'}
justifyContent={'center'}
alignItems={'center'}

View File

@@ -39,7 +39,7 @@ export const RouteLink = [
// =============[ Tanami ]================
// ===============[ Management]===============
// { path: "/", Component: Dashbaord },
{ path: "/", Component: Sponser },
{ path: "/sponser", Component: Sponser },
{ path: "/sponser/add-sponser/:id", Component: AddSponser },
{ path: "/sponser/add-sponser", Component: AddSponser },

View File

@@ -231,6 +231,22 @@ export const ioService = createApi({
// =====[ Amount Investment ]
amountIvestment : builder.mutation({
query: ({ data, id }) => ({
url: `/io/admin/amount-invested/${id}`,
method: "POST",
body: data,
}),
invalidatesTags: ["getIOById"],
}),
@@ -277,5 +293,11 @@ export const {
useUpdateStatusIoMutation
useUpdateStatusIoMutation,
useAmountIvestmentMutation,
} = ioService;