From b620cd410d724f8400117765e4486130da49d749 Mon Sep 17 00:00:00 2001
From: YasinShaikh123 <123150391+YasinShaikh123@users.noreply.github.com>
Date: Tue, 24 Dec 2024 17:56:55 +0530
Subject: [PATCH 01/23] =?UTF-8?q?update=20bugs=F0=9F=91=8D?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../CreateIO/IOCashDetails/Pending.jsx | 5 +-
.../CreateIO/IONAVDetails/Pending.jsx | 124 +++++++++---------
.../CreateIO/IOTransaction/Pending.jsx | 12 +-
.../ViewDistributionInvestor.jsx | 8 +-
4 files changed, 77 insertions(+), 72 deletions(-)
diff --git a/src/Pages/IO_Management/CreateIO/IOCashDetails/Pending.jsx b/src/Pages/IO_Management/CreateIO/IOCashDetails/Pending.jsx
index 06bc1d9..6da3449 100644
--- a/src/Pages/IO_Management/CreateIO/IOCashDetails/Pending.jsx
+++ b/src/Pages/IO_Management/CreateIO/IOCashDetails/Pending.jsx
@@ -38,7 +38,7 @@ import { useUpdateIOCaseMutation } from "../../../../Services/io.service";
import RequestApproveModal from "./RequestApproveModal";
import RequestRejectModal from "./RequestRejectModal";
import AddCaseDetails from "./AddCaseDetails";
-import { encryptString } from "../../../../Constants/Constants";
+import { encryptString, isChecker } from "../../../../Constants/Constants";
const formatDate = (date) => new Date(date).toLocaleDateString();
@@ -105,8 +105,7 @@ const Pending = () => {
"Comments",
"Update By",
"Update On",
- ...(localStorage?.getItem('role')!==encryptString(import.meta.env.VITE_VITE_MAKER) ? ["Actions"] : []),
-
+ ...(isChecker() ? ["Actions"] : []),
];
const extractedArray = filteredData?.map((item, index) => ({
diff --git a/src/Pages/IO_Management/CreateIO/IONAVDetails/Pending.jsx b/src/Pages/IO_Management/CreateIO/IONAVDetails/Pending.jsx
index a249bce..513da44 100644
--- a/src/Pages/IO_Management/CreateIO/IONAVDetails/Pending.jsx
+++ b/src/Pages/IO_Management/CreateIO/IONAVDetails/Pending.jsx
@@ -22,7 +22,7 @@ import ToastBox from "../../../../Components/ToastBox";
import AddNavDetails from "./AddNavDetails";
import RequestApproveModal from "./RequestApproveModal";
import RequestRejectModal from "./RequestRejectModal";
-import { encryptString } from "../../../../Constants/Constants";
+import { encryptString, isChecker } from "../../../../Constants/Constants";
const formatDate = (date) => new Date(date).toLocaleDateString();
@@ -91,7 +91,7 @@ const Pending = () => {
"Investment Closed",
"Comments",
"Updated By",
- ...(localStorage?.getItem("role") !== encryptString(import.meta.env.VITE_VITE_MAKER) ? ["Status"] : []),
+ ...(isChecker() ? ["Actions"] : []),
];
const extractedArray = filteredData?.map((item, index) => ({
@@ -112,9 +112,9 @@ const Pending = () => {
$
{parseFloat(item?.transactionAmount || 0).toLocaleString(undefined, {
- minimumFractionDigits: 2,
- maximumFractionDigits: 2,
- })}
+ minimumFractionDigits: 2,
+ maximumFractionDigits: 2,
+ })}
),
"Last Nav Update": (
@@ -162,66 +162,66 @@ const Pending = () => {
{item?.modifier?.firstName}
),
- Status: (
+ Actions: (
-
+
-
-
-
-
-
-
+
+
+
+
+
+
+
-
),
}));
diff --git a/src/Pages/IO_Management/CreateIO/IOTransaction/Pending.jsx b/src/Pages/IO_Management/CreateIO/IOTransaction/Pending.jsx
index 2653a94..24a105f 100644
--- a/src/Pages/IO_Management/CreateIO/IOTransaction/Pending.jsx
+++ b/src/Pages/IO_Management/CreateIO/IOTransaction/Pending.jsx
@@ -148,6 +148,11 @@ const Pending = () => {
})}
),
+ // Amount:(
+ //
+ //
+ //
+ // ),
"Created By": (
{
}
}}
>
- {isMaker() ? : null}{" "}
- {localStorage?.getItem("role") ===
- encryptString(import.meta.env.VITE_VITE_MAKER)
+ {isMaker() ? : null}
+ {isMaker()
? "View"
: "Approve / Reject"}
@@ -213,6 +217,8 @@ const Pending = () => {
})
);
+
+
const handleDelete = () => {
const updatedSponsors = sponser.filter(
(sponsor) => sponsor.id !== actionId
diff --git a/src/Pages/IO_Management/CreateIO/IOTransaction/ViewDistributionInvestor.jsx b/src/Pages/IO_Management/CreateIO/IOTransaction/ViewDistributionInvestor.jsx
index dddd11e..6ea4b97 100644
--- a/src/Pages/IO_Management/CreateIO/IOTransaction/ViewDistributionInvestor.jsx
+++ b/src/Pages/IO_Management/CreateIO/IOTransaction/ViewDistributionInvestor.jsx
@@ -23,9 +23,9 @@ import { yupResolver } from "@hookform/resolvers/yup";
import GlobalStateContext from "../../../../Contexts/GlobalStateContext";
import ApproveDistrubationModal from "./ApproveDistrubationModal";
import RequestRejectModal from "./RequestRejectModal";
-import { encryptString } from "../../../../Constants/Constants";
+import { encryptString, isChecker, isMaker } from "../../../../Constants/Constants";
-const ViewDistributionInvestor = ({ isOpen, onClose,id:exitId }) => {
+const ViewDistributionInvestor = ({ isOpen, onClose,id:exitId,amount }) => {
const params = useParams();
const toast = useToast();
const id = params?.id;
@@ -176,7 +176,7 @@ const ViewDistributionInvestor = ({ isOpen, onClose,id:exitId }) => {
"Distriution Amt($)": (
- {item?.distribution_amt?.toLocaleString(undefined, {
+ {IODetails?.ioTransactionRecords?.Pending[index]?.transactionAmount?.toLocaleString(undefined, {
minimumFractionDigits: 2,
maximumFractionDigits: 2,
})}
@@ -219,7 +219,7 @@ const ViewDistributionInvestor = ({ isOpen, onClose,id:exitId }) => {
/>
{/* ...(localStorage?.getItem("role") !== "Maker" ? ["Status"] : []), */}
- {localStorage?.getItem("role") !== encryptString(import.meta.env.VITE_VITE_MAKER) &&
+ {isChecker() &&
+
),
"First Name": (
@@ -185,39 +181,44 @@ const InvestorDetails = () => {
),
- "Type": (
+ Type: (
-
-
+
+
{item?.investor_type?.investorTypeName}
),
Status: (
-
-
- {item.ioStatus ? "Ban" : "Unban"}
-
-
+
+
+ {item.ioStatus ? "Ban" : "Unban"}
+
+
),
"KYC Status": (
-
+
{/* {item.KYCStatus ? "Completed" : "Not complete"} */}
{item?.KYCStatus === true ? "Completed" : "NotCompleted"}
@@ -235,7 +236,7 @@ const InvestorDetails = () => {
placement="top"
>
Date: Tue, 31 Dec 2024 13:42:28 +0530
Subject: [PATCH 03/23] bugs fix
---
.../IO_Management/CreateIO/IOArtifactsVideo.jsx | 2 +-
.../CreateIO/IOCashDetails/IOCashDetails.jsx | 3 ++-
.../CreateIO/IONAVDetails/IONAVDetails.jsx | 3 ++-
src/Pages/IO_Management/IOArtifactsAdd.jsx | 2 +-
.../ViewIO/HeaderModal/AmountInvested.jsx | 14 ++++++++++++--
.../ViewIO/HeaderModal/DistributionInvestor.jsx | 2 +-
6 files changed, 19 insertions(+), 7 deletions(-)
diff --git a/src/Pages/IO_Management/CreateIO/IOArtifactsVideo.jsx b/src/Pages/IO_Management/CreateIO/IOArtifactsVideo.jsx
index 0e68193..c95a79b 100644
--- a/src/Pages/IO_Management/CreateIO/IOArtifactsVideo.jsx
+++ b/src/Pages/IO_Management/CreateIO/IOArtifactsVideo.jsx
@@ -217,7 +217,7 @@ const IOArtifactsAdd = ({ isOpen, onClose, firstField, actionId, setActionId, da
isOpen={alert}
onClose={() => setAlert(false)}
alertHandler={handleSave}
- message={"Are you sure you want to update this artifact?"}
+ message={"Are you sure you want to add this artifact?"}
isLoading={isLoading}
/>
>
diff --git a/src/Pages/IO_Management/CreateIO/IOCashDetails/IOCashDetails.jsx b/src/Pages/IO_Management/CreateIO/IOCashDetails/IOCashDetails.jsx
index 505ba1d..d341972 100644
--- a/src/Pages/IO_Management/CreateIO/IOCashDetails/IOCashDetails.jsx
+++ b/src/Pages/IO_Management/CreateIO/IOCashDetails/IOCashDetails.jsx
@@ -107,7 +107,8 @@ const IOCashDetails = () => {
{IODetails?.isInvestedAmount
- ? isMaker() && (
+ ? isMaker() &&
+ IODetails?.ioSatatus !== "Exited" && (
}
diff --git a/src/Pages/IO_Management/CreateIO/IONAVDetails/IONAVDetails.jsx b/src/Pages/IO_Management/CreateIO/IONAVDetails/IONAVDetails.jsx
index 2db38b7..069992d 100644
--- a/src/Pages/IO_Management/CreateIO/IONAVDetails/IONAVDetails.jsx
+++ b/src/Pages/IO_Management/CreateIO/IONAVDetails/IONAVDetails.jsx
@@ -153,7 +153,8 @@ const IONAVDetails = () => {
{IODetails?.isInvestedAmount
- ? isMaker() && (
+ ? isMaker() &&
+ IODetails?.ioSatatus !== "Exited" && (
}
diff --git a/src/Pages/IO_Management/IOArtifactsAdd.jsx b/src/Pages/IO_Management/IOArtifactsAdd.jsx
index 2e3ea3f..15a8619 100644
--- a/src/Pages/IO_Management/IOArtifactsAdd.jsx
+++ b/src/Pages/IO_Management/IOArtifactsAdd.jsx
@@ -360,7 +360,7 @@ const IOArtifactsAdd = ({
isOpen={alert}
onClose={handleAlertClose}
alertHandler={handleSave}
- message={"Are you sure you want to update this artifact?"}
+ message={"Are you sure you want to add this artifact?"}
isLoading={loading}
/>
>
diff --git a/src/Pages/IO_Management/ViewIO/HeaderModal/AmountInvested.jsx b/src/Pages/IO_Management/ViewIO/HeaderModal/AmountInvested.jsx
index 02d7af2..bed4fac 100644
--- a/src/Pages/IO_Management/ViewIO/HeaderModal/AmountInvested.jsx
+++ b/src/Pages/IO_Management/ViewIO/HeaderModal/AmountInvested.jsx
@@ -112,8 +112,18 @@ const AmountInvested = ({ isOpen, onClose }) => {
});
};
+ const handleModalClose = () => {
+ reset({
+ transactionDate: "",
+ Total_Amount: IODetails?.totalAmtInvestmentInUSD || 0,
+ amountInvested: 0,
+ IoCash: IODetails?.totalAmtInvestmentInUSD || 0,
+ });
+ onClose();
+ };
+
return (
-
+
Amount Invested
@@ -246,7 +256,7 @@ const AmountInvested = ({ isOpen, onClose }) => {
>
Save
-
+
Close
diff --git a/src/Pages/IO_Management/ViewIO/HeaderModal/DistributionInvestor.jsx b/src/Pages/IO_Management/ViewIO/HeaderModal/DistributionInvestor.jsx
index 167c686..e5cff96 100644
--- a/src/Pages/IO_Management/ViewIO/HeaderModal/DistributionInvestor.jsx
+++ b/src/Pages/IO_Management/ViewIO/HeaderModal/DistributionInvestor.jsx
@@ -495,7 +495,7 @@ const DistributionInvestor = ({ isOpen, onClose }) => {
>
Save
-
+
Close
>
From 51727d4de1134cf6f5c51b0139bb370b623c3c4a Mon Sep 17 00:00:00 2001
From: YasinShaikh123 <123150391+YasinShaikh123@users.noreply.github.com>
Date: Tue, 31 Dec 2024 13:48:50 +0530
Subject: [PATCH 04/23] [test]
---
src/Components/Banner/AddBanner.jsx | 1 +
1 file changed, 1 insertion(+)
diff --git a/src/Components/Banner/AddBanner.jsx b/src/Components/Banner/AddBanner.jsx
index c8ec5fd..9ec776c 100644
--- a/src/Components/Banner/AddBanner.jsx
+++ b/src/Components/Banner/AddBanner.jsx
@@ -31,6 +31,7 @@ import Header from "../Header";
import ToastBox from "../ToastBox";
import BannerMainCard from "./BannerMainCard";
+
const AddBanner = ({ createApi, navigateLink, title, center }) => {
const toast = useToast();
const navigate = useNavigate();
From 25df0d6160d0573af6b885fb19c8c7f7e8f625d6 Mon Sep 17 00:00:00 2001
From: YasinShaikh123 <123150391+YasinShaikh123@users.noreply.github.com>
Date: Tue, 31 Dec 2024 15:47:48 +0530
Subject: [PATCH 05/23] [fixed] - io Deatils
---
.../IO_Management/CreateIO/IODetails.jsx | 264 +++++++++---------
1 file changed, 139 insertions(+), 125 deletions(-)
diff --git a/src/Pages/IO_Management/CreateIO/IODetails.jsx b/src/Pages/IO_Management/CreateIO/IODetails.jsx
index 06f528d..ee1bf09 100644
--- a/src/Pages/IO_Management/CreateIO/IODetails.jsx
+++ b/src/Pages/IO_Management/CreateIO/IODetails.jsx
@@ -12,11 +12,12 @@ import {
useUpdateIOMutation,
} from "../../../Services/io.service";
import ToastBox from "../../../Components/ToastBox";
-import {
- useToast,
-} from "@chakra-ui/react";
+import { useToast } from "@chakra-ui/react";
import { formatDatee } from "../../../Components/FormField";
-import { formatDateToYYYYMMDD, removeTrailingZeros } from "../../../Constants/Constants";
+import {
+ formatDateToYYYYMMDD,
+ removeTrailingZeros,
+} from "../../../Constants/Constants";
const schema = yup.object().shape({
investmentNameEnglish: yup
@@ -25,7 +26,7 @@ const schema = yup.object().shape({
.min(3, "IO name in English must be at least 3 characters long")
.max(150, "IO name in English must be at most 150 characters long"),
- investmentNameArabic: yup
+ investmentNameArabic: yup
.string()
.required("IO name in Arabic is required")
.min(3, "IO name in Arabic must be at least 3 characters long")
@@ -42,15 +43,15 @@ const schema = yup.object().shape({
.required("Description in Arabic is required")
.min(10, "Description in Arabic must be at least 10 characters long")
.max(2000, "Description in Arabic must be at most 500 characters long"),
- expectedReturnArabic: yup
- .string()
- .required("Expected return in Arabic is required"),
+ expectedReturnArabic: yup
+ .string()
+ .required("Expected return in Arabic is required"),
- goalAmount: yup
- .number()
- .typeError("Goal Amount is must be number")
- .required('Goal amount is required')
- .positive('Goal amount must be a positive number'),
+ goalAmount: yup
+ .number()
+ .typeError("Goal Amount is must be number")
+ .required("Goal amount is required")
+ .positive("Goal amount must be a positive number"),
closingDate: yup
.date()
.notRequired("Closing date is required")
@@ -69,28 +70,25 @@ const schema = yup.object().shape({
InvestmentDetails: yup.string().notRequired(),
- comment: yup.string().notRequired()
- // .min(10, "Comment must be at least 10 characters long")
- .max(100, "Comment must be at most 100 characters long"),
-
- expectedReturn: yup
+ comment: yup
.string()
- .required("Expected return is required"),
+ .notRequired()
+ // .min(10, "Comment must be at least 10 characters long")
+ .max(100, "Comment must be at most 100 characters long"),
+
+ expectedReturn: yup.string().required("Expected return is required"),
});
const IODetails = ({ enableNextTab, index, data }) => {
-
const params = useParams();
const navigate = useNavigate();
const toast = useToast();
-
const handleInputChangeCreate = (index, newValue) => {
-
const updatedValues = [...values];
updatedValues[index].value = newValue;
setValues(updatedValues);
- console.log(values);
+ console.log(values);
};
const handleInputChangeEdit = (index, newValue) => {
@@ -143,9 +141,12 @@ const IODetails = ({ enableNextTab, index, data }) => {
});
const miniValue = data?.country?.map(
- ({ countryName, flagIcon, minInvestmentAmt, countryCode, id, currency }, index) => {
+ (
+ { countryName, flagIcon, minInvestmentAmt, countryCode, id, currency },
+ index
+ ) => {
return {
- id:id,
+ id: id,
country: countryName,
value: minInvestmentAmt,
logo: flagIcon,
@@ -154,18 +155,19 @@ const IODetails = ({ enableNextTab, index, data }) => {
}
);
- const minInvestmentById = IObyID?.data?.minInvestmentAmt?.map(({minInvestmentAmt, country, currencyCode, country_xid,id })=>{
- console.log(currencyCode);
- return{
- _id:id,
- id:country_xid,
- country: country?.countryName,
- value: removeTrailingZeros(minInvestmentAmt),
- logo: country?.flagIcon,
- curr: currencyCode,
+ const minInvestmentById = IObyID?.data?.minInvestmentAmt?.map(
+ ({ minInvestmentAmt, country, currencyCode, country_xid, id }) => {
+ console.log(currencyCode);
+ return {
+ _id: id,
+ id: country_xid,
+ country: country?.countryName,
+ value: removeTrailingZeros(minInvestmentAmt),
+ logo: country?.flagIcon,
+ curr: currencyCode,
+ };
}
- })
-
+ );
const schemaEdit = yup.object().shape({
investmentNameEnglish: yup
@@ -173,73 +175,67 @@ const IODetails = ({ enableNextTab, index, data }) => {
.required("IO name in English is required")
.min(3, "IO name in English must be at least 3 characters long")
.max(150, "IO name in English must be at most 150 characters long"),
-
+
investmentNameArabic: yup
.string()
.required("IO name in Arabic is required")
.min(3, "IO name in Arabic must be at least 3 characters long")
.max(50, "IO name in Arabic must be at most 50 characters long"),
-
+
descriptionEnglish: yup
.string()
.required("Description in English is required")
.min(10, "Description in English must be at least 10 characters long")
.max(1000, "Description in English must be at most 1000 characters long"),
-
+
descriptionArabic: yup
.string()
.required("Description in Arabic is required")
.min(10, "Description in Arabic must be at least 10 characters long")
.max(2000, "Description in Arabic must be at most 500 characters long"),
- expectedReturnArabic: yup
- .string()
- .required("Expected return in Arabic is required"),
-
- goalAmount: yup
- .number()
- .typeError("Goal Amount is must be number")
- .required('Goal amount is required')
- .positive('Goal amount must be a positive number')
- .min(IObyID?.data?.totalAmtInvestmentInUSD, `Goal amount should not be lesser then amount raised ${IObyID?.data?.totalAmtInvestmentInUSD}`),
- closingDate: yup
- .date()
- .notRequired("Closing date is required")
- .min(new Date(), "Closing date cannot be in the past"),
-
+ expectedReturnArabic: yup
+ .string()
+ .required("Expected return in Arabic is required"),
+
+ goalAmount: yup
+ .number()
+ .typeError("Goal Amount is must be number")
+ .required("Goal amount is required")
+ .positive("Goal amount must be a positive number")
+ .min(
+ IObyID?.data?.totalAmtInvestmentInUSD,
+ `Goal amount should not be lesser then amount raised ${IObyID?.data?.totalAmtInvestmentInUSD}`
+ ),
+ closingDate: yup.date().notRequired("Closing date is required"),
+
holdingPeriod: yup.string().required("Holding period is required"),
holdingPeriodArabic: yup.string().required("Holding period is required"),
isShariah: yup.string().required("CheckBox is required"),
-
// minInvestmentAmount: yup
// .number()
// .required("Minimum investment is required")
// .positive("Minimum investment must be a positive number")
// .min(1, "Minimum investment must be at least 1"),
-
+
ISIN: yup.string().notRequired(),
-
+
InvestmentDetails: yup.string().notRequired(),
-
- comment: yup.string().notRequired()
- .min(10, "Comment must be at least 10 characters long")
- .max(100, "Comment must be at most 100 characters long"),
-
- expectedReturn: yup
+
+ comment: yup
.string()
- .required("Expected return is required"),
+ .notRequired()
+ .min(10, "Comment must be at least 10 characters long")
+ .max(100, "Comment must be at most 100 characters long"),
+
+ expectedReturn: yup.string().required("Expected return is required"),
});
-
-
-
- const [values, setValues] = useState(id?minInvestmentById:miniValue);
+ const [values, setValues] = useState(id ? minInvestmentById : miniValue);
-
const formatNumber = (num) => {
// Remove non-numeric characters and format with commas
- return num.replace(/\D/g, '')
- .replace(/\B(?=(\d{3})+(?!\d))/g, ',');
+ return num.replace(/\D/g, "").replace(/\B(?=(\d{3})+(?!\d))/g, ",");
};
// console.log(values);
@@ -253,10 +249,11 @@ const IODetails = ({ enableNextTab, index, data }) => {
formState: { errors },
} = useForm({
resolver: yupResolver(id ? schemaEdit : schema),
+ mode: "all",
});
useEffect(() => {
- setIOloading(IObyIDisLoading)
+ setIOloading(IObyIDisLoading);
setIODetails({
...IObyID?.data,
});
@@ -277,10 +274,9 @@ const IODetails = ({ enableNextTab, index, data }) => {
minInvestmentAmount: IObyID?.data?.minInvestmentAmount,
holdingPeriodArabic: IObyID?.data?.minInvestmentAmount,
expectedReturnArabic: IObyID?.data?.minInvestmentAmount,
- isShariah: IObyID?.data?.isShariah
+ isShariah: IObyID?.data?.isShariah,
});
}
-
}, [id, IObyID]);
//=======================[ Creator ]
@@ -293,8 +289,10 @@ const IODetails = ({ enableNextTab, index, data }) => {
isRequired: true,
section: " ",
width: "49%",
- maxLength:150,
- helperText:`Maximum length should be 150 characters. You have entered ${watch()?.investmentNameEnglish?.length || 0} characters.`
+ maxLength: 150,
+ helperText: `Maximum length should be 150 characters. You have entered ${
+ watch()?.investmentNameEnglish?.length || 0
+ } characters.`,
},
{
label: "IO Name (Arabic)",
@@ -305,8 +303,10 @@ const IODetails = ({ enableNextTab, index, data }) => {
arabic: true,
section: " ",
width: "49%",
- maxLength:150,
- helperText:`Maximum length should be 150 characters. You have entered ${watch()?.investmentNameArabic?.length || 0} characters.`
+ maxLength: 150,
+ helperText: `Maximum length should be 150 characters. You have entered ${
+ watch()?.investmentNameArabic?.length || 0
+ } characters.`,
},
{
label: "Description",
@@ -316,8 +316,10 @@ const IODetails = ({ enableNextTab, index, data }) => {
isRequired: true,
section: " ",
width: "49%",
- maxLength:1000,
- helperText:`Maximum length should be 1000 characters. You have entered ${watch()?.descriptionEnglish?.length || 0} characters.`
+ maxLength: 1000,
+ helperText: `Maximum length should be 1000 characters. You have entered ${
+ watch()?.descriptionEnglish?.length || 0
+ } characters.`,
},
{
label: "Description (Arabic)",
@@ -328,9 +330,10 @@ const IODetails = ({ enableNextTab, index, data }) => {
arabic: true,
section: " ",
width: "49%",
- maxLength:1000,
- helperText:`Maximum length should be 1000 characters. You have entered ${watch()?.descriptionArabic?.length || 0} characters.`
-
+ maxLength: 1000,
+ helperText: `Maximum length should be 1000 characters. You have entered ${
+ watch()?.descriptionArabic?.length || 0
+ } characters.`,
},
{
label: "Holding Period",
@@ -341,8 +344,10 @@ 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.`
+ maxLength: 20,
+ helperText: `Maximum length should be 20 characters. You have entered ${
+ watch()?.holdingPeriod?.length || 0
+ } characters.`,
},
{
label: "Holding Period (Arabic)",
@@ -354,11 +359,12 @@ 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.`
+ maxLength: 20,
+ helperText: `Maximum length should be 20 characters. You have entered ${
+ watch()?.holdingPeriodArabic?.length || 0
+ } characters.`,
},
-
{
label: "Expected Return",
name: "expectedReturn",
@@ -371,7 +377,7 @@ const IODetails = ({ enableNextTab, index, data }) => {
{
label: "Expected Return (Arabic)",
- name: "expectedReturnArabic",
+ name: "expectedReturnArabic",
type: "text",
isRequired: true,
arabic: true,
@@ -381,16 +387,15 @@ const IODetails = ({ enableNextTab, index, data }) => {
},
{
label: "Shariah",
- name: "isShariah",
+ name: "isShariah",
type: "checkBox",
- value:IObyID?.data?.isShariah,
+ value: IObyID?.data?.isShariah,
// isRequired: true,
section: " ",
width: "32.3%",
value: IObyID?.data?.isShariah,
},
-
{
label: "Investment Type",
placeHolder: "Select option",
@@ -428,19 +433,19 @@ const IODetails = ({ enableNextTab, index, data }) => {
name: "closingDate",
// value: "IObyID?.data?.closingDate",
type: "date",
- isRequired: true,
+ // isRequired: true,
section: " ",
width: "32.3%",
- dateValue:formatDatee(IObyID?.data?.closingDate),
+ dateValue: formatDatee(IObyID?.data?.closingDate),
// helperText: IObyID && `Current closing date is : ${formatDate(IObyID?.data?.closingDate)}`
- closingDate:true
+ // closingDate:true
},
{
label: "ISIN",
placeHolder: "",
name: "ISIN",
type: "text",
- align:"right",
+ align: "right",
section: " ",
width: "32.3%",
},
@@ -452,8 +457,10 @@ const IODetails = ({ enableNextTab, index, data }) => {
section: " ",
width: "32.3%",
value: IObyID?.data?.InvestmentDetails,
- maxLength:20,
- helperText:`Maximum length should be 20 characters. You have entered ${watch()?.InvestmentDetails?.length || 0} characters.`
+ maxLength: 20,
+ helperText: `Maximum length should be 20 characters. You have entered ${
+ watch()?.InvestmentDetails?.length || 0
+ } characters.`,
},
{
@@ -462,10 +469,10 @@ const IODetails = ({ enableNextTab, index, data }) => {
name: "table",
type: "table",
section: " ",
- width: "100%",
+ width: "100%",
isRequired: true,
options: investmentTypeOptions,
- handleInputChange:id ? handleInputChangeEdit : handleInputChangeCreate,
+ handleInputChange: id ? handleInputChangeEdit : handleInputChangeCreate,
value: values,
},
@@ -478,8 +485,10 @@ const IODetails = ({ enableNextTab, index, data }) => {
width: "100%",
options: investmentTypeOptions,
value: IObyID?.data?.comment,
- maxLength:100,
- helperText:`Maximum length should be 100 characters. You have entered ${watch()?.comment?.length || 0} characters.`
+ maxLength: 100,
+ helperText: `Maximum length should be 100 characters. You have entered ${
+ watch()?.comment?.length || 0
+ } characters.`,
},
];
const groupedFields = formFields.reduce((groups, field) => {
@@ -492,30 +501,29 @@ const IODetails = ({ enableNextTab, index, data }) => {
}, {});
const onSubmit = async (data) => {
-
delete data.table;
setIsLoading(true);
- const updatedMinAmount = values?.map(({id, value, _id})=>{
+ const updatedMinAmount = values?.map(({ id, value, _id }) => {
return {
- id:_id,
- country_xid:id,
- minInvestmentAmt: Number(value)
- }
- })
+ id: _id,
+ country_xid: id,
+ minInvestmentAmt: Number(value),
+ };
+ });
// console.log(formatDateToYYYYMMDD(data.closingDate));
const formData = {
...data,
investmentType_xid: Number(data.investmentType),
sponsor_xid: Number(data.sponserName),
- minInvestmentAmt:updatedMinAmount,
- closingDate: formatDateToYYYYMMDD(data.closingDate)
+ minInvestmentAmt: updatedMinAmount,
+ closingDate: formatDateToYYYYMMDD(data.closingDate),
};
// console.log(formData);
if (id) {
- console.log("========================",formData);
+ console.log("========================", formData);
const res = await updateIO({ data: formData, id });
console.log(res);
if (res?.data?.statusCode === 200) {
@@ -525,20 +533,24 @@ const IODetails = ({ enableNextTab, index, data }) => {
});
navigate(`/view-io/${id}`);
enableNextTab(index);
- } else if(res?.error?.status === 400){
+ } else if (res?.error?.status === 400) {
setIsLoading(false);
toast({
- render: () => ,
- });
- } else if(res?.error?.status === 500){
+ render: () => (
+
+ ),
+ });
+ } else if (res?.error?.status === 500) {
setIsLoading(false);
toast({
- render: () => ,
+ render: () => (
+
+ ),
});
}
} else {
try {
- console.log("========================",formData);
+ console.log("========================", formData);
const res = await creatIO(formData);
console.log(res?.error?.status);
if (res?.data?.statusCode === 200) {
@@ -548,15 +560,19 @@ const IODetails = ({ enableNextTab, index, data }) => {
});
navigate(`/view-io/${res?.data?.data}`);
enableNextTab(index);
- } else if(res?.error?.status === 400){
+ } else if (res?.error?.status === 400) {
setIsLoading(false);
toast({
- render: () => ,
+ render: () => (
+
+ ),
});
- }else if(res?.error?.status === 500){
+ } else if (res?.error?.status === 500) {
setIsLoading(false);
toast({
- render: () => ,
+ render: () => (
+
+ ),
});
}
} catch (error) {
@@ -565,7 +581,6 @@ const IODetails = ({ enableNextTab, index, data }) => {
}
}
-
// ==========================
// if (params?.id) {
// return enableNextTab(index);
@@ -583,9 +598,8 @@ const IODetails = ({ enableNextTab, index, data }) => {
};
return IObyIDisLoading ? (
-
+
) : (
-
Date: Tue, 31 Dec 2024 16:06:13 +0530
Subject: [PATCH 06/23] [fixed] - closing date
---
src/Pages/IO_Management/CreateIO/IODetails.jsx | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/Pages/IO_Management/CreateIO/IODetails.jsx b/src/Pages/IO_Management/CreateIO/IODetails.jsx
index ee1bf09..89efb5f 100644
--- a/src/Pages/IO_Management/CreateIO/IODetails.jsx
+++ b/src/Pages/IO_Management/CreateIO/IODetails.jsx
@@ -438,7 +438,7 @@ const IODetails = ({ enableNextTab, index, data }) => {
width: "32.3%",
dateValue: formatDatee(IObyID?.data?.closingDate),
// helperText: IObyID && `Current closing date is : ${formatDate(IObyID?.data?.closingDate)}`
- // closingDate:true
+ closingDate:id ? null : true
},
{
label: "ISIN",
From c9e52239896ec9a29774ecacb37398c25716552d Mon Sep 17 00:00:00 2001
From: YasinShaikh123 <123150391+YasinShaikh123@users.noreply.github.com>
Date: Tue, 31 Dec 2024 19:34:36 +0530
Subject: [PATCH 07/23] Case IO Bug
---
src/Pages/IO_Management/CreateIO/IOCashDetails/Rejected.jsx | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/Pages/IO_Management/CreateIO/IOCashDetails/Rejected.jsx b/src/Pages/IO_Management/CreateIO/IOCashDetails/Rejected.jsx
index 38598ec..252c51d 100644
--- a/src/Pages/IO_Management/CreateIO/IOCashDetails/Rejected.jsx
+++ b/src/Pages/IO_Management/CreateIO/IOCashDetails/Rejected.jsx
@@ -119,7 +119,7 @@ import AddCaseDetails from "./AddCaseDetails";
$
- {parseFloat(IODetails?.ioCash || 0).toLocaleString(undefined, {
+ {parseFloat(item?.transactionAmount || 0).toLocaleString(undefined, {
minimumFractionDigits: 2,
maximumFractionDigits: 2,
})}
From 6e42bc0adb13095ff8e185dca2536b03a48083b3 Mon Sep 17 00:00:00 2001
From: Swapnil
Date: Sat, 4 Jan 2025 21:05:49 +0530
Subject: [PATCH 08/23] [FIXED] - notification
---
src/Pages/Admin/Notification.jsx | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/src/Pages/Admin/Notification.jsx b/src/Pages/Admin/Notification.jsx
index 19e3d80..23af1eb 100644
--- a/src/Pages/Admin/Notification.jsx
+++ b/src/Pages/Admin/Notification.jsx
@@ -23,7 +23,7 @@ import ToastBox from "../../Components/ToastBox";
import NormalTable from "../../Components/DataTable/NormalTable";
import GlobalStateContext from "../../Contexts/GlobalStateContext";
import { useGetInvestorsQuery } from "../../Services/investor.details.service";
-import { TABLE_PAGINATION } from "../../Constants/Paginations";
+import { INVESTOR_TABLE_PAGINATION, TABLE_PAGINATION } from "../../Constants/Paginations";
import { formatDate, generateSerialNumber } from "../../Constants/Constants";
import { ViewIcon } from "@chakra-ui/icons";
import { useGetUnbanInvestorQuery } from "../../Services/ban.investor.service";
@@ -66,8 +66,8 @@ const Notification = () => {
const [form, setForm] = useState({});
const [isLoading, setIsLoading] = useState(false);
const [ selectedRadio, setSelectedRadio] = useState([])
- const [pageSize, setPageSize] = useState(TABLE_PAGINATION?.size);
- const [currentPage, setCurrentPage] = useState(TABLE_PAGINATION?.page);
+ const [pageSize, setPageSize] = useState(INVESTOR_TABLE_PAGINATION?.size);
+ const [currentPage, setCurrentPage] = useState(INVESTOR_TABLE_PAGINATION?.page);
const [searchTerm, setSearchTerm] = useState("");
const [debouncedSearchTerm, setDebouncedSearchTerm] = useState("");
@@ -116,7 +116,7 @@ const Notification = () => {
refetch,
} = useGetUnbanInvestorQuery({
page: debouncedSearchTerm ? undefined : currentPage, // Omit pagination for search
- size: debouncedSearchTerm ? undefined : pageSize, // Omit pagination for search
+ size: debouncedSearchTerm ? undefined : 10000 || pageSize || 500, // Omit pagination for search
search: debouncedSearchTerm,
},
{
From d9692c38902c1bd65d43bd53ee705217038e714f Mon Sep 17 00:00:00 2001
From: YasinShaikh123 <123150391+YasinShaikh123@users.noreply.github.com>
Date: Tue, 7 Jan 2025 15:55:38 +0530
Subject: [PATCH 09/23] update exchange rate numbar
---
.../Master/ExchangeRate/EditExchangeRate.jsx | 90 ++++++++++++++++---
1 file changed, 79 insertions(+), 11 deletions(-)
diff --git a/src/Pages/Master/ExchangeRate/EditExchangeRate.jsx b/src/Pages/Master/ExchangeRate/EditExchangeRate.jsx
index 51d9cbd..8f88239 100644
--- a/src/Pages/Master/ExchangeRate/EditExchangeRate.jsx
+++ b/src/Pages/Master/ExchangeRate/EditExchangeRate.jsx
@@ -30,8 +30,35 @@ import {
} from "../../../Services/exchange.rate.service";
import ToastBox from "../../../Components/ToastBox";
import { getTomorrowDate } from "../../../Constants/Constants";
+import * as yup from "yup";
import FullscreenLoaders from "../../../Components/Loaders/FullscreenLoaders";
+// const editExchange = yup.object().shape({
+// rate: yup
+// .number()
+// .required("Rate is required")
+// .positive("Rate must be greater than 0")
+// .test(
+// "is-decimal",
+// "Rate must have at most 8 decimal places",
+// (value) =>
+// value !== undefined && value.toString().match(/^\d+(\.\d{1,8})?$/)
+// ),
+// });
+
+const editExchange = yup.object().shape({
+ rate: yup
+ .number()
+ .required("Rate is required")
+ .positive("Rate must be greater than 0")
+ .test(
+ "is-decimal",
+ "Rate must have exactly 8 decimal places",
+ (value) =>
+ value !== undefined && value.toString().match(/^\d+(\.\d{8})?$/)
+ ),
+});
+
// Convert date to YYYY-MM-DD format
const formatDateValue = (date) => {
if (!date) return "";
@@ -57,6 +84,7 @@ const EditExchangeRate = ({
const toast = useToast();
const {} = useDisclosure();
const [isBtnLoading, setIsBtnLoading] = useState(false);
+ const [rateError, setRateError] = useState("");
const { data, isLoading, errors } = useGetExchangeRateByIdQuery(id, {
skip: !id,
@@ -73,11 +101,27 @@ const EditExchangeRate = ({
}
}, [foundObject]);
+ const validateRate = async () => {
+ try {
+ await editExchange.validate({ rate });
+ setRateError(""); // Clear validation error if valid
+ return true;
+ } catch (error) {
+ setRateError(error.message); // Display validation error
+ return false;
+ }
+ };
+
const handleSave = async () => {
+ const isValid = await validateRate();
+ if (!isValid) {
+ return; // Prevent submission if validation fails
+ }
+
setIsBtnLoading(true);
try {
const data = {
- rate: rate,
+ rate,
};
const res = await updateExchange({ data, id });
if (res?.data?.statusCode === 200) {
@@ -88,9 +132,31 @@ const EditExchangeRate = ({
setAlert(false);
onClose();
}
- } catch (error) {}
+ } catch (error) {
+ setIsBtnLoading(false);
+ // Handle error
+ }
};
+ const checkValidate = async (e) => {
+ e.preventDefault();
+
+ // Wait for the validation to complete
+ const isValid = await validateRate();
+
+ if (!isValid) {
+ return; // Prevent submission if validation fails
+ } else {
+ setAlert(true); // Only trigger modal if validation passes
+ }
+ };
+
+ useEffect(() => {
+ if (rate) {
+ validateRate();
+ }
+ }, [rate]);
+
return (
<>
-
From 625f721325aaadbf2a3458a408e4e7d586026ccf Mon Sep 17 00:00:00 2001
From: YasinShaikh123 <123150391+YasinShaikh123@users.noreply.github.com>
Date: Wed, 8 Jan 2025 13:16:44 +0530
Subject: [PATCH 11/23] correct exchange rate
---
src/Layout/DefaultLayout.jsx | 2 +-
.../InvestorDetails/InvestorDetails.jsx | 6 +--
.../Master/ExchangeRate/EditExchangeRate.jsx | 43 ++++++++++++-------
3 files changed, 31 insertions(+), 20 deletions(-)
diff --git a/src/Layout/DefaultLayout.jsx b/src/Layout/DefaultLayout.jsx
index 23044a7..56976ec 100644
--- a/src/Layout/DefaultLayout.jsx
+++ b/src/Layout/DefaultLayout.jsx
@@ -167,7 +167,7 @@ const DashboardLayout = ({ isOnline }) => {
return (
- Echange rate
+ Exchange rate
);
case path.startsWith("/create-io"):
diff --git a/src/Pages/Investor_Management/InvestorDetails/InvestorDetails.jsx b/src/Pages/Investor_Management/InvestorDetails/InvestorDetails.jsx
index d0f3683..8459cc3 100644
--- a/src/Pages/Investor_Management/InvestorDetails/InvestorDetails.jsx
+++ b/src/Pages/Investor_Management/InvestorDetails/InvestorDetails.jsx
@@ -221,7 +221,7 @@ const InvestorDetails = () => {
variant={"solid"}
>
{/* {item.KYCStatus ? "Completed" : "Not complete"} */}
- {item?.KYCStatus === true ? "Completed" : "NotCompleted"}
+ {item?.KYCStatus === true ? "Completed" : "Not Completed"}
),
@@ -321,7 +321,7 @@ const InvestorDetails = () => {
KYC Status
-
+
@@ -337,7 +337,7 @@ const InvestorDetails = () => {
Country
-
+
diff --git a/src/Pages/Master/ExchangeRate/EditExchangeRate.jsx b/src/Pages/Master/ExchangeRate/EditExchangeRate.jsx
index aaa7ac6..5ee8d30 100644
--- a/src/Pages/Master/ExchangeRate/EditExchangeRate.jsx
+++ b/src/Pages/Master/ExchangeRate/EditExchangeRate.jsx
@@ -48,14 +48,16 @@ import FullscreenLoaders from "../../../Components/Loaders/FullscreenLoaders";
const editExchange = yup.object().shape({
rate: yup
- .number()
+ .string()
.required("Rate is required")
- .positive("Rate must be greater than 0")
+ .matches(
+ /^\d+\.\d{8}$/,
+ "Rate must have exactly 8 decimal places"
+ )
.test(
- "is-decimal",
- "Rate must have exactly 8 decimal places",
- (value) =>
- value !== undefined && value.toString().match(/^\d+(\.\d{8})?$/)
+ "is-positive",
+ "Rate must be greater than 0",
+ (value) => parseFloat(value) > 0
),
});
@@ -86,7 +88,7 @@ const EditExchangeRate = ({
const [isBtnLoading, setIsBtnLoading] = useState(false);
const [rateError, setRateError] = useState("");
- const { data, isLoading, errors,refetch } = useGetExchangeRateByIdQuery(id, {
+ const { data, isLoading, errors,refetch, isFetching } = useGetExchangeRateByIdQuery(id, {
skip: !id,
});
@@ -95,17 +97,23 @@ const EditExchangeRate = ({
const [rate, setRate] = useState("");
const [alert, setAlert] = useState(false);
+ console.log(rate);
+
+
useEffect(() => {
+ if (id) {refetch()}
if (foundObject) {
- setRate(foundObject.rate);
+ const numericRate = parseFloat(foundObject.rate) || 0; // Convert to number or default to 0 if invalid
+ setRate(numericRate.toFixed(8)); // Set rate with exactly 8 decimal places
}
}, [foundObject, isOpen]);
+
- useEffect(()=>{
- if (id) {
- refetch()
- }
- },[isOpen])
+ // useEffect(()=>{
+ // if (id) {
+ // refetch()
+ // }
+ // },[isOpen])
const validateRate = async () => {
try {
@@ -178,7 +186,7 @@ const EditExchangeRate = ({
Edit rate
- {isLoading ? (
+ {isFetching ? (
) : (
<>
@@ -228,8 +236,11 @@ const EditExchangeRate = ({
size={"sm"}
value={rate}
onChange={(e) => {
- return setRate(e.target.value);
- // validateRate()
+ const value = e.target.value;
+ // Match numbers with at most 8 decimal places
+ if (/^\d*\.?\d{0,8}$/.test(value)) {
+ setRate(value);
+ }
}}
/>
{rateError && (
From 5743cadf5eb679342b1e6dc160369d6b1b872e2a Mon Sep 17 00:00:00 2001
From: YasinShaikh123 <123150391+YasinShaikh123@users.noreply.github.com>
Date: Wed, 8 Jan 2025 17:04:07 +0530
Subject: [PATCH 12/23] notafication dropdown
---
src/Pages/Admin/Notification.jsx | 214 +++++++++++-------
.../EmailNotification/EmailNotification.jsx | 102 ++++++++-
.../InvestorDetails/InvestorDetails.jsx | 2 +-
3 files changed, 230 insertions(+), 88 deletions(-)
diff --git a/src/Pages/Admin/Notification.jsx b/src/Pages/Admin/Notification.jsx
index 19e3d80..af06635 100644
--- a/src/Pages/Admin/Notification.jsx
+++ b/src/Pages/Admin/Notification.jsx
@@ -3,11 +3,14 @@ import {
Badge,
Box,
Button,
+ HStack,
+ Input,
+ Select,
Text,
Tooltip,
useToast,
} from "@chakra-ui/react";
-import { useForm} from "react-hook-form";
+import { useForm } from "react-hook-form";
import { yupResolver } from "@hookform/resolvers/yup";
import * as yup from "yup";
import { useNavigate } from "react-router-dom";
@@ -29,9 +32,7 @@ import { ViewIcon } from "@chakra-ui/icons";
import { useGetUnbanInvestorQuery } from "../../Services/ban.investor.service";
export const notification = yup.object().shape({
- title: yup
- .string()
- .required("Investment Name is required"),
+ title: yup.string().required("Investment Name is required"),
ManualDate: yup
.date()
.required("Manual Date is required")
@@ -43,33 +44,26 @@ export const notification = yup.object().shape({
/^([01]\d|2[0-3]):?([0-5]\d)$/,
"Invalid time format, must be in HH:mm"
),
- expectedReturn: yup
- .string()
- .required("Expected Return is required"),
+ expectedReturn: yup.string().required("Expected Return is required"),
});
export const notificationNew = yup.object().shape({
- title: yup
- .string()
- .required("Investment Name is required"),
- message: yup
- .string()
- .required("Message is required"),
-
+ title: yup.string().required("Investment Name is required"),
+ message: yup.string().required("Message is required"),
});
-
-
const Notification = () => {
const toast = useToast();
const navigate = useNavigate();
const [form, setForm] = useState({});
const [isLoading, setIsLoading] = useState(false);
- const [ selectedRadio, setSelectedRadio] = useState([])
+ const [selectedRadio, setSelectedRadio] = useState([]);
const [pageSize, setPageSize] = useState(TABLE_PAGINATION?.size);
const [currentPage, setCurrentPage] = useState(TABLE_PAGINATION?.page);
const [searchTerm, setSearchTerm] = useState("");
const [debouncedSearchTerm, setDebouncedSearchTerm] = useState("");
+ const [country, setCountry] = useState("");
+ const [kyc, setKyc] = useState("");
const {
control,
@@ -80,21 +74,20 @@ const Notification = () => {
} = useForm({
resolver: yupResolver(notificationNew),
- defaultValues: {
- title: '',
- message: '',
- },
+ defaultValues: {
+ title: "",
+ message: "",
+ },
});
console.log(errors);
-
+
const {
data: contact,
isLoading: contactLoading,
error,
} = useGetContactQuery();
-
const formatDate = (date) => {
return new Date(date).toLocaleDateString("en-GB", {
day: "2-digit",
@@ -109,28 +102,36 @@ const Notification = () => {
// // error,
// } = useGetInvestorsQuery({ page: currentPage, size: pageSize });
+ useEffect(() => {
+ const handler = setTimeout(() => {
+ setDebouncedSearchTerm(searchTerm);
+ }, 300); // 300ms delay
+ return () => clearTimeout(handler);
+ }, [searchTerm]);
const {
- data : investorDetails,
+ data: investorDetails,
isLoading: investorDetailsLoading,
refetch,
- } = useGetUnbanInvestorQuery({
- page: debouncedSearchTerm ? undefined : currentPage, // Omit pagination for search
- size: debouncedSearchTerm ? undefined : pageSize, // Omit pagination for search
- search: debouncedSearchTerm,
- },
- {
- skip: debouncedSearchTerm === "" && searchTerm !== "", // Skip if search is empty and it's not the initial request
- });;
-
-
+ } = useGetUnbanInvestorQuery(
+ {
+ page: currentPage, // Omit pagination for search
+ size: 10000, // Omit pagination for search
+ page: debouncedSearchTerm ? undefined : currentPage, // Omit pagination for search
+ size: debouncedSearchTerm ? undefined : pageSize, // Omit pagination for search
+ search: debouncedSearchTerm,
+ country_xid: country,
+ KYCStatus: kyc,
+ },
+ {
+ skip: debouncedSearchTerm === "" && searchTerm !== "", // Skip if search is empty and it's not the initial request
+ }
+ );
console.log(investorDetails);
-
const [sendNotification] = useSendNotificationMutation();
-
if (contactLoading) {
return ;
}
@@ -141,9 +142,11 @@ const Notification = () => {
placeHolder: " ",
name: "title",
type: "text",
- width:"100%",
- maxLength:100,
- helperText:`Maximum length should be 100 characters. You have entered ${watch()?.title?.length || 0} characters.`,
+ width: "100%",
+ maxLength: 100,
+ helperText: `Maximum length should be 100 characters. You have entered ${
+ watch()?.title?.length || 0
+ } characters.`,
isRequired: true,
section: "Send Custom Push Notification",
// value: contact?.phoneNumber || "",
@@ -152,15 +155,16 @@ const Notification = () => {
label: "Notification Message",
placeHolder: " ",
name: "message",
- width:"100%",
+ width: "100%",
type: "textarea",
isRequired: true,
- maxLength:200,
- helperText:`Maximum length should be 200 characters. You have entered ${watch()?.message?.length || 0} characters.`,
+ maxLength: 200,
+ helperText: `Maximum length should be 200 characters. You have entered ${
+ watch()?.message?.length || 0
+ } characters.`,
section: "Send Custom Push Notification",
// value: contact?.phoneNumber || "",
},
-
];
const groupedFields = formFields.reduce((groups, field) => {
@@ -173,55 +177,47 @@ const Notification = () => {
}, {});
const onSubmit = async (data) => {
-
const dataToPass = {
...data,
- principal_xid:selectedRadio
- }
+ principal_xid: selectedRadio,
+ };
setIsLoading(true);
try {
const res = await sendNotification(dataToPass);
console.log(res);
-
+
if (res?.error) {
toast({
render: () => (
),
});
- setIsLoading(false)
- }else if(res?.data){
+ setIsLoading(false);
+ } else if (res?.data) {
toast({
- render: () => (
-
- ),
+ render: () => ,
});
- setIsLoading(false)
- setSelectedRadio([])
+ setIsLoading(false);
+ setSelectedRadio([]);
reset({
- title: '', // Resetting specific fields
- message: '',
+ title: "", // Resetting specific fields
+ message: "",
}); // Clears the form fields
- }else{
+ } else {
toast({
render: () => (
-
+
),
});
- setIsLoading(false)
+ setIsLoading(false);
}
} catch (error) {
console.log(error);
setIsLoading(false);
}
-
-
};
-
-
-
// ====================================================[Table Setup]================================================================
const tableHeadRow = [
"Sr N/O",
@@ -235,7 +231,6 @@ const Notification = () => {
"KYC Status",
];
-
const extractedArray = investorDetails?.data?.rows?.map((item, idx) => ({
id: item?.principal_xid,
"Sr N/O": (
@@ -245,7 +240,7 @@ const Notification = () => {
color={"gray.600"}
className="d-flex align-items-center fw-bold web-text-small"
>
- {generateSerialNumber(idx,currentPage, pageSize )}
+ {generateSerialNumber(idx, currentPage, pageSize)}
),
Date: (
@@ -305,9 +300,9 @@ const Notification = () => {
color={item?.KYCStatus === false ? "red" : "blue"}
px={2}
py={0.5}
- variant={'ghost'}
+ variant={"ghost"}
>
- {item?.KYCStatus === true ? "Completed" : "Incompleted"}
+ {item?.KYCStatus === true ? "Completed" : "Not Completed"}
),
@@ -322,18 +317,77 @@ const Notification = () => {
onSubmit={handleSubmit(onSubmit)}
btnLoading={isLoading}
>
-
-
-
+
+ setSearchTerm(e.target.value)}
+ />
+
+
+
+
+
+
+
+
);
diff --git a/src/Pages/EmailNotification/EmailNotification.jsx b/src/Pages/EmailNotification/EmailNotification.jsx
index e74981a..9d2432e 100644
--- a/src/Pages/EmailNotification/EmailNotification.jsx
+++ b/src/Pages/EmailNotification/EmailNotification.jsx
@@ -7,6 +7,7 @@ import {
FormLabel,
HStack,
Input,
+ Select,
Text,
useToast,
} from "@chakra-ui/react";
@@ -28,8 +29,11 @@ const EmailNotification = () => {
const [subject, setSubject] = useState("");
const [value, setValue] = useState(""); // Quill content (body)
const toast = useToast();
-
const [sendCustomNotification] = useSendCustomEmailMutation();
+ const [searchTerm, setSearchTerm] = useState("");
+ const [debouncedSearchTerm, setDebouncedSearchTerm] = useState("");
+ const [country, setCountry] = useState("");
+ const [kyc, setKyc] = useState("");
// ===========================[Table Setup]==============================
const tableHeadRow = [
@@ -47,14 +51,40 @@ const EmailNotification = () => {
const [pageSize, setPageSize] = useState(TABLE_PAGINATION?.size);
const [currentPage, setCurrentPage] = useState(TABLE_PAGINATION?.page);
+ // const {
+ // data: investorDetails,
+ // isLoading: investorDetailsLoading,
+ // refetch,
+ // } = useGetUnbanInvestorQuery({
+ // page: currentPage, // Omit pagination for search
+ // size: 10000, // Omit pagination for search
+ // });
+
+ // useEffect(() => {
+ // const handler = setTimeout(() => {
+ // setDebouncedSearchTerm(searchTerm);
+ // }, 300); // 300ms delay
+ // return () => clearTimeout(handler);
+ // }, [searchTerm]);
+
const {
data: investorDetails,
isLoading: investorDetailsLoading,
refetch,
- } = useGetUnbanInvestorQuery({
- page: currentPage, // Omit pagination for search
- size: 10000, // Omit pagination for search
- });
+ } = useGetUnbanInvestorQuery(
+ {
+ page: currentPage, // Omit pagination for search
+ size: 10000, // Omit pagination for search
+ page: debouncedSearchTerm ? undefined : currentPage, // Omit pagination for search
+ size: debouncedSearchTerm ? undefined : pageSize, // Omit pagination for search
+ search: debouncedSearchTerm,
+ country_xid: country,
+ KYCStatus: kyc,
+ },
+ {
+ skip: debouncedSearchTerm === "" && searchTerm !== "", // Skip if search is empty and it's not the initial request
+ }
+ );
const extractedArray = investorDetails?.data?.rows?.map((item, idx) => ({
id: item?.principal_xid,
@@ -127,7 +157,7 @@ const EmailNotification = () => {
py={0.5}
variant={"ghost"}
>
- {item?.KYCStatus === true ? "Completed" : "Incompleted"}
+ {item?.KYCStatus === true ? "Completed" : "Not Completed"}
),
@@ -270,7 +300,65 @@ const EmailNotification = () => {
-
+
+ setSearchTerm(e.target.value)}
+ />
+
+
+
+
+
{
pb={4}
pt={4}
spacing="24px"
- >
+ >
Date: Wed, 8 Jan 2025 19:51:35 +0530
Subject: [PATCH 13/23] =?UTF-8?q?upadate=20investor=20and=20notifation?=
=?UTF-8?q?=F0=9F=91=8D?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
src/Pages/Admin/Notification.jsx | 31 ++-
.../EmailNotification/EmailNotification.jsx | 236 +++++++++---------
.../InvestorDetails/InvestorDetails.jsx | 94 +++++--
src/Services/ban.investor.service.js | 4 +-
4 files changed, 203 insertions(+), 162 deletions(-)
diff --git a/src/Pages/Admin/Notification.jsx b/src/Pages/Admin/Notification.jsx
index af06635..63ae2b3 100644
--- a/src/Pages/Admin/Notification.jsx
+++ b/src/Pages/Admin/Notification.jsx
@@ -104,30 +104,36 @@ const Notification = () => {
useEffect(() => {
const handler = setTimeout(() => {
- setDebouncedSearchTerm(searchTerm);
- }, 300); // 300ms delay
+ setDebouncedSearchTerm(searchTerm.trim()); // Trim to remove leading/trailing spaces
+ }, 300);
return () => clearTimeout(handler);
}, [searchTerm]);
+
- const {
- data: investorDetails,
- isLoading: investorDetailsLoading,
- refetch,
- } = useGetUnbanInvestorQuery(
+ const { data: investorDetails, isLoading: investorDetailsLoading, refetch } =
+ useGetUnbanInvestorQuery(
{
- page: currentPage, // Omit pagination for search
+ page: 1, // Omit pagination for search
size: 10000, // Omit pagination for search
- page: debouncedSearchTerm ? undefined : currentPage, // Omit pagination for search
- size: debouncedSearchTerm ? undefined : pageSize, // Omit pagination for search
- search: debouncedSearchTerm,
+ // page: debouncedSearchTerm ? undefined : currentPage, // Disable pagination for search
+ // size: debouncedSearchTerm ? undefined : pageSize, // Disable pagination for search
+ search: debouncedSearchTerm, // Pass search term
country_xid: country,
KYCStatus: kyc,
},
{
- skip: debouncedSearchTerm === "" && searchTerm !== "", // Skip if search is empty and it's not the initial request
+ skip: searchTerm !== "" && debouncedSearchTerm === "", // Skip if search not debounced yet
}
);
+ // useEffect(() => {
+ // console.log("Search Term:", searchTerm);
+ // console.log("Debounced Search Term:", debouncedSearchTerm);
+ // console.log("Investor Details:", investorDetails);
+ // }, [searchTerm, debouncedSearchTerm, investorDetails]);
+
+
+
console.log(investorDetails);
const [sendNotification] = useSendNotificationMutation();
@@ -307,6 +313,7 @@ const Notification = () => {
),
}));
+
return (
diff --git a/src/Pages/EmailNotification/EmailNotification.jsx b/src/Pages/EmailNotification/EmailNotification.jsx
index 9d2432e..22d5c98 100644
--- a/src/Pages/EmailNotification/EmailNotification.jsx
+++ b/src/Pages/EmailNotification/EmailNotification.jsx
@@ -11,7 +11,7 @@ import {
Text,
useToast,
} from "@chakra-ui/react";
-import React, { useState } from "react";
+import React, { useEffect, useState } from "react";
import { OPACITY_ON_LOAD } from "../../Layout/animations";
import NormalTable from "../../Components/DataTable/NormalTable";
import { useGetUnbanInvestorQuery } from "../../Services/ban.investor.service";
@@ -60,12 +60,12 @@ const EmailNotification = () => {
// size: 10000, // Omit pagination for search
// });
- // useEffect(() => {
- // const handler = setTimeout(() => {
- // setDebouncedSearchTerm(searchTerm);
- // }, 300); // 300ms delay
- // return () => clearTimeout(handler);
- // }, [searchTerm]);
+ useEffect(() => {
+ const handler = setTimeout(() => {
+ setDebouncedSearchTerm(searchTerm.trim()); // Trim to remove leading/trailing spaces
+ }, 300);
+ return () => clearTimeout(handler);
+ }, [searchTerm]);
const {
data: investorDetails,
@@ -73,10 +73,10 @@ const EmailNotification = () => {
refetch,
} = useGetUnbanInvestorQuery(
{
- page: currentPage, // Omit pagination for search
+ page: 1, // Omit pagination for search
size: 10000, // Omit pagination for search
- page: debouncedSearchTerm ? undefined : currentPage, // Omit pagination for search
- size: debouncedSearchTerm ? undefined : pageSize, // Omit pagination for search
+ // page: debouncedSearchTerm ? undefined : currentPage, // Omit pagination for search
+ // size: debouncedSearchTerm ? undefined : pageSize, // Omit pagination for search
search: debouncedSearchTerm,
country_xid: country,
KYCStatus: kyc,
@@ -165,9 +165,9 @@ const EmailNotification = () => {
const modules = {
toolbar: [
- // [{ header: "1" }, { header: "2" },
- // // { font: [] }
- // ],
+ // [{ header: "1" }, { header: "2" },
+ // // { font: [] }
+ // ],
// [{ size: [] }],
["bold", "italic", "underline", "strike", "blockquote"],
[{ list: "ordered" }, { list: "bullet" }],
@@ -177,12 +177,15 @@ const EmailNotification = () => {
// Main submission logic
const handleSend = async (e) => {
- e.preventDefault(); // Prevent default form submission
+ e.preventDefault(); // Prevent default form submission
if (!subject || !value) {
toast({
render: () => (
-
+
),
});
return;
@@ -191,7 +194,10 @@ const EmailNotification = () => {
if (selectedRadio.length === 0) {
toast({
render: () => (
-
+
),
});
return;
@@ -202,44 +208,36 @@ const EmailNotification = () => {
const emailPayload = {
subject,
body: value,
- principal_xid: selectedRadio,
+ principal_xid: selectedRadio,
};
-
try {
- const res = await sendCustomNotification(emailPayload)
- console.log(res);
+ const res = await sendCustomNotification(emailPayload);
+ console.log(res);
if (res?.error) {
toast({
render: () => (
),
});
- setIsLoading(false)
- }else if(res?.data){
+ setIsLoading(false);
+ } else if (res?.data) {
+ toast({
+ render: () => ,
+ });
+ setIsLoading(false);
+ setSubject("");
+ setValue("");
+ setSelectedRadio([]);
+ } else {
toast({
render: () => (
-
+
),
});
- setIsLoading(false)
- setSubject("")
- setValue("")
- setSelectedRadio([])
-
- }else{
- toast({
- render: () => (
-
- ),
- });
- setIsLoading(false)
+ setIsLoading(false);
}
-
- } catch (error) {
-
- }
-
+ } catch (error) {}
};
return (
@@ -277,98 +275,92 @@ const EmailNotification = () => {
{/* Entered subject will be reflected on emails subject body. */}
-
Create Custom body
-
+
{/*
We'll never share your email.
*/}
-
-
-
-
-
+ setSearchTerm(e.target.value)}
+ />
+
+
+ setKyc(e.target.value)}
+ value={kyc}
+ >
+
+
+
+
+
-
-
+
+
+
diff --git a/src/Pages/Investor_Management/InvestorDetails/InvestorDetails.jsx b/src/Pages/Investor_Management/InvestorDetails/InvestorDetails.jsx
index 927a9a0..96e8e0e 100644
--- a/src/Pages/Investor_Management/InvestorDetails/InvestorDetails.jsx
+++ b/src/Pages/Investor_Management/InvestorDetails/InvestorDetails.jsx
@@ -105,9 +105,11 @@ const InvestorDetails = () => {
"Country",
"Phone Number",
"E-mail ID",
- "Type",
+ // "Type",
+ "Wallet Balance",
+ "Investor Portfolio",
"KYC Status",
- "Status",
+ // "Status",
"Action",
];
@@ -120,8 +122,10 @@ const InvestorDetails = () => {
Country: item?.country?.countryName,
"Phone Number": item?.principal?.mobileNumber, // Skipping integer conversion, as this is likely a string
"E-mail ID": item?.principal?.emailAddress,
- Type: item?.investor_type?.investorTypeName,
- Status: item.ioStatus ? "Ban" : "Unban",
+ "Wallet Balance": item?.principal?.WalletBalance_InInvCur, // Skipping integer conversion, as this is likely a string
+ "Investor Portfolio": item?.principal?.Portfolio_InInvCur,
+ // Type: item?.investor_type?.investorTypeName,
+ // Status: item.ioStatus ? "Ban" : "Unban",
"KYC Status": item.KYCStatus ? "Completed" : "Not complete",
}));
@@ -181,32 +185,70 @@ const InvestorDetails = () => {
),
- Type: (
-
-
-
- {item?.investor_type?.investorTypeName}
+ // Type: (
+ //
+ //
+ //
+ // {item?.investor_type?.investorTypeName}
+ //
+ //
+ //
+ // ),
+ // Status: (
+ //
+ //
+ // {item.ioStatus ? "Ban" : "Unban"}
+ //
+ //
+ // ),
+ "Wallet Balance": (
+
+
+ {/* {formatCurrency(removeTrailingZeros(item?.investorAmount))} */}
+ {parseFloat(item?.WalletBalance_InInvCur || 0).toLocaleString(undefined, {
+ minimumFractionDigits: 2,
+ maximumFractionDigits: 2,
+ })}
+
+ {item?.currencyCode}
),
- Status: (
-
-
- {item.ioStatus ? "Ban" : "Unban"}
-
+ "Investor Portfolio": (
+
+
+ {/* {formatCurrency(removeTrailingZeros(item?.investorAmount))} */}
+ {parseFloat(item?.Portfolio_InInvCur || 0).toLocaleString(undefined, {
+ minimumFractionDigits: 2,
+ maximumFractionDigits: 2,
+ })}
+
+ {item?.currencyCode}
+
+
),
"KYC Status": (
diff --git a/src/Services/ban.investor.service.js b/src/Services/ban.investor.service.js
index e21a758..638eb02 100644
--- a/src/Services/ban.investor.service.js
+++ b/src/Services/ban.investor.service.js
@@ -20,9 +20,9 @@ export const banInvestorDetails = createApi({
getUnbanInvestor: builder.query({
- query: ({ page, size, searchTerm, userStatus, KYCStatus, country_xid }) => {
+ query: ({ page, size, search, userStatus, KYCStatus, country_xid }) => {
// Start with the base URL, including searchTerm
- let baseURL = `/investorDetails/admin/getAllUnbanned?search=${searchTerm || ""}&userStatus=${userStatus ||""}&KYCStatus=${KYCStatus || ""}&country_xid=${country_xid||""}`;
+ let baseURL = `/investorDetails/admin/getAllUnbanned?search=${search || ""}&userStatus=${userStatus ||""}&KYCStatus=${KYCStatus || ""}&country_xid=${country_xid||""}`;
// Conditionally append kycStatus if it's defined
if (KYCStatus) {
From 3c6f0834320e9d712d956cee100a13dc6bdfb4ad Mon Sep 17 00:00:00 2001
From: YasinShaikh123 <123150391+YasinShaikh123@users.noreply.github.com>
Date: Wed, 8 Jan 2025 20:08:57 +0530
Subject: [PATCH 14/23] update error message
---
src/Pages/Admin/Notification.jsx | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/Pages/Admin/Notification.jsx b/src/Pages/Admin/Notification.jsx
index 63ae2b3..3ac1d23 100644
--- a/src/Pages/Admin/Notification.jsx
+++ b/src/Pages/Admin/Notification.jsx
@@ -32,7 +32,7 @@ import { ViewIcon } from "@chakra-ui/icons";
import { useGetUnbanInvestorQuery } from "../../Services/ban.investor.service";
export const notification = yup.object().shape({
- title: yup.string().required("Investment Name is required"),
+ title: yup.string().required("Notification Header is required"),
ManualDate: yup
.date()
.required("Manual Date is required")
@@ -48,7 +48,7 @@ export const notification = yup.object().shape({
});
export const notificationNew = yup.object().shape({
- title: yup.string().required("Investment Name is required"),
+ title: yup.string().required("Notification Header is required"),
message: yup.string().required("Message is required"),
});
From 1434088c1b0941e16e2d826a6fb079fac52ed685 Mon Sep 17 00:00:00 2001
From: Swapnil Bendal <84583651+Swapnil155@users.noreply.github.com>
Date: Wed, 8 Jan 2025 20:31:58 +0530
Subject: [PATCH 15/23] [update] - spell check
---
src/Layout/DefaultLayout.jsx | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/Layout/DefaultLayout.jsx b/src/Layout/DefaultLayout.jsx
index 56976ec..887ea9a 100644
--- a/src/Layout/DefaultLayout.jsx
+++ b/src/Layout/DefaultLayout.jsx
@@ -148,7 +148,7 @@ const DashboardLayout = ({ isOnline }) => {
case path.startsWith("/email"):
return (
- Email Notifiation
+ Email Notification
);
case path.startsWith("/investment-type"):
From c33e358e8e1a1a4976d8bfa83447212b0a012a60 Mon Sep 17 00:00:00 2001
From: YasinShaikh123 <123150391+YasinShaikh123@users.noreply.github.com>
Date: Wed, 8 Jan 2025 20:38:23 +0530
Subject: [PATCH 16/23] change investor ammont with
---
.../Investor_Management/InvestorDetails/InvestorDetails.jsx | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/Pages/Investor_Management/InvestorDetails/InvestorDetails.jsx b/src/Pages/Investor_Management/InvestorDetails/InvestorDetails.jsx
index 96e8e0e..86d4eb8 100644
--- a/src/Pages/Investor_Management/InvestorDetails/InvestorDetails.jsx
+++ b/src/Pages/Investor_Management/InvestorDetails/InvestorDetails.jsx
@@ -217,7 +217,7 @@ const InvestorDetails = () => {
@@ -236,7 +236,7 @@ const InvestorDetails = () => {
From 974d1501b2d39ff7cf0a7c0c675e499eb59f3134 Mon Sep 17 00:00:00 2001
From: Swapnil Bendal <84583651+Swapnil155@users.noreply.github.com>
Date: Wed, 8 Jan 2025 20:57:53 +0530
Subject: [PATCH 17/23] [update] - Hard code changes
---
src/Layout/DefaultLayout.jsx | 2 +-
.../InvestorDetails/InvestorDetails.jsx | 30 ++++++++++++-------
2 files changed, 21 insertions(+), 11 deletions(-)
diff --git a/src/Layout/DefaultLayout.jsx b/src/Layout/DefaultLayout.jsx
index 887ea9a..f615b1e 100644
--- a/src/Layout/DefaultLayout.jsx
+++ b/src/Layout/DefaultLayout.jsx
@@ -297,7 +297,7 @@ const DashboardLayout = ({ isOnline }) => {
return (
- Notification
+ Push Notification
);
case path.startsWith("/contact"):
diff --git a/src/Pages/Investor_Management/InvestorDetails/InvestorDetails.jsx b/src/Pages/Investor_Management/InvestorDetails/InvestorDetails.jsx
index 86d4eb8..edd5e12 100644
--- a/src/Pages/Investor_Management/InvestorDetails/InvestorDetails.jsx
+++ b/src/Pages/Investor_Management/InvestorDetails/InvestorDetails.jsx
@@ -222,10 +222,13 @@ const InvestorDetails = () => {
>
{/* {formatCurrency(removeTrailingZeros(item?.investorAmount))} */}
- {parseFloat(item?.WalletBalance_InInvCur || 0).toLocaleString(undefined, {
- minimumFractionDigits: 2,
- maximumFractionDigits: 2,
- })}
+ {parseFloat(item?.WalletBalance_InInvCur || 0).toLocaleString(
+ undefined,
+ {
+ minimumFractionDigits: 2,
+ maximumFractionDigits: 2,
+ }
+ )}
{item?.currencyCode}
@@ -240,11 +243,18 @@ const InvestorDetails = () => {
isTruncated={true}
>
- {/* {formatCurrency(removeTrailingZeros(item?.investorAmount))} */}
- {parseFloat(item?.Portfolio_InInvCur || 0).toLocaleString(undefined, {
- minimumFractionDigits: 2,
- maximumFractionDigits: 2,
- })}
+ {item.clientReference_id === "T2481950"
+ ? parseFloat(15100 || 0).toLocaleString(undefined, {
+ minimumFractionDigits: 2,
+ maximumFractionDigits: 2,
+ })
+ : parseFloat(item?.Portfolio_InInvCur || 0).toLocaleString(
+ undefined,
+ {
+ minimumFractionDigits: 2,
+ maximumFractionDigits: 2,
+ }
+ )}
{item?.currencyCode}
@@ -320,7 +330,7 @@ const InvestorDetails = () => {
pb={4}
pt={4}
spacing="24px"
- >
+ >
Date: Thu, 9 Jan 2025 17:53:51 +0530
Subject: [PATCH 18/23] update KYC
---
.../Investor_Management/InvestorDetails/Kyc.jsx | 16 ++++++++++++++++
1 file changed, 16 insertions(+)
diff --git a/src/Pages/Investor_Management/InvestorDetails/Kyc.jsx b/src/Pages/Investor_Management/InvestorDetails/Kyc.jsx
index 6884845..8fec7a5 100644
--- a/src/Pages/Investor_Management/InvestorDetails/Kyc.jsx
+++ b/src/Pages/Investor_Management/InvestorDetails/Kyc.jsx
@@ -150,6 +150,22 @@ const Kyc = () => {
/>
+
+
+
+ PEP Status
+
+
+
+
+
{/*
Address
From 0ed01bf94f54e986a264873a385ab96e801fbfa9 Mon Sep 17 00:00:00 2001
From: YasinShaikh123 <123150391+YasinShaikh123@users.noreply.github.com>
Date: Thu, 9 Jan 2025 19:33:54 +0530
Subject: [PATCH 19/23] [fixed] - model
---
.../CreateIO/IOTransaction/ViewDistributionInvestor.jsx | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/Pages/IO_Management/CreateIO/IOTransaction/ViewDistributionInvestor.jsx b/src/Pages/IO_Management/CreateIO/IOTransaction/ViewDistributionInvestor.jsx
index 5694c8c..fc1c594 100644
--- a/src/Pages/IO_Management/CreateIO/IOTransaction/ViewDistributionInvestor.jsx
+++ b/src/Pages/IO_Management/CreateIO/IOTransaction/ViewDistributionInvestor.jsx
@@ -172,7 +172,7 @@ const ViewDistributionInvestor = ({ isOpen, onClose, id: exitId, amount }) => {
"Distriution Amt($)": (
- {IODetails?.ioTransactionRecords?.Pending[index]?.transactionAmount?.toLocaleString(undefined, {
+ {item?.distribution_amt?.toLocaleString(undefined, {
minimumFractionDigits: 2,
maximumFractionDigits: 2,
})}
From a07d011c8508325b7118bca4805a1806bc78b6c7 Mon Sep 17 00:00:00 2001
From: YasinShaikh123 <123150391+YasinShaikh123@users.noreply.github.com>
Date: Thu, 9 Jan 2025 20:15:06 +0530
Subject: [PATCH 20/23] [Distribution Amt]
---
.../CreateIO/IOTransaction/ViewDistributionInvestor.jsx | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/Pages/IO_Management/CreateIO/IOTransaction/ViewDistributionInvestor.jsx b/src/Pages/IO_Management/CreateIO/IOTransaction/ViewDistributionInvestor.jsx
index fc1c594..8316521 100644
--- a/src/Pages/IO_Management/CreateIO/IOTransaction/ViewDistributionInvestor.jsx
+++ b/src/Pages/IO_Management/CreateIO/IOTransaction/ViewDistributionInvestor.jsx
@@ -108,7 +108,7 @@ const ViewDistributionInvestor = ({ isOpen, onClose, id: exitId, amount }) => {
"Last Name",
"Amount",
"Holding (%)",
- "Distriution Amt($)",
+ "Distribution Amt($)",
"Yeild (%)",
];
@@ -169,7 +169,7 @@ const ViewDistributionInvestor = ({ isOpen, onClose, id: exitId, amount }) => {
),
- "Distriution Amt($)": (
+ "Distribution Amt($)": (
{item?.distribution_amt?.toLocaleString(undefined, {
From 84dc47b4478b41f2c0114fdb1943f1bea17fce45 Mon Sep 17 00:00:00 2001
From: YasinShaikh123 <123150391+YasinShaikh123@users.noreply.github.com>
Date: Fri, 10 Jan 2025 17:28:26 +0530
Subject: [PATCH 21/23] =?UTF-8?q?done=20changes=20and=20bug=E2=9C=85?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
src/Components/FormField.jsx | 2 +-
.../IO_Management/InvestmentDocuments.jsx | 4 +-
.../ViewIO/HeaderModal/UpdateIOStatus.jsx | 48 +++++++++++++++----
.../InvestorDetails/BankDetails.jsx | 2 +-
.../InvestorDetails/InvestorDetails.jsx | 3 +-
src/Services/io.service.js | 3 +-
6 files changed, 48 insertions(+), 14 deletions(-)
diff --git a/src/Components/FormField.jsx b/src/Components/FormField.jsx
index 2c67452..0853ad2 100644
--- a/src/Components/FormField.jsx
+++ b/src/Components/FormField.jsx
@@ -520,7 +520,7 @@ const FormField = ({
ps={1}
{...field}
{...props} size='md' colorScheme='forestGreen'>
- Is This Sharia Compliant
+ Is This Shariah Compliant
);} else{
diff --git a/src/Pages/IO_Management/InvestmentDocuments.jsx b/src/Pages/IO_Management/InvestmentDocuments.jsx
index f89958f..92633cf 100644
--- a/src/Pages/IO_Management/InvestmentDocuments.jsx
+++ b/src/Pages/IO_Management/InvestmentDocuments.jsx
@@ -60,9 +60,9 @@ export const investmentDocSchema = yup.object().shape({
// return value && value.size <= 2 * 1024 * 1024; // 2MB in bytes
// })
fileName: yup.string().required("File name is required")
- .max(30, "File name must be at most 30 characters"), // Maximum length validation,
+ .max(35, "File name must be at most 30 characters"), // Maximum length validation,
documentNameArabic: yup.string().required("File name Arabic is required")
- .max(25, "File name must be at most 30 characters"),
+ .max(25, "File name must be at most 35 characters"),
});
const InvestmentDocuments = ({
diff --git a/src/Pages/IO_Management/ViewIO/HeaderModal/UpdateIOStatus.jsx b/src/Pages/IO_Management/ViewIO/HeaderModal/UpdateIOStatus.jsx
index 6327f52..1a3a60f 100644
--- a/src/Pages/IO_Management/ViewIO/HeaderModal/UpdateIOStatus.jsx
+++ b/src/Pages/IO_Management/ViewIO/HeaderModal/UpdateIOStatus.jsx
@@ -17,6 +17,9 @@ import {
ModalHeader,
ModalOverlay,
FormErrorMessage,
+ Text,
+ Textarea,
+ Box,
} from "@chakra-ui/react";
import {
useGetIOprepopulateDataQuery,
@@ -37,6 +40,8 @@ const UpdateIOStatus = ({ isOpen, onClose, status }) => {
const { data } = useGetIOprepopulateDataQuery();
const [updateStatusIo] = useUpdateStatusIoMutation();
const [updateCancleStatus] = useUpdateCancleStatusToMutation();
+ const [message, setMessage] = useState(null);
+ const [messageError, setMessageError] = useState(null);
// useEffect(() => {
// setSelectedStatusId(status?.[0]?.id);
@@ -47,11 +52,14 @@ const UpdateIOStatus = ({ isOpen, onClose, status }) => {
setSelectedStatusId(id);
};
- const handleSubmit = async () => {
+ const handleSubmit = async (data) => {
if (!selectedStatusId) {
setError("Please select status");
return;
}
+ if (!message) {
+ return setMessageError("message is required");
+ }
setError("");
setIsLoading(true);
try {
@@ -60,9 +68,10 @@ const UpdateIOStatus = ({ isOpen, onClose, status }) => {
// If selectedItem is 'Cancelled', make the updateCancelStatus API call
if (selectedItem === import.meta.env.VITE_STATUS_CANCELLED) {
res = await updateCancleStatus({
- id
+ id: selectedStatusId,
+ data: { comments: message },
});
- }
+ }
// Otherwise, make the updateStatusIo API call
else {
res = await updateStatusIo({
@@ -72,7 +81,7 @@ const UpdateIOStatus = ({ isOpen, onClose, status }) => {
id,
});
}
-
+
console.log("API Response:", res);
setIsLoading(false);
handleClose();
@@ -84,6 +93,8 @@ const UpdateIOStatus = ({ isOpen, onClose, status }) => {
const handleClose = () => {
setSelectedItem(null);
setSelectedStatusId(null);
+ setMessage(null);
+ setMessageError(null);
onClose();
setError("");
};
@@ -121,7 +132,8 @@ const UpdateIOStatus = ({ isOpen, onClose, status }) => {
colorScheme={
selectedItem === import.meta.env.VITE_STATUS_DRAFT
? "gray"
- : selectedItem === import.meta.env.VITE_STATUS_PROCESSING
+ : selectedItem ===
+ import.meta.env.VITE_STATUS_PROCESSING
? "yellow"
: selectedItem === import.meta.env.VITE_STATUS_OPEN
? "blue"
@@ -154,7 +166,7 @@ const UpdateIOStatus = ({ isOpen, onClose, status }) => {
{
colorScheme={
statusAdmin === import.meta.env.VITE_STATUS_DRAFT
? "gray"
- : statusAdmin === import.meta.env.VITE_STATUS_PROCESSING
+ : statusAdmin ===
+ import.meta.env.VITE_STATUS_PROCESSING
? "yellow"
: statusAdmin === import.meta.env.VITE_STATUS_OPEN
? "blue"
@@ -171,7 +184,8 @@ const UpdateIOStatus = ({ isOpen, onClose, status }) => {
? "green"
: statusAdmin === import.meta.env.VITE_STATUS_EXITED
? "red"
- : statusAdmin === import.meta.env.VITE_STATUS_CANCELLED
+ : statusAdmin ===
+ import.meta.env.VITE_STATUS_CANCELLED
? "orange"
: "purple"
}
@@ -191,6 +205,24 @@ const UpdateIOStatus = ({ isOpen, onClose, status }) => {
{error}
+ {selectedItem === import.meta.env.VITE_STATUS_CANCELLED && (
+
+
+ Message
+
+
+ )}
+ {messageError && (
+
+ {messageError}
+
+ )}
{
return (
- Bank Deatils
+ Bank Details
{
minimumFractionDigits: 2,
maximumFractionDigits: 2,
})
- : parseFloat(item?.Portfolio_InInvCur || 0).toLocaleString(
+ :
+ parseFloat(item?.Portfolio_InInvCur || 0).toLocaleString(
undefined,
{
minimumFractionDigits: 2,
diff --git a/src/Services/io.service.js b/src/Services/io.service.js
index b19cd61..41377ea 100644
--- a/src/Services/io.service.js
+++ b/src/Services/io.service.js
@@ -256,8 +256,9 @@ export const ioService = createApi({
updateCancleStatusTo: builder.mutation({
query: ({ id, data }) => ({
- url: `/io/admin/transaction/${id}/cancel`,
+ url: `/io/admin/maker-transaction/${id}/io-cancel`,
method: "POST",
+ body:data
}),
invalidatesTags: ["getIOById"],
}),
From ebcb06bf5e83ef533426f7138ac3a69049b267f9 Mon Sep 17 00:00:00 2001
From: YasinShaikh123 <123150391+YasinShaikh123@users.noreply.github.com>
Date: Fri, 10 Jan 2025 17:34:09 +0530
Subject: [PATCH 22/23] =?UTF-8?q?hogaya=E2=9C=85?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
src/Pages/IO_Management/ViewIO/HeaderModal/UpdateIOStatus.jsx | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/Pages/IO_Management/ViewIO/HeaderModal/UpdateIOStatus.jsx b/src/Pages/IO_Management/ViewIO/HeaderModal/UpdateIOStatus.jsx
index 1a3a60f..1db3014 100644
--- a/src/Pages/IO_Management/ViewIO/HeaderModal/UpdateIOStatus.jsx
+++ b/src/Pages/IO_Management/ViewIO/HeaderModal/UpdateIOStatus.jsx
@@ -68,7 +68,7 @@ const UpdateIOStatus = ({ isOpen, onClose, status }) => {
// If selectedItem is 'Cancelled', make the updateCancelStatus API call
if (selectedItem === import.meta.env.VITE_STATUS_CANCELLED) {
res = await updateCancleStatus({
- id: selectedStatusId,
+ id: id,
data: { comments: message },
});
}
From a51585089c7f0eb46f0af016473aa55d0d800796 Mon Sep 17 00:00:00 2001
From: Swapnil Bendal <84583651+Swapnil155@users.noreply.github.com>
Date: Fri, 10 Jan 2025 17:42:20 +0530
Subject: [PATCH 23/23] refactor: simplify exportInvestor mapping and currency
formatting
---
.../InvestorDetails/InvestorDetails.jsx | 19 +++++--------------
1 file changed, 5 insertions(+), 14 deletions(-)
diff --git a/src/Pages/Investor_Management/InvestorDetails/InvestorDetails.jsx b/src/Pages/Investor_Management/InvestorDetails/InvestorDetails.jsx
index 5e48c00..de837a2 100644
--- a/src/Pages/Investor_Management/InvestorDetails/InvestorDetails.jsx
+++ b/src/Pages/Investor_Management/InvestorDetails/InvestorDetails.jsx
@@ -114,7 +114,7 @@ const InvestorDetails = () => {
];
// ====================================================[Table Filter]================================================================
- const exportInvestor = investorDetails?.data?.rows?.map((item, idx) => ({
+ const exportInvestor = investorDetails?.data?.rows?.map((item) => ({
Id: parseInt(item?.id, 10) || item?.id, // Convert to integer, fallback to string if conversion fails
"Client ID": item?.clientReference_id, // This is likely a string
"First Name": item?.principal?.firstName,
@@ -243,19 +243,10 @@ const InvestorDetails = () => {
isTruncated={true}
>
- {item.clientReference_id === "T2481950"
- ? parseFloat(15100 || 0).toLocaleString(undefined, {
- minimumFractionDigits: 2,
- maximumFractionDigits: 2,
- })
- :
- parseFloat(item?.Portfolio_InInvCur || 0).toLocaleString(
- undefined,
- {
- minimumFractionDigits: 2,
- maximumFractionDigits: 2,
- }
- )}
+ {parseFloat(item?.Portfolio_InInvCur || 0).toLocaleString(undefined, {
+ minimumFractionDigits: 2,
+ maximumFractionDigits: 2,
+ })}
{item?.currencyCode}