upddateed

This commit is contained in:
2024-10-17 15:58:21 +05:30
parent 94b8be1130
commit 0b080733fb
5 changed files with 29 additions and 34 deletions

View File

@@ -511,9 +511,10 @@ const FormField = ({
);}
else if(type === 'checkBox'){
return (
<HStack justifyContent={"space-between"} mt={3}>
<HStack bg={"#F5F8F6"} p={"3px"} rounded={"2px"} border={'1px solid #E1E7EF'} justifyContent={"space-between"} mt={3}>
{/* <Image w={"38px"} aspectRatio={"1/1"} src={ShariahLogo} /> */}
<Checkbox
ps={1}
{...field}
{...props} size='md' colorScheme='forestGreen'>
<Text as={"span"} fontSize={"sm"}>Is This Sharia Compliant</Text>

View File

@@ -74,6 +74,11 @@ const Notification = () => {
formState: { errors },
} = useForm({
resolver: yupResolver(notificationNew),
defaultValues: {
title: '',
message: '',
},
});
console.log(errors);
@@ -150,18 +155,11 @@ const Notification = () => {
}, {});
const onSubmit = async (data) => {
console.log(data);
const dataToPass = {
...data,
principal_xid:selectedRadio
}
console.log(dataToPass);
setIsLoading(true);
try {
const res = await sendNotification(dataToPass);
@@ -181,7 +179,11 @@ const Notification = () => {
),
});
setIsLoading(false)
// reset()
setSelectedRadio([])
reset({
title: '', // Resetting specific fields
message: '',
}); // Clears the form fields
}else{
toast({
render: () => (

View File

@@ -57,6 +57,7 @@ const CreateRequest = () => {
const onSubmit = async (data) => {
console.log(data);
setIsLoading(true)
// Convert data to FormData
@@ -66,7 +67,7 @@ const CreateRequest = () => {
Object.keys(data).forEach((key) => {
if (key === "spportFile_path" && data[key] instanceof FileList) {
// Append the first file from FileList (assuming single file input)
formData.append(key, fileType); // This extracts the first file
formData.append(key, data[key][0]); // Append the file
} else {
formData.append(key, data[key]); // Append other fields
}

View File

@@ -6,9 +6,6 @@ import { useForm } from "react-hook-form";
import * as yup from "yup";
import GlobalStateContext from "../../../Contexts/GlobalStateContext";
import FullscreenLoaders from "../../../Components/Loaders/FullscreenLoaders";
import { generateUniqueId } from "../../../Contexts/GlobalStateProvider";
import { useGetInvestmentTypesQuery } from "../../../Services/io.service";
import { useGetActiveSponserMasterQuery } from "../../../Services/io.service";
import {
useCreateIOMutation,
useGetIOByIdQuery,
@@ -16,26 +13,8 @@ import {
} from "../../../Services/io.service";
import ToastBox from "../../../Components/ToastBox";
import {
Box,
Checkbox,
Input,
Table,
Tbody,
Td,
Text,
Th,
Thead,
Tr,
useToast,
} from "@chakra-ui/react";
import { formatDate } from "../../Master/Sponser/Sponsers";
import behrain from "../../../assets/bahrain_flag.png";
import kuwait from "../../../assets/kuwait_flag.png";
import oman from "../../../assets/oman_flag.png";
import qatar from "../../../assets/qatar_flag.png";
import uae from "../../../assets/uae_flag.png";
import saudi from "../../../assets/saudi_arabia_flag.png";
import { formatDatee } from "../../../Components/FormField";
import { removeTrailingZeros } from "../../../Constants/Constants";
@@ -141,6 +120,7 @@ const IODetails = ({ enableNextTab, index, data }) => {
isLoading: IObyIDisLoading,
error: IObyIDerror,
} = useGetIOByIdQuery(id, { skip: !id });
console.log(IObyID);
const [creatIO] = useCreateIOMutation();
const [updateIO] = useUpdateIOMutation();
@@ -302,6 +282,7 @@ const IODetails = ({ enableNextTab, index, data }) => {
minInvestmentAmount: IObyID?.data?.minInvestmentAmount,
holdingPeriodArabic: IObyID?.data?.minInvestmentAmount,
expectedReturnArabic: IObyID?.data?.minInvestmentAmount,
isShariah: IObyID?.data?.isShariah
});
}
@@ -410,7 +391,7 @@ const IODetails = ({ enableNextTab, index, data }) => {
label: "Shariah",
name: "isShariah",
type: "checkBox",
isRequired: true,
// isRequired: true,
section: " ",
width: "32.3%",
value: IObyID?.data?.isShariah,
@@ -663,6 +644,7 @@ const IODetails = ({ enableNextTab, index, data }) => {
}, {});
const onSubmit = async (data) => {
console.log(data);
delete data.table;
setIsLoading(true);
// console.log(data);

View File

@@ -190,7 +190,7 @@ const ViewIOdetails = () => {
isRequired: true,
placeHolder: "1Y",
section: " ",
width: "49%",
width: "32.3%",
},
{
label: "Holding Period (Arabic)",
@@ -201,9 +201,18 @@ const ViewIOdetails = () => {
arabic: true,
placeHolder: "1Y",
section: " ",
width: "49%",
width: "32.3%",
},
{
label: "Shariah",
name: "isShariah",
type: "checkBox",
// isRequired: true,
section: " ",
width: "32.3%",
value: IObyID?.data?.isShariah ? "✅ Is This Sharia Compliant" : "❎ Is This Sharia Compliant",
},
{