diff --git a/src/Components/DataTable/DataTable.jsx b/src/Components/DataTable/DataTable.jsx index 94be903..539cded 100644 --- a/src/Components/DataTable/DataTable.jsx +++ b/src/Components/DataTable/DataTable.jsx @@ -97,7 +97,7 @@ const DataTable = ({ bg: "blue.50", cursor: "grab", }} - bg={snapshot.isDragging ? "blue.100" : "white"} + bg={snapshot.isDragging ? "blue.100" : index % 2 ? "white" : "gray.50"} boxShadow={snapshot.isDragging ? "0 0 1em rgba(0, 0, 0, 0.2)" : "none"} > @@ -121,7 +121,7 @@ const DataTable = ({ )} ) : ( - + {tableHeadRow.map((heading, i) => ( {total? total :"Tanami v1.0.0"} - + {tableHeadRow.map((heading, index) => ( )) : data?.map((item, index) => ( - + {tableHeadRow.map((heading, i) => ( new Date(date).toLocaleDateString(); // Simple date formatter +export const formatDate = (date) => new Date(date).toLocaleDateString(); // Simple date formatter const DepositRequest = () => { const navigate = useNavigate(); diff --git a/src/Pages/Deposit/DepositRequest/DepositRequestApprove.jsx b/src/Pages/Deposit/DepositRequest/DepositRequestApprove.jsx index ee64021..462856a 100644 --- a/src/Pages/Deposit/DepositRequest/DepositRequestApprove.jsx +++ b/src/Pages/Deposit/DepositRequest/DepositRequestApprove.jsx @@ -24,6 +24,7 @@ import { useForm } from "react-hook-form"; import { useGetDepositRequestByIdQuery, useGetDepositRequestQuery, useUpdateDepositRequestMutation } from "../../../Services/deposit.request.service"; import FullscreenLoaders from "../../../Components/Loaders/FullscreenLoaders"; import ToastBox from "../../../Components/ToastBox"; +import { formatCurrency } from "../../../Components/CurrencyInput"; const FILE_TYPES = ["image/jpeg", "image/png", "image/gif"]; @@ -41,8 +42,7 @@ const DepositRequestApprove = ({ isOpen, onClose, firstField, id, data:requestDa const [file, setFile] = useState(); const [isBtnLoading , setIsBtnLoading] = useState(false) - const fileredData = requestData?.find((item)=> item?.id === id) - console.log(fileredData); + @@ -51,25 +51,30 @@ const DepositRequestApprove = ({ isOpen, onClose, firstField, id, data:requestDa skip: !id, }); + console.log(data?.data?.investorAmount); + const { register, reset, + watch, handleSubmit, formState: { errors }, } = useForm({ resolver: yupResolver(conformModalSchema), }); - - useEffect(() => { - reset({ - investorAmount:fileredData?.investorAmount - }) - - }, [requestData, id]) + useEffect(() => { + if (data) { + const investorAmount = parseFloat(data?.data?.investorAmount); + reset({ + investorAmount: investorAmount, + accountName: data?.data?.accountName, + }); + } + }, [id, data, reset]); const onSubmit = async(data) => { setIsBtnLoading(true) @@ -108,20 +113,6 @@ const DepositRequestApprove = ({ isOpen, onClose, firstField, id, data:requestDa heandleOnClose(); }; - const handleFileChange = (event) => { - const selectedFile = event.target.files[0]; - setFile(selectedFile); - }; - - - useEffect(() => { - if (data) { - reset({ - investorAmount: data?.data?.investorAmount, - accountName:data?.data?.accountName - }); - } - }, [data, reset]); const heandleOnClose = () =>{ reset() @@ -141,11 +132,13 @@ const DepositRequestApprove = ({ isOpen, onClose, firstField, id, data:requestDa - Deposit Amount {fileredData?.currencyCode} + Deposit Amount {data?.data?.currencyCode} { + console.log("hit"); setIsLoading(true); const formData = new FormData(); formData.append("artifactName", data.artifactName); @@ -95,6 +96,7 @@ const IOArtifactsAdd = ({ data: formData, id: found?.id, }); + if (res?.data?.statusCode === 200) { toast({ render: () => , @@ -108,6 +110,20 @@ const IOArtifactsAdd = ({ artifactName: "", artifactPathName: "", }); + } else{ + toast({ + render: () => , + }); + setFile(null); + setIsLoading(false); + setAlert(false); + setPreview(null); + onClose(); + reset({ + artifactName: "", + artifactPathName: "", + }); + } if (res?.error) { @@ -184,6 +200,11 @@ const IOArtifactsAdd = ({ } } + const handleAlertClose = () =>{ + setAlert(false) + setIsLoading(false) + } + return ( <> @@ -225,7 +246,7 @@ const IOArtifactsAdd = ({ Artifact Image setAlert(false)} + onClose={handleAlertClose} alertHandler={handleSave} message={"Are you sure you want to add this artifact?"} isLoading={loading} diff --git a/src/Pages/Investor_Management/InvestorDetails/Transaction.jsx b/src/Pages/Investor_Management/InvestorDetails/Transaction.jsx index b0cd917..7efd758 100644 --- a/src/Pages/Investor_Management/InvestorDetails/Transaction.jsx +++ b/src/Pages/Investor_Management/InvestorDetails/Transaction.jsx @@ -55,13 +55,13 @@ import { // ====================================================[Table Setup]================================================================ const tableHeadRow = [ - "Sr N/O", + // "Sr N/O", "Date", "Transaction", - "Currency", - "Amount", - "From USD", + "Amount in investors currency", + // "Currency", "TO USD", + "From USD", "USD amount", "IO Name", "Payment Method", @@ -108,7 +108,7 @@ console.log(transaction); "Date": ( - {item.transactionDate} + {formatDate(item.transactionDate)} ), @@ -126,8 +126,8 @@ console.log(transaction); ), - "Amount": ( - + "Amount in investors currency": ( + {/* {item.investorAmount} */} {parseFloat(item?.investorAmount || 0).toLocaleString(undefined, { diff --git a/src/Pages/Investor_Management/InvestorDetails/ViewInvestorDetails.jsx b/src/Pages/Investor_Management/InvestorDetails/ViewInvestorDetails.jsx index 44cb097..f871af0 100644 --- a/src/Pages/Investor_Management/InvestorDetails/ViewInvestorDetails.jsx +++ b/src/Pages/Investor_Management/InvestorDetails/ViewInvestorDetails.jsx @@ -60,7 +60,7 @@ const ViewInvestorDetails = () => { // ====================================================[Table Setup]================================================================ const tableHeadRow = [ - "Sr N/O", + // "Sr N/O", "Deal Name", "Sponsor Name", "Investment Amount", diff --git a/src/Pages/WithDrawal/DrawalRequest/PendingRequest.jsx b/src/Pages/WithDrawal/DrawalRequest/PendingRequest.jsx index 29f436e..423b85d 100644 --- a/src/Pages/WithDrawal/DrawalRequest/PendingRequest.jsx +++ b/src/Pages/WithDrawal/DrawalRequest/PendingRequest.jsx @@ -97,7 +97,7 @@ const PendingRequest = () => { // ====================================================[Table Setup]================================================================ const tableHeadRow = [ - "Sr.no", + // "Sr.no", "Date", "Client ID", "First Name", @@ -181,7 +181,6 @@ const PendingRequest = () => { Currency: ( - {/* {parseFloat(item?.investorAmount||0).toLocaleString(undefined, { minimumFractionDigits: 2, maximumFractionDigits: 2 })} */} {item?.currencyCode} diff --git a/src/Pages/WithDrawal/DrawalView/ViewHistory.jsx b/src/Pages/WithDrawal/DrawalView/ViewHistory.jsx index 6696033..f6d2a79 100644 --- a/src/Pages/WithDrawal/DrawalView/ViewHistory.jsx +++ b/src/Pages/WithDrawal/DrawalView/ViewHistory.jsx @@ -65,15 +65,7 @@ const ViewHistory = () => { // console.log(data?.data?.rows); - useEffect(() => { - // Simulate loading - const timer = setTimeout(() => { - setIsLoading(false); - }, 1500); - - // Cleanup the timer on component unmount - return () => clearTimeout(timer); - }, []); + // ====================================================[Table Filter]================================================================ const filteredData = data?.data?.rows.filter((item) => { @@ -96,16 +88,16 @@ const ViewHistory = () => { // ====================================================[Table Setup]================================================================ const tableHeadRow = [ - "Sr.no", + // "Sr.no", "Date", "Client ID", "First Name", "Last Name", "Country", "Phone Number", - "Currency", - "Withdrawal Amount", + // "Currency", "Amount in Investor currency", + "Withdrawal Amount", "Status", ]; @@ -148,35 +140,35 @@ const ViewHistory = () => { ), "First Name": ( - + {item.firstName} ), "Last Name": ( - + {item.lastName} ), Country: ( - + {item.countryName} ), "Phone Number": ( - + {item.mobileNumber} ), Currency: ( - + {item.currencyCode} @@ -185,16 +177,16 @@ const ViewHistory = () => { ), "Withdrawal Amount": ( - + - {item.USDAmount} + ${parseFloat(item?.USDAmount||0).toLocaleString(undefined, { minimumFractionDigits: 2, maximumFractionDigits: 2 })} ), "Amount in Investor currency": ( - + - {item.investorAmount} + {parseFloat(item?.investorAmount||0).toLocaleString(undefined, { minimumFractionDigits: 2, maximumFractionDigits: 2 })}{item?.currencyCode} ), @@ -279,7 +271,7 @@ const ViewHistory = () => { emptyMessage={`We don't have any Sponers `} tableHeadRow={tableHeadRow} data={extractedArray} - isLoading={isLoading} + isLoading={drawalHistoryLoading} viewActionId={actionId} setViewActionId={setActionId} // totalPages={10}