done changes and bug

This commit is contained in:
YasinShaikh123
2025-01-10 17:28:26 +05:30
parent a07d011c85
commit 84dc47b447
6 changed files with 48 additions and 14 deletions

View File

@@ -520,7 +520,7 @@ const FormField = ({
ps={1}
{...field}
{...props} size='md' colorScheme='forestGreen'>
<Text as={"span"} fontSize={"sm"}>Is This Sharia Compliant</Text>
<Text as={"span"} fontSize={"sm"}>Is This Shariah Compliant</Text>
</Checkbox>
</HStack>
);} else{

View File

@@ -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 = ({

View File

@@ -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 }) => {
<Badge
rounded={"full"}
pt={1.5}
pb={1.5}
pb={1.5}
ps={4}
pe={4}
mt={1.5}
@@ -163,7 +175,8 @@ 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}
</FormErrorMessage>
</FormControl>
{selectedItem === import.meta.env.VITE_STATUS_CANCELLED && (
<FormControl mt={5} isRequired>
<FormLabel fontSize={"sm"} fontWeight={400}>
Message
</FormLabel>
<Textarea
resize={"none"}
rounded={5}
size="sm"
onChange={(e) => setMessage(e.target.value)}
/>
</FormControl>
)}
{messageError && (
<Text fontSize={"sm"} color={"red"}>
{messageError}
</Text>
)}
</ModalBody>
<ModalFooter>
<Button

View File

@@ -203,7 +203,7 @@ const BankDetails = () => {
return (
<Box {...OPACITY_ON_LOAD} overflowY={"scroll"} height={"100vh"} pb={38}>
<HStack>
<Text as={'span'} fontSize={'sm'} fontWeight={700}>Bank Deatils</Text>
<Text as={'span'} fontSize={'sm'} fontWeight={700}>Bank Details</Text>
</HStack>
<HStack
display={"flex"}

View File

@@ -248,7 +248,8 @@ const InvestorDetails = () => {
minimumFractionDigits: 2,
maximumFractionDigits: 2,
})
: parseFloat(item?.Portfolio_InInvCur || 0).toLocaleString(
:
parseFloat(item?.Portfolio_InInvCur || 0).toLocaleString(
undefined,
{
minimumFractionDigits: 2,

View File

@@ -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"],
}),