From 3d456c3c48070acfa9ceb59d02c46578eba320b2 Mon Sep 17 00:00:00 2001 From: Swapnil Bendal <84583651+Swapnil155@users.noreply.github.com> Date: Wed, 15 Jan 2025 17:55:59 +0530 Subject: [PATCH 1/3] [update] - refactor Notification component for improved readability and adjust message validation --- src/Pages/Admin/Notification.jsx | 27 ++++++++++++++------------- 1 file changed, 14 insertions(+), 13 deletions(-) diff --git a/src/Pages/Admin/Notification.jsx b/src/Pages/Admin/Notification.jsx index 874a28a..1579aa1 100644 --- a/src/Pages/Admin/Notification.jsx +++ b/src/Pages/Admin/Notification.jsx @@ -26,7 +26,10 @@ import ToastBox from "../../Components/ToastBox"; import NormalTable from "../../Components/DataTable/NormalTable"; import GlobalStateContext from "../../Contexts/GlobalStateContext"; import { useGetInvestorsQuery } from "../../Services/investor.details.service"; -import { INVESTOR_TABLE_PAGINATION, 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"; @@ -49,7 +52,7 @@ export const notification = yup.object().shape({ export const notificationNew = yup.object().shape({ title: yup.string().required("Notification Header is required"), - message: yup.string().required("Message is required"), + message: yup.string().notRequired(), }); const Notification = () => { @@ -59,7 +62,9 @@ const Notification = () => { const [isLoading, setIsLoading] = useState(false); const [selectedRadio, setSelectedRadio] = useState([]); const [pageSize, setPageSize] = useState(INVESTOR_TABLE_PAGINATION?.size); - const [currentPage, setCurrentPage] = useState(INVESTOR_TABLE_PAGINATION?.page); + const [currentPage, setCurrentPage] = useState( + INVESTOR_TABLE_PAGINATION?.page + ); const [searchTerm, setSearchTerm] = useState(""); const [debouncedSearchTerm, setDebouncedSearchTerm] = useState(""); const [country, setCountry] = useState(""); @@ -108,16 +113,18 @@ const Notification = () => { }, 300); return () => clearTimeout(handler); }, [searchTerm]); - - const { data: investorDetails, isLoading: investorDetailsLoading, refetch } = - useGetUnbanInvestorQuery( + const { + data: investorDetails, + isLoading: investorDetailsLoading, + refetch, + } = useGetUnbanInvestorQuery( { page: 1, // Omit pagination for search size: 10000, // Omit pagination for search // page: debouncedSearchTerm ? undefined : currentPage, // Disable pagination for search // size: debouncedSearchTerm ? undefined : 10000 || pageSize || 500, // Disable pagination for search - search: debouncedSearchTerm, // Pass search term + search: debouncedSearchTerm, // Pass search term country_xid: country, KYCStatus: kyc, }, @@ -131,10 +138,6 @@ const Notification = () => { // console.log("Debounced Search Term:", debouncedSearchTerm); // console.log("Investor Details:", investorDetails); // }, [searchTerm, debouncedSearchTerm, investorDetails]); - - - - console.log(investorDetails); const [sendNotification] = useSendNotificationMutation(); @@ -190,7 +193,6 @@ const Notification = () => { setIsLoading(true); try { const res = await sendNotification(dataToPass); - console.log(res); if (res?.error) { toast({ @@ -313,7 +315,6 @@ const Notification = () => { ), })); - return ( From 20213408c47cf8d91b12c21636e1a72585fc50ce Mon Sep 17 00:00:00 2001 From: Swapnil Bendal <84583651+Swapnil155@users.noreply.github.com> Date: Wed, 15 Jan 2025 18:00:54 +0530 Subject: [PATCH 2/3] [update] - enforce message requirement for specific status in UpdateIOStatus component --- 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 1db3014..8b36298 100644 --- a/src/Pages/IO_Management/ViewIO/HeaderModal/UpdateIOStatus.jsx +++ b/src/Pages/IO_Management/ViewIO/HeaderModal/UpdateIOStatus.jsx @@ -57,7 +57,7 @@ const UpdateIOStatus = ({ isOpen, onClose, status }) => { setError("Please select status"); return; } - if (!message) { + if (selectedStatusId == 6 && !message) { return setMessageError("message is required"); } setError(""); From d196dffd1264c7de8df3ef16b17e8b4e1d8de085 Mon Sep 17 00:00:00 2001 From: YasinShaikh123 <123150391+YasinShaikh123@users.noreply.github.com> Date: Thu, 16 Jan 2025 15:57:18 +0530 Subject: [PATCH 3/3] change bugs --- src/Pages/Dashboard/Dashbaord.jsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Pages/Dashboard/Dashbaord.jsx b/src/Pages/Dashboard/Dashbaord.jsx index 181dedb..d0e6d63 100644 --- a/src/Pages/Dashboard/Dashbaord.jsx +++ b/src/Pages/Dashboard/Dashbaord.jsx @@ -335,7 +335,7 @@ const Dashbaord = ({ showSearch = false }) => {