diff --git a/src/Components/FormField.jsx b/src/Components/FormField.jsx index f417351..b7219a8 100644 --- a/src/Components/FormField.jsx +++ b/src/Components/FormField.jsx @@ -511,9 +511,10 @@ const FormField = ({ );} else if(type === 'checkBox'){ return ( - + {/* */} Is This Sharia Compliant diff --git a/src/Pages/Admin/Notification.jsx b/src/Pages/Admin/Notification.jsx index 88f571b..30e60ad 100644 --- a/src/Pages/Admin/Notification.jsx +++ b/src/Pages/Admin/Notification.jsx @@ -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: () => ( diff --git a/src/Pages/Fawateer/CreateRequest.jsx b/src/Pages/Fawateer/CreateRequest.jsx index 01dc1fc..375b9ae 100644 --- a/src/Pages/Fawateer/CreateRequest.jsx +++ b/src/Pages/Fawateer/CreateRequest.jsx @@ -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 } diff --git a/src/Pages/IO_Management/CreateIO/IODetails.jsx b/src/Pages/IO_Management/CreateIO/IODetails.jsx index e53a227..829d895 100644 --- a/src/Pages/IO_Management/CreateIO/IODetails.jsx +++ b/src/Pages/IO_Management/CreateIO/IODetails.jsx @@ -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); diff --git a/src/Pages/IO_Management/ViewIO/ViewIOdetails.jsx b/src/Pages/IO_Management/ViewIO/ViewIOdetails.jsx index 467275e..b291a3b 100644 --- a/src/Pages/IO_Management/ViewIO/ViewIOdetails.jsx +++ b/src/Pages/IO_Management/ViewIO/ViewIOdetails.jsx @@ -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", + }, {