diff --git a/src/Pages/Dashbaord.jsx b/src/Pages/Dashbaord.jsx
index 5f71e43..dda5aeb 100644
--- a/src/Pages/Dashbaord.jsx
+++ b/src/Pages/Dashbaord.jsx
@@ -126,12 +126,12 @@ const Dashbaord = () => {
-
+
- Exchange rate currency
-
- {/* */}
+ {/* Exchange rate currency
+ */}
+
diff --git a/src/Pages/IO_Management/CreateIO/AddIONav.jsx b/src/Pages/IO_Management/CreateIO/AddIONav.jsx
new file mode 100644
index 0000000..ad7c533
--- /dev/null
+++ b/src/Pages/IO_Management/CreateIO/AddIONav.jsx
@@ -0,0 +1,234 @@
+import {
+ Box,
+ Button,
+ Drawer,
+ DrawerBody,
+ DrawerCloseButton,
+ DrawerContent,
+ DrawerFooter,
+ DrawerHeader,
+ DrawerOverlay,
+ FormControl,
+ FormErrorMessage,
+ FormLabel,
+ Input,
+ Select,
+ Stack,
+ Textarea,
+ useToast,
+ } from "@chakra-ui/react";
+ import * as yup from "yup";
+ import React, { useState, useEffect, useContext } from "react";
+ import { useForm, Controller } from "react-hook-form";
+ import { yupResolver } from "@hookform/resolvers/yup";
+ import CustomAlertDialog from "../../../Components/CustomAlertDialog";
+ import { v4 as uuidv4 } from "uuid";
+ import { useCreateIoCashMutation, useCreateIoNavMutation, useCreateVideoArtifactsMutation, useUpdateVideoArtifactsMutation } from "../../../Services/io.service";
+ import { useParams } from "react-router-dom";
+ import ToastBox from "../../../Components/ToastBox";
+ import GlobalStateContext from "../../../Contexts/GlobalStateContext";
+ import CurrencyInput from "../../../Components/CurrencyInput";
+import { formatDatee } from "../../../Components/FormField";
+
+ const ioNav = yup.object().shape({
+ transactionDate: yup.string().required("Artifact name is required"),
+ transactionAmount: yup.number().required("Artifact name is required"),
+ comments: yup.string().notRequired(),
+ });
+
+ const AddIONav = ({ isOpen, onClose, firstField, actionId, setActionId, data }) => {
+ const params = useParams()
+ const id = params?.id
+ const [file, setFile] = useState("");
+ const [fileName, setFileName] = useState("");
+ const [isLoading, setIsLoading] = useState(false)
+ const [alert, setAlert] = useState(false);
+ const toast = useToast();
+
+
+
+ // ======================[ Cotext Api ]
+ const { IODetails } = useContext(GlobalStateContext);
+ const found = data?.find((item) => item?.id === actionId);
+
+
+ const [createIoNav] = useCreateIoNavMutation()
+ // const {
+ // data
+ // } = useGetArtifactsQuery(id)
+
+ const {
+ control,
+ handleSubmit,
+ watch,
+ reset,
+ formState: { errors },
+ } = useForm({
+ resolver: yupResolver(ioNav),
+ });
+
+
+ const [createIoCash] = useCreateIoCashMutation()
+
+
+ const onSubmit = async (data) => {
+
+ setIsLoading(true)
+
+ try {
+
+ const res = await createIoNav({ data, id })
+ if (res?.data?.statusCode === 201) {
+ setIsLoading(false);
+ toast({
+ render: () => ,
+ });
+ handleClose()
+ }else if(res?.error?.status === 400){
+ setIsLoading(false);
+ toast({
+ render: () => ,
+ });
+ }
+
+
+ } catch (error) {
+ console.log(error);
+
+ }
+
+ };
+
+
+
+ const handleConfirm = () => {
+ handleSubmit(onSubmit)();
+ };
+
+ const handleSave = () => {
+ handleSubmit(onSubmit)();
+ };
+
+ const handleClose = () => {
+ setAlert(false)
+ onClose()
+ reset({
+ transactionDate:"",
+ transactionAmount:"",
+ comments:""
+ })
+ }
+
+
+
+
+const today = formatDatee(new Date(), 'yyyy-MM-dd');
+
+
+
+ return (
+ <>
+
+
+
+
+ IO Nav Details
+
+
+
+
+ Date Selection
+ (
+
+ )}
+ />
+
+ {errors.transactionDate?.message}
+
+
+
+
+
+
+ Transaction Amount
+ (
+
+ )}
+ />
+
+ {errors.transactionAmount?.message}
+
+
+
+
+
+
+ Comments
+ (
+
+ )}
+ />
+
+ {errors.comments?.message}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ setAlert(false)}
+ alertHandler={handleSave}
+ message={"Are you sure you want to add NAV details?"}
+ isLoading={isLoading}
+ />
+ >
+ );
+ };
+
+ export default AddIONav;
+
\ No newline at end of file
diff --git a/src/Pages/IO_Management/CreateIO/IONAVDetails.jsx b/src/Pages/IO_Management/CreateIO/IONAVDetails.jsx
index febb978..6a9c277 100644
--- a/src/Pages/IO_Management/CreateIO/IONAVDetails.jsx
+++ b/src/Pages/IO_Management/CreateIO/IONAVDetails.jsx
@@ -1,14 +1,19 @@
-import React, { useContext, useEffect, useState } from 'react'
+import React, { useContext, useEffect, useRef, useState } from 'react'
import GlobalStateContext from '../../../Contexts/GlobalStateContext';
-import { Box, HStack, Input,Text, Table, Tbody, Th, Tr } from '@chakra-ui/react';
+import { Box, HStack, Input,Text, Table, Tbody, Th, Tr, Avatar, useDisclosure,Button } from '@chakra-ui/react';
import { OPACITY_ON_LOAD } from '../../../Layout/animations';
import Pagination from '../../../Components/Pagination';
-import DataTable from '../../../Components/DataTable/DataTable';
+import NormalTable from '../../../Components/DataTable/NormalTable';
import CustomAlertDialog from '../../../Components/CustomAlertDialog';
+import { formatDatee } from '../../../Components/FormField';
+import { AddIcon } from '@chakra-ui/icons';
+import AddIONav from './AddIONav';
const IONAVDetails = () => {
- const { navDetails, setNavDetails, slideFromRight } =
+ const { navDetails, setNavDetails, IODetails } =
useContext(GlobalStateContext);
+ const firstField = useRef();
+ const { isOpen, onOpen, onClose } = useDisclosure();
const [searchTerm, setSearchTerm] = useState("");
const [isLoading, setIsLoading] = useState(true);
const [deleteAlert, setDeleteAlert] = useState(false);
@@ -16,6 +21,10 @@ const IONAVDetails = () => {
const [mouseEntered, setMouseEntered] = useState(false);
const [mouseEnteredId, setMouseEnteredId] = useState("");
+
+ console.log(IODetails?.ioNAVHistory);
+
+
useEffect(() => {
// Simulate loading
@@ -29,50 +38,74 @@ const IONAVDetails = () => {
// Table setup
const tableHeadRow = [
- "Sr.No",
- "As On Date",
- "IO NAV Value",
+ // "Sr.No",
+ "Valuation Date",
+ "NAV",
+ "Last NAV update",
+ "Investment Closed",
"Comments",
"Update by ",
- "Update On",
+ // "Update On",
];
// Table filter
- const filteredData = navDetails?.filter((item) => {
- const name = item.updateBy;
+ const filteredData = IODetails?.ioNAVHistory?.filter((item) => {
+ const name = item.transactionType;
const searchLower = searchTerm.toLowerCase();
const nameMatches = name.toLowerCase().includes(searchLower);
return nameMatches;
});
- const [ extractedArray, setExtractedArray ] = useState(filteredData?.map((item, index) => ({
+ const extractedArray=filteredData?.map((item, index) => ({
id: item?.id,
"Sr.No": index +1,
- "As On Date": (
+ "Valuation Date": (
- {item.date}
+ {formatDatee(item.transactionDate)}
),
- "IO NAV Value": (
+ "NAV": (
- {`$${item.IONavValue}`}
+ {`$ ${item.transactionAmount}`}
+
+ ),
+ "Last NAV update": (
+
+ {item.previousNAVvalue && `$ ${item.previousNAVvalue}`}
+
+ ),
+ "Investment Closed": (
+
+ {item.initialNAVvalue&&`$ ${item.initialNAVvalue}`}
),
"Comments": (
{
),
"Update by ": (
- {item.updateBy}
+
+ Faisal
),
"Update On": (
{
{item.updateOn}
),
- })));
+ }));
@@ -145,15 +180,18 @@ const IONAVDetails = () => {
{/*
*/}
+
+
+{IODetails?.isInvestedAmount ? :null}
+
- {
alertHandler={handleDelete}
isLoading={isLoading}
/>
+
+
+
+
+
+
)
}
diff --git a/src/Pages/IO_Management/IOArtifactsAdd.jsx b/src/Pages/IO_Management/IOArtifactsAdd.jsx
index c8a2ced..18a530b 100644
--- a/src/Pages/IO_Management/IOArtifactsAdd.jsx
+++ b/src/Pages/IO_Management/IOArtifactsAdd.jsx
@@ -116,7 +116,10 @@ const IOArtifactsAdd = ({
toast({
render: () => ,
});
- reset();
+ reset({
+ artifactName: "",
+ artifactPathName: "",
+ });
setFile(null);
setIsLoading(false);
setAlert(false);
diff --git a/src/Pages/IO_Management/KeyMeritsAdd.jsx b/src/Pages/IO_Management/KeyMeritsAdd.jsx
index dab9a79..e3102e0 100644
--- a/src/Pages/IO_Management/KeyMeritsAdd.jsx
+++ b/src/Pages/IO_Management/KeyMeritsAdd.jsx
@@ -305,7 +305,7 @@ const KeyMeritsAdd = ({ isOpen, onClose, firstField, id, icons }) => {
-
+
{icons?.map(({ iconName, id, iconFilePath }) => (
diff --git a/src/Pages/IO_Management/ViewIO/ViewIOTable.jsx b/src/Pages/IO_Management/ViewIO/ViewIOTable.jsx
index c71ceb7..bd4b0e3 100644
--- a/src/Pages/IO_Management/ViewIO/ViewIOTable.jsx
+++ b/src/Pages/IO_Management/ViewIO/ViewIOTable.jsx
@@ -144,21 +144,30 @@ const ViewIOTable = () => {
"IO Status": (
{
title:"Distribution To Investors",
onClickFunction:onDistInvestorOpen
},
- // {
- // id:5,
- // title:"Update IO NAV",
- // onClickFunction:onUpdateNavOpen
- // },
+ {
+ id:5,
+ title:"Update IO NAV",
+ onClickFunction:onUpdateNavOpen
+ },
{
id:8,
title:"Exit",
@@ -234,23 +234,30 @@ console.log(filteredMenu);
IO Status
{IODetails?.ioStatus?.statusAdmin