Compare commits
8 Commits
bug-fix/9.
...
Sprint-9
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
6e42bc0adb | ||
|
|
c9e5223989 | ||
|
|
69f76bbdce | ||
|
|
25df0d6160 | ||
|
|
51727d4de1 | ||
|
|
1539493641 | ||
|
|
d63ac2eb2b | ||
|
|
b620cd410d |
@@ -31,6 +31,7 @@ import Header from "../Header";
|
|||||||
import ToastBox from "../ToastBox";
|
import ToastBox from "../ToastBox";
|
||||||
import BannerMainCard from "./BannerMainCard";
|
import BannerMainCard from "./BannerMainCard";
|
||||||
|
|
||||||
|
|
||||||
const AddBanner = ({ createApi, navigateLink, title, center }) => {
|
const AddBanner = ({ createApi, navigateLink, title, center }) => {
|
||||||
const toast = useToast();
|
const toast = useToast();
|
||||||
const navigate = useNavigate();
|
const navigate = useNavigate();
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ import ToastBox from "../../Components/ToastBox";
|
|||||||
import NormalTable from "../../Components/DataTable/NormalTable";
|
import NormalTable from "../../Components/DataTable/NormalTable";
|
||||||
import GlobalStateContext from "../../Contexts/GlobalStateContext";
|
import GlobalStateContext from "../../Contexts/GlobalStateContext";
|
||||||
import { useGetInvestorsQuery } from "../../Services/investor.details.service";
|
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 { formatDate, generateSerialNumber } from "../../Constants/Constants";
|
||||||
import { ViewIcon } from "@chakra-ui/icons";
|
import { ViewIcon } from "@chakra-ui/icons";
|
||||||
import { useGetUnbanInvestorQuery } from "../../Services/ban.investor.service";
|
import { useGetUnbanInvestorQuery } from "../../Services/ban.investor.service";
|
||||||
@@ -66,8 +66,8 @@ const Notification = () => {
|
|||||||
const [form, setForm] = useState({});
|
const [form, setForm] = useState({});
|
||||||
const [isLoading, setIsLoading] = useState(false);
|
const [isLoading, setIsLoading] = useState(false);
|
||||||
const [ selectedRadio, setSelectedRadio] = useState([])
|
const [ selectedRadio, setSelectedRadio] = useState([])
|
||||||
const [pageSize, setPageSize] = useState(TABLE_PAGINATION?.size);
|
const [pageSize, setPageSize] = useState(INVESTOR_TABLE_PAGINATION?.size);
|
||||||
const [currentPage, setCurrentPage] = useState(TABLE_PAGINATION?.page);
|
const [currentPage, setCurrentPage] = useState(INVESTOR_TABLE_PAGINATION?.page);
|
||||||
const [searchTerm, setSearchTerm] = useState("");
|
const [searchTerm, setSearchTerm] = useState("");
|
||||||
const [debouncedSearchTerm, setDebouncedSearchTerm] = useState("");
|
const [debouncedSearchTerm, setDebouncedSearchTerm] = useState("");
|
||||||
|
|
||||||
@@ -116,7 +116,7 @@ const Notification = () => {
|
|||||||
refetch,
|
refetch,
|
||||||
} = useGetUnbanInvestorQuery({
|
} = useGetUnbanInvestorQuery({
|
||||||
page: debouncedSearchTerm ? undefined : currentPage, // Omit pagination for search
|
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,
|
search: debouncedSearchTerm,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -217,7 +217,7 @@ const IOArtifactsAdd = ({ isOpen, onClose, firstField, actionId, setActionId, da
|
|||||||
isOpen={alert}
|
isOpen={alert}
|
||||||
onClose={() => setAlert(false)}
|
onClose={() => setAlert(false)}
|
||||||
alertHandler={handleSave}
|
alertHandler={handleSave}
|
||||||
message={"Are you sure you want to update this artifact?"}
|
message={"Are you sure you want to add this artifact?"}
|
||||||
isLoading={isLoading}
|
isLoading={isLoading}
|
||||||
/>
|
/>
|
||||||
</>
|
</>
|
||||||
|
|||||||
@@ -107,7 +107,8 @@ const IOCashDetails = () => {
|
|||||||
</Tab>
|
</Tab>
|
||||||
</TabList>
|
</TabList>
|
||||||
{IODetails?.isInvestedAmount
|
{IODetails?.isInvestedAmount
|
||||||
? isMaker() && (
|
? isMaker() &&
|
||||||
|
IODetails?.ioSatatus !== "Exited" && (
|
||||||
<Button
|
<Button
|
||||||
onClick={handleAdd}
|
onClick={handleAdd}
|
||||||
leftIcon={<AddIcon />}
|
leftIcon={<AddIcon />}
|
||||||
|
|||||||
@@ -119,7 +119,7 @@ import AddCaseDetails from "./AddCaseDetails";
|
|||||||
<Badge ms={1} colorScheme="green" me={1}>
|
<Badge ms={1} colorScheme="green" me={1}>
|
||||||
$
|
$
|
||||||
</Badge>
|
</Badge>
|
||||||
{parseFloat(IODetails?.ioCash || 0).toLocaleString(undefined, {
|
{parseFloat(item?.transactionAmount || 0).toLocaleString(undefined, {
|
||||||
minimumFractionDigits: 2,
|
minimumFractionDigits: 2,
|
||||||
maximumFractionDigits: 2,
|
maximumFractionDigits: 2,
|
||||||
})}
|
})}
|
||||||
|
|||||||
@@ -12,11 +12,12 @@ import {
|
|||||||
useUpdateIOMutation,
|
useUpdateIOMutation,
|
||||||
} from "../../../Services/io.service";
|
} from "../../../Services/io.service";
|
||||||
import ToastBox from "../../../Components/ToastBox";
|
import ToastBox from "../../../Components/ToastBox";
|
||||||
import {
|
import { useToast } from "@chakra-ui/react";
|
||||||
useToast,
|
|
||||||
} from "@chakra-ui/react";
|
|
||||||
import { formatDatee } from "../../../Components/FormField";
|
import { formatDatee } from "../../../Components/FormField";
|
||||||
import { formatDateToYYYYMMDD, removeTrailingZeros } from "../../../Constants/Constants";
|
import {
|
||||||
|
formatDateToYYYYMMDD,
|
||||||
|
removeTrailingZeros,
|
||||||
|
} from "../../../Constants/Constants";
|
||||||
|
|
||||||
const schema = yup.object().shape({
|
const schema = yup.object().shape({
|
||||||
investmentNameEnglish: yup
|
investmentNameEnglish: yup
|
||||||
@@ -25,7 +26,7 @@ const schema = yup.object().shape({
|
|||||||
.min(3, "IO name in English must be at least 3 characters long")
|
.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"),
|
.max(150, "IO name in English must be at most 150 characters long"),
|
||||||
|
|
||||||
investmentNameArabic: yup
|
investmentNameArabic: yup
|
||||||
.string()
|
.string()
|
||||||
.required("IO name in Arabic is required")
|
.required("IO name in Arabic is required")
|
||||||
.min(3, "IO name in Arabic must be at least 3 characters long")
|
.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")
|
.required("Description in Arabic is required")
|
||||||
.min(10, "Description in Arabic must be at least 10 characters long")
|
.min(10, "Description in Arabic must be at least 10 characters long")
|
||||||
.max(2000, "Description in Arabic must be at most 500 characters long"),
|
.max(2000, "Description in Arabic must be at most 500 characters long"),
|
||||||
expectedReturnArabic: yup
|
expectedReturnArabic: yup
|
||||||
.string()
|
.string()
|
||||||
.required("Expected return in Arabic is required"),
|
.required("Expected return in Arabic is required"),
|
||||||
|
|
||||||
goalAmount: yup
|
goalAmount: yup
|
||||||
.number()
|
.number()
|
||||||
.typeError("Goal Amount is must be number")
|
.typeError("Goal Amount is must be number")
|
||||||
.required('Goal amount is required')
|
.required("Goal amount is required")
|
||||||
.positive('Goal amount must be a positive number'),
|
.positive("Goal amount must be a positive number"),
|
||||||
closingDate: yup
|
closingDate: yup
|
||||||
.date()
|
.date()
|
||||||
.notRequired("Closing date is required")
|
.notRequired("Closing date is required")
|
||||||
@@ -69,28 +70,25 @@ const schema = yup.object().shape({
|
|||||||
|
|
||||||
InvestmentDetails: yup.string().notRequired(),
|
InvestmentDetails: yup.string().notRequired(),
|
||||||
|
|
||||||
comment: yup.string().notRequired()
|
comment: yup
|
||||||
// .min(10, "Comment must be at least 10 characters long")
|
|
||||||
.max(100, "Comment must be at most 100 characters long"),
|
|
||||||
|
|
||||||
expectedReturn: yup
|
|
||||||
.string()
|
.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 IODetails = ({ enableNextTab, index, data }) => {
|
||||||
|
|
||||||
const params = useParams();
|
const params = useParams();
|
||||||
const navigate = useNavigate();
|
const navigate = useNavigate();
|
||||||
const toast = useToast();
|
const toast = useToast();
|
||||||
|
|
||||||
|
|
||||||
const handleInputChangeCreate = (index, newValue) => {
|
const handleInputChangeCreate = (index, newValue) => {
|
||||||
|
|
||||||
const updatedValues = [...values];
|
const updatedValues = [...values];
|
||||||
updatedValues[index].value = newValue;
|
updatedValues[index].value = newValue;
|
||||||
setValues(updatedValues);
|
setValues(updatedValues);
|
||||||
console.log(values);
|
console.log(values);
|
||||||
};
|
};
|
||||||
|
|
||||||
const handleInputChangeEdit = (index, newValue) => {
|
const handleInputChangeEdit = (index, newValue) => {
|
||||||
@@ -143,9 +141,12 @@ const IODetails = ({ enableNextTab, index, data }) => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
const miniValue = data?.country?.map(
|
const miniValue = data?.country?.map(
|
||||||
({ countryName, flagIcon, minInvestmentAmt, countryCode, id, currency }, index) => {
|
(
|
||||||
|
{ countryName, flagIcon, minInvestmentAmt, countryCode, id, currency },
|
||||||
|
index
|
||||||
|
) => {
|
||||||
return {
|
return {
|
||||||
id:id,
|
id: id,
|
||||||
country: countryName,
|
country: countryName,
|
||||||
value: minInvestmentAmt,
|
value: minInvestmentAmt,
|
||||||
logo: flagIcon,
|
logo: flagIcon,
|
||||||
@@ -154,18 +155,19 @@ const IODetails = ({ enableNextTab, index, data }) => {
|
|||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
const minInvestmentById = IObyID?.data?.minInvestmentAmt?.map(({minInvestmentAmt, country, currencyCode, country_xid,id })=>{
|
const minInvestmentById = IObyID?.data?.minInvestmentAmt?.map(
|
||||||
console.log(currencyCode);
|
({ minInvestmentAmt, country, currencyCode, country_xid, id }) => {
|
||||||
return{
|
console.log(currencyCode);
|
||||||
_id:id,
|
return {
|
||||||
id:country_xid,
|
_id: id,
|
||||||
country: country?.countryName,
|
id: country_xid,
|
||||||
value: removeTrailingZeros(minInvestmentAmt),
|
country: country?.countryName,
|
||||||
logo: country?.flagIcon,
|
value: removeTrailingZeros(minInvestmentAmt),
|
||||||
curr: currencyCode,
|
logo: country?.flagIcon,
|
||||||
|
curr: currencyCode,
|
||||||
|
};
|
||||||
}
|
}
|
||||||
})
|
);
|
||||||
|
|
||||||
|
|
||||||
const schemaEdit = yup.object().shape({
|
const schemaEdit = yup.object().shape({
|
||||||
investmentNameEnglish: yup
|
investmentNameEnglish: yup
|
||||||
@@ -173,73 +175,67 @@ const IODetails = ({ enableNextTab, index, data }) => {
|
|||||||
.required("IO name in English is required")
|
.required("IO name in English is required")
|
||||||
.min(3, "IO name in English must be at least 3 characters long")
|
.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"),
|
.max(150, "IO name in English must be at most 150 characters long"),
|
||||||
|
|
||||||
investmentNameArabic: yup
|
investmentNameArabic: yup
|
||||||
.string()
|
.string()
|
||||||
.required("IO name in Arabic is required")
|
.required("IO name in Arabic is required")
|
||||||
.min(3, "IO name in Arabic must be at least 3 characters long")
|
.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"),
|
.max(50, "IO name in Arabic must be at most 50 characters long"),
|
||||||
|
|
||||||
descriptionEnglish: yup
|
descriptionEnglish: yup
|
||||||
.string()
|
.string()
|
||||||
.required("Description in English is required")
|
.required("Description in English is required")
|
||||||
.min(10, "Description in English must be at least 10 characters long")
|
.min(10, "Description in English must be at least 10 characters long")
|
||||||
.max(1000, "Description in English must be at most 1000 characters long"),
|
.max(1000, "Description in English must be at most 1000 characters long"),
|
||||||
|
|
||||||
descriptionArabic: yup
|
descriptionArabic: yup
|
||||||
.string()
|
.string()
|
||||||
.required("Description in Arabic is required")
|
.required("Description in Arabic is required")
|
||||||
.min(10, "Description in Arabic must be at least 10 characters long")
|
.min(10, "Description in Arabic must be at least 10 characters long")
|
||||||
.max(2000, "Description in Arabic must be at most 500 characters long"),
|
.max(2000, "Description in Arabic must be at most 500 characters long"),
|
||||||
expectedReturnArabic: yup
|
expectedReturnArabic: yup
|
||||||
.string()
|
.string()
|
||||||
.required("Expected return in Arabic is required"),
|
.required("Expected return in Arabic is required"),
|
||||||
|
|
||||||
goalAmount: yup
|
goalAmount: yup
|
||||||
.number()
|
.number()
|
||||||
.typeError("Goal Amount is must be number")
|
.typeError("Goal Amount is must be number")
|
||||||
.required('Goal amount is required')
|
.required("Goal amount is required")
|
||||||
.positive('Goal amount must be a positive number')
|
.positive("Goal amount must be a positive number")
|
||||||
.min(IObyID?.data?.totalAmtInvestmentInUSD, `Goal amount should not be lesser then amount raised ${IObyID?.data?.totalAmtInvestmentInUSD}`),
|
.min(
|
||||||
closingDate: yup
|
IObyID?.data?.totalAmtInvestmentInUSD,
|
||||||
.date()
|
`Goal amount should not be lesser then amount raised ${IObyID?.data?.totalAmtInvestmentInUSD}`
|
||||||
.notRequired("Closing date is required")
|
),
|
||||||
.min(new Date(), "Closing date cannot be in the past"),
|
closingDate: yup.date().notRequired("Closing date is required"),
|
||||||
|
|
||||||
holdingPeriod: yup.string().required("Holding period is required"),
|
holdingPeriod: yup.string().required("Holding period is required"),
|
||||||
holdingPeriodArabic: yup.string().required("Holding period is required"),
|
holdingPeriodArabic: yup.string().required("Holding period is required"),
|
||||||
isShariah: yup.string().required("CheckBox is required"),
|
isShariah: yup.string().required("CheckBox is required"),
|
||||||
|
|
||||||
|
|
||||||
// minInvestmentAmount: yup
|
// minInvestmentAmount: yup
|
||||||
// .number()
|
// .number()
|
||||||
// .required("Minimum investment is required")
|
// .required("Minimum investment is required")
|
||||||
// .positive("Minimum investment must be a positive number")
|
// .positive("Minimum investment must be a positive number")
|
||||||
// .min(1, "Minimum investment must be at least 1"),
|
// .min(1, "Minimum investment must be at least 1"),
|
||||||
|
|
||||||
ISIN: yup.string().notRequired(),
|
ISIN: yup.string().notRequired(),
|
||||||
|
|
||||||
InvestmentDetails: yup.string().notRequired(),
|
InvestmentDetails: yup.string().notRequired(),
|
||||||
|
|
||||||
comment: yup.string().notRequired()
|
comment: yup
|
||||||
.min(10, "Comment must be at least 10 characters long")
|
|
||||||
.max(100, "Comment must be at most 100 characters long"),
|
|
||||||
|
|
||||||
expectedReturn: yup
|
|
||||||
.string()
|
.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) => {
|
const formatNumber = (num) => {
|
||||||
// Remove non-numeric characters and format with commas
|
// Remove non-numeric characters and format with commas
|
||||||
return num.replace(/\D/g, '')
|
return num.replace(/\D/g, "").replace(/\B(?=(\d{3})+(?!\d))/g, ",");
|
||||||
.replace(/\B(?=(\d{3})+(?!\d))/g, ',');
|
|
||||||
};
|
};
|
||||||
// console.log(values);
|
// console.log(values);
|
||||||
|
|
||||||
@@ -253,10 +249,11 @@ const IODetails = ({ enableNextTab, index, data }) => {
|
|||||||
formState: { errors },
|
formState: { errors },
|
||||||
} = useForm({
|
} = useForm({
|
||||||
resolver: yupResolver(id ? schemaEdit : schema),
|
resolver: yupResolver(id ? schemaEdit : schema),
|
||||||
|
mode: "all",
|
||||||
});
|
});
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
setIOloading(IObyIDisLoading)
|
setIOloading(IObyIDisLoading);
|
||||||
setIODetails({
|
setIODetails({
|
||||||
...IObyID?.data,
|
...IObyID?.data,
|
||||||
});
|
});
|
||||||
@@ -277,10 +274,9 @@ const IODetails = ({ enableNextTab, index, data }) => {
|
|||||||
minInvestmentAmount: IObyID?.data?.minInvestmentAmount,
|
minInvestmentAmount: IObyID?.data?.minInvestmentAmount,
|
||||||
holdingPeriodArabic: IObyID?.data?.minInvestmentAmount,
|
holdingPeriodArabic: IObyID?.data?.minInvestmentAmount,
|
||||||
expectedReturnArabic: IObyID?.data?.minInvestmentAmount,
|
expectedReturnArabic: IObyID?.data?.minInvestmentAmount,
|
||||||
isShariah: IObyID?.data?.isShariah
|
isShariah: IObyID?.data?.isShariah,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
}, [id, IObyID]);
|
}, [id, IObyID]);
|
||||||
|
|
||||||
//=======================[ Creator ]
|
//=======================[ Creator ]
|
||||||
@@ -293,8 +289,10 @@ const IODetails = ({ enableNextTab, index, data }) => {
|
|||||||
isRequired: true,
|
isRequired: true,
|
||||||
section: " ",
|
section: " ",
|
||||||
width: "49%",
|
width: "49%",
|
||||||
maxLength:150,
|
maxLength: 150,
|
||||||
helperText:`Maximum length should be 150 characters. You have entered ${watch()?.investmentNameEnglish?.length || 0} characters.`
|
helperText: `Maximum length should be 150 characters. You have entered ${
|
||||||
|
watch()?.investmentNameEnglish?.length || 0
|
||||||
|
} characters.`,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: "IO Name (Arabic)",
|
label: "IO Name (Arabic)",
|
||||||
@@ -305,8 +303,10 @@ const IODetails = ({ enableNextTab, index, data }) => {
|
|||||||
arabic: true,
|
arabic: true,
|
||||||
section: " ",
|
section: " ",
|
||||||
width: "49%",
|
width: "49%",
|
||||||
maxLength:150,
|
maxLength: 150,
|
||||||
helperText:`Maximum length should be 150 characters. You have entered ${watch()?.investmentNameArabic?.length || 0} characters.`
|
helperText: `Maximum length should be 150 characters. You have entered ${
|
||||||
|
watch()?.investmentNameArabic?.length || 0
|
||||||
|
} characters.`,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: "Description",
|
label: "Description",
|
||||||
@@ -316,8 +316,10 @@ const IODetails = ({ enableNextTab, index, data }) => {
|
|||||||
isRequired: true,
|
isRequired: true,
|
||||||
section: " ",
|
section: " ",
|
||||||
width: "49%",
|
width: "49%",
|
||||||
maxLength:1000,
|
maxLength: 1000,
|
||||||
helperText:`Maximum length should be 1000 characters. You have entered ${watch()?.descriptionEnglish?.length || 0} characters.`
|
helperText: `Maximum length should be 1000 characters. You have entered ${
|
||||||
|
watch()?.descriptionEnglish?.length || 0
|
||||||
|
} characters.`,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: "Description (Arabic)",
|
label: "Description (Arabic)",
|
||||||
@@ -328,9 +330,10 @@ const IODetails = ({ enableNextTab, index, data }) => {
|
|||||||
arabic: true,
|
arabic: true,
|
||||||
section: " ",
|
section: " ",
|
||||||
width: "49%",
|
width: "49%",
|
||||||
maxLength:1000,
|
maxLength: 1000,
|
||||||
helperText:`Maximum length should be 1000 characters. You have entered ${watch()?.descriptionArabic?.length || 0} characters.`
|
helperText: `Maximum length should be 1000 characters. You have entered ${
|
||||||
|
watch()?.descriptionArabic?.length || 0
|
||||||
|
} characters.`,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: "Holding Period",
|
label: "Holding Period",
|
||||||
@@ -341,8 +344,10 @@ const IODetails = ({ enableNextTab, index, data }) => {
|
|||||||
section: " ",
|
section: " ",
|
||||||
width: "49%",
|
width: "49%",
|
||||||
value: IObyID?.data?.holdingPeriod,
|
value: IObyID?.data?.holdingPeriod,
|
||||||
maxLength:20,
|
maxLength: 20,
|
||||||
helperText:`Maximum length should be 20 characters. You have entered ${watch()?.holdingPeriod?.length || 0} characters.`
|
helperText: `Maximum length should be 20 characters. You have entered ${
|
||||||
|
watch()?.holdingPeriod?.length || 0
|
||||||
|
} characters.`,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: "Holding Period (Arabic)",
|
label: "Holding Period (Arabic)",
|
||||||
@@ -354,11 +359,12 @@ const IODetails = ({ enableNextTab, index, data }) => {
|
|||||||
section: " ",
|
section: " ",
|
||||||
width: "49%",
|
width: "49%",
|
||||||
value: IObyID?.data?.holdingPeriodArabic,
|
value: IObyID?.data?.holdingPeriodArabic,
|
||||||
maxLength:20,
|
maxLength: 20,
|
||||||
helperText:`Maximum length should be 20 characters. You have entered ${watch()?.holdingPeriodArabic?.length || 0} characters.`
|
helperText: `Maximum length should be 20 characters. You have entered ${
|
||||||
|
watch()?.holdingPeriodArabic?.length || 0
|
||||||
|
} characters.`,
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
||||||
{
|
{
|
||||||
label: "Expected Return",
|
label: "Expected Return",
|
||||||
name: "expectedReturn",
|
name: "expectedReturn",
|
||||||
@@ -371,7 +377,7 @@ const IODetails = ({ enableNextTab, index, data }) => {
|
|||||||
|
|
||||||
{
|
{
|
||||||
label: "Expected Return (Arabic)",
|
label: "Expected Return (Arabic)",
|
||||||
name: "expectedReturnArabic",
|
name: "expectedReturnArabic",
|
||||||
type: "text",
|
type: "text",
|
||||||
isRequired: true,
|
isRequired: true,
|
||||||
arabic: true,
|
arabic: true,
|
||||||
@@ -381,16 +387,15 @@ const IODetails = ({ enableNextTab, index, data }) => {
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: "Shariah",
|
label: "Shariah",
|
||||||
name: "isShariah",
|
name: "isShariah",
|
||||||
type: "checkBox",
|
type: "checkBox",
|
||||||
value:IObyID?.data?.isShariah,
|
value: IObyID?.data?.isShariah,
|
||||||
// isRequired: true,
|
// isRequired: true,
|
||||||
section: " ",
|
section: " ",
|
||||||
width: "32.3%",
|
width: "32.3%",
|
||||||
value: IObyID?.data?.isShariah,
|
value: IObyID?.data?.isShariah,
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
||||||
{
|
{
|
||||||
label: "Investment Type",
|
label: "Investment Type",
|
||||||
placeHolder: "Select option",
|
placeHolder: "Select option",
|
||||||
@@ -428,19 +433,19 @@ const IODetails = ({ enableNextTab, index, data }) => {
|
|||||||
name: "closingDate",
|
name: "closingDate",
|
||||||
// value: "IObyID?.data?.closingDate",
|
// value: "IObyID?.data?.closingDate",
|
||||||
type: "date",
|
type: "date",
|
||||||
isRequired: true,
|
// isRequired: true,
|
||||||
section: " ",
|
section: " ",
|
||||||
width: "32.3%",
|
width: "32.3%",
|
||||||
dateValue:formatDatee(IObyID?.data?.closingDate),
|
dateValue: formatDatee(IObyID?.data?.closingDate),
|
||||||
// helperText: IObyID && `Current closing date is : ${formatDate(IObyID?.data?.closingDate)}`
|
// helperText: IObyID && `Current closing date is : ${formatDate(IObyID?.data?.closingDate)}`
|
||||||
closingDate:true
|
closingDate:id ? null : true
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: "ISIN",
|
label: "ISIN",
|
||||||
placeHolder: "",
|
placeHolder: "",
|
||||||
name: "ISIN",
|
name: "ISIN",
|
||||||
type: "text",
|
type: "text",
|
||||||
align:"right",
|
align: "right",
|
||||||
section: " ",
|
section: " ",
|
||||||
width: "32.3%",
|
width: "32.3%",
|
||||||
},
|
},
|
||||||
@@ -452,8 +457,10 @@ const IODetails = ({ enableNextTab, index, data }) => {
|
|||||||
section: " ",
|
section: " ",
|
||||||
width: "32.3%",
|
width: "32.3%",
|
||||||
value: IObyID?.data?.InvestmentDetails,
|
value: IObyID?.data?.InvestmentDetails,
|
||||||
maxLength:20,
|
maxLength: 20,
|
||||||
helperText:`Maximum length should be 20 characters. You have entered ${watch()?.InvestmentDetails?.length || 0} characters.`
|
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",
|
name: "table",
|
||||||
type: "table",
|
type: "table",
|
||||||
section: " ",
|
section: " ",
|
||||||
width: "100%",
|
width: "100%",
|
||||||
isRequired: true,
|
isRequired: true,
|
||||||
options: investmentTypeOptions,
|
options: investmentTypeOptions,
|
||||||
handleInputChange:id ? handleInputChangeEdit : handleInputChangeCreate,
|
handleInputChange: id ? handleInputChangeEdit : handleInputChangeCreate,
|
||||||
value: values,
|
value: values,
|
||||||
},
|
},
|
||||||
|
|
||||||
@@ -478,8 +485,10 @@ const IODetails = ({ enableNextTab, index, data }) => {
|
|||||||
width: "100%",
|
width: "100%",
|
||||||
options: investmentTypeOptions,
|
options: investmentTypeOptions,
|
||||||
value: IObyID?.data?.comment,
|
value: IObyID?.data?.comment,
|
||||||
maxLength:100,
|
maxLength: 100,
|
||||||
helperText:`Maximum length should be 100 characters. You have entered ${watch()?.comment?.length || 0} characters.`
|
helperText: `Maximum length should be 100 characters. You have entered ${
|
||||||
|
watch()?.comment?.length || 0
|
||||||
|
} characters.`,
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
const groupedFields = formFields.reduce((groups, field) => {
|
const groupedFields = formFields.reduce((groups, field) => {
|
||||||
@@ -492,30 +501,29 @@ const IODetails = ({ enableNextTab, index, data }) => {
|
|||||||
}, {});
|
}, {});
|
||||||
|
|
||||||
const onSubmit = async (data) => {
|
const onSubmit = async (data) => {
|
||||||
|
|
||||||
delete data.table;
|
delete data.table;
|
||||||
|
|
||||||
setIsLoading(true);
|
setIsLoading(true);
|
||||||
const updatedMinAmount = values?.map(({id, value, _id})=>{
|
const updatedMinAmount = values?.map(({ id, value, _id }) => {
|
||||||
return {
|
return {
|
||||||
id:_id,
|
id: _id,
|
||||||
country_xid:id,
|
country_xid: id,
|
||||||
minInvestmentAmt: Number(value)
|
minInvestmentAmt: Number(value),
|
||||||
}
|
};
|
||||||
})
|
});
|
||||||
|
|
||||||
// console.log(formatDateToYYYYMMDD(data.closingDate));
|
// console.log(formatDateToYYYYMMDD(data.closingDate));
|
||||||
const formData = {
|
const formData = {
|
||||||
...data,
|
...data,
|
||||||
investmentType_xid: Number(data.investmentType),
|
investmentType_xid: Number(data.investmentType),
|
||||||
sponsor_xid: Number(data.sponserName),
|
sponsor_xid: Number(data.sponserName),
|
||||||
minInvestmentAmt:updatedMinAmount,
|
minInvestmentAmt: updatedMinAmount,
|
||||||
closingDate: formatDateToYYYYMMDD(data.closingDate)
|
closingDate: formatDateToYYYYMMDD(data.closingDate),
|
||||||
};
|
};
|
||||||
|
|
||||||
// console.log(formData);
|
// console.log(formData);
|
||||||
if (id) {
|
if (id) {
|
||||||
console.log("========================",formData);
|
console.log("========================", formData);
|
||||||
const res = await updateIO({ data: formData, id });
|
const res = await updateIO({ data: formData, id });
|
||||||
console.log(res);
|
console.log(res);
|
||||||
if (res?.data?.statusCode === 200) {
|
if (res?.data?.statusCode === 200) {
|
||||||
@@ -525,20 +533,24 @@ const IODetails = ({ enableNextTab, index, data }) => {
|
|||||||
});
|
});
|
||||||
navigate(`/view-io/${id}`);
|
navigate(`/view-io/${id}`);
|
||||||
enableNextTab(index);
|
enableNextTab(index);
|
||||||
} else if(res?.error?.status === 400){
|
} else if (res?.error?.status === 400) {
|
||||||
setIsLoading(false);
|
setIsLoading(false);
|
||||||
toast({
|
toast({
|
||||||
render: () => <ToastBox message={res?.error?.data?.message } status={"error"} />,
|
render: () => (
|
||||||
});
|
<ToastBox message={res?.error?.data?.message} status={"error"} />
|
||||||
} else if(res?.error?.status === 500){
|
),
|
||||||
|
});
|
||||||
|
} else if (res?.error?.status === 500) {
|
||||||
setIsLoading(false);
|
setIsLoading(false);
|
||||||
toast({
|
toast({
|
||||||
render: () => <ToastBox message={res?.error?.data?.message } status={"error"} />,
|
render: () => (
|
||||||
|
<ToastBox message={res?.error?.data?.message} status={"error"} />
|
||||||
|
),
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
try {
|
try {
|
||||||
console.log("========================",formData);
|
console.log("========================", formData);
|
||||||
const res = await creatIO(formData);
|
const res = await creatIO(formData);
|
||||||
console.log(res?.error?.status);
|
console.log(res?.error?.status);
|
||||||
if (res?.data?.statusCode === 200) {
|
if (res?.data?.statusCode === 200) {
|
||||||
@@ -548,15 +560,19 @@ const IODetails = ({ enableNextTab, index, data }) => {
|
|||||||
});
|
});
|
||||||
navigate(`/view-io/${res?.data?.data}`);
|
navigate(`/view-io/${res?.data?.data}`);
|
||||||
enableNextTab(index);
|
enableNextTab(index);
|
||||||
} else if(res?.error?.status === 400){
|
} else if (res?.error?.status === 400) {
|
||||||
setIsLoading(false);
|
setIsLoading(false);
|
||||||
toast({
|
toast({
|
||||||
render: () => <ToastBox message={res?.error?.data?.message } status={"error"} />,
|
render: () => (
|
||||||
|
<ToastBox message={res?.error?.data?.message} status={"error"} />
|
||||||
|
),
|
||||||
});
|
});
|
||||||
}else if(res?.error?.status === 500){
|
} else if (res?.error?.status === 500) {
|
||||||
setIsLoading(false);
|
setIsLoading(false);
|
||||||
toast({
|
toast({
|
||||||
render: () => <ToastBox message={res?.error?.data?.message } status={"error"} />,
|
render: () => (
|
||||||
|
<ToastBox message={res?.error?.data?.message} status={"error"} />
|
||||||
|
),
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
@@ -565,7 +581,6 @@ const IODetails = ({ enableNextTab, index, data }) => {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// ==========================
|
// ==========================
|
||||||
// if (params?.id) {
|
// if (params?.id) {
|
||||||
// return enableNextTab(index);
|
// return enableNextTab(index);
|
||||||
@@ -583,9 +598,8 @@ const IODetails = ({ enableNextTab, index, data }) => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
return IObyIDisLoading ? (
|
return IObyIDisLoading ? (
|
||||||
<FullscreenLoaders height={'70vh'} />
|
<FullscreenLoaders height={"70vh"} />
|
||||||
) : (
|
) : (
|
||||||
|
|
||||||
<FormInputMain
|
<FormInputMain
|
||||||
p={0.1}
|
p={0.1}
|
||||||
w={250}
|
w={250}
|
||||||
|
|||||||
@@ -153,7 +153,8 @@ const IONAVDetails = () => {
|
|||||||
</Tab>
|
</Tab>
|
||||||
</TabList>
|
</TabList>
|
||||||
{IODetails?.isInvestedAmount
|
{IODetails?.isInvestedAmount
|
||||||
? isMaker() && (
|
? isMaker() &&
|
||||||
|
IODetails?.ioSatatus !== "Exited" && (
|
||||||
<Button
|
<Button
|
||||||
onClick={handleAdd}
|
onClick={handleAdd}
|
||||||
leftIcon={<AddIcon />}
|
leftIcon={<AddIcon />}
|
||||||
|
|||||||
@@ -137,6 +137,11 @@ const Pending = () => {
|
|||||||
})}
|
})}
|
||||||
</Text>
|
</Text>
|
||||||
),
|
),
|
||||||
|
// Amount:(
|
||||||
|
// <div>
|
||||||
|
// <ViewDistributionInvestor amount={item?.transactionAmount} />
|
||||||
|
// </div>
|
||||||
|
// ),
|
||||||
"Created By": (
|
"Created By": (
|
||||||
<Text
|
<Text
|
||||||
textTransform={"capitalize"}
|
textTransform={"capitalize"}
|
||||||
@@ -200,6 +205,8 @@ const Pending = () => {
|
|||||||
})
|
})
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
const handleDelete = () => {
|
const handleDelete = () => {
|
||||||
const updatedSponsors = sponser.filter(
|
const updatedSponsors = sponser.filter(
|
||||||
(sponsor) => sponsor.id !== actionId
|
(sponsor) => sponsor.id !== actionId
|
||||||
|
|||||||
@@ -172,7 +172,7 @@ const ViewDistributionInvestor = ({ isOpen, onClose, id: exitId, amount }) => {
|
|||||||
"Distriution Amt($)": (
|
"Distriution Amt($)": (
|
||||||
<Box minW={24} isTruncated={true}>
|
<Box minW={24} isTruncated={true}>
|
||||||
<Text as={"span"} color={"teal.900"} fontWeight={"500"}>
|
<Text as={"span"} color={"teal.900"} fontWeight={"500"}>
|
||||||
{item?.distribution_amt?.toLocaleString(undefined, {
|
{IODetails?.ioTransactionRecords?.Pending[index]?.transactionAmount?.toLocaleString(undefined, {
|
||||||
minimumFractionDigits: 2,
|
minimumFractionDigits: 2,
|
||||||
maximumFractionDigits: 2,
|
maximumFractionDigits: 2,
|
||||||
})}
|
})}
|
||||||
|
|||||||
@@ -360,7 +360,7 @@ const IOArtifactsAdd = ({
|
|||||||
isOpen={alert}
|
isOpen={alert}
|
||||||
onClose={handleAlertClose}
|
onClose={handleAlertClose}
|
||||||
alertHandler={handleSave}
|
alertHandler={handleSave}
|
||||||
message={"Are you sure you want to update this artifact?"}
|
message={"Are you sure you want to add this artifact?"}
|
||||||
isLoading={loading}
|
isLoading={loading}
|
||||||
/>
|
/>
|
||||||
</>
|
</>
|
||||||
|
|||||||
@@ -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 (
|
return (
|
||||||
<Modal isOpen={isOpen} onClose={onClose}>
|
<Modal isOpen={isOpen} onClose={handleModalClose}>
|
||||||
<ModalOverlay />
|
<ModalOverlay />
|
||||||
<ModalContent>
|
<ModalContent>
|
||||||
<ModalHeader fontSize={"md"}>Amount Invested</ModalHeader>
|
<ModalHeader fontSize={"md"}>Amount Invested</ModalHeader>
|
||||||
@@ -246,7 +256,7 @@ const AmountInvested = ({ isOpen, onClose }) => {
|
|||||||
>
|
>
|
||||||
Save
|
Save
|
||||||
</Button>
|
</Button>
|
||||||
<Button size={"sm"} rounded={"sm"} mr={3} onClick={onClose}>
|
<Button size={"sm"} rounded={"sm"} mr={3} onClick={handleModalClose}>
|
||||||
Close
|
Close
|
||||||
</Button>
|
</Button>
|
||||||
</ModalFooter>
|
</ModalFooter>
|
||||||
|
|||||||
@@ -495,7 +495,7 @@ const DistributionInvestor = ({ isOpen, onClose }) => {
|
|||||||
>
|
>
|
||||||
Save
|
Save
|
||||||
</Button>
|
</Button>
|
||||||
<Button size={"sm"} rounded={"sm"} mr={3} onClick={onClose}>
|
<Button size={"sm"} rounded={"sm"} mr={3} onClick={handleClose}>
|
||||||
Close
|
Close
|
||||||
</Button>
|
</Button>
|
||||||
</>
|
</>
|
||||||
|
|||||||
Reference in New Issue
Block a user