From 129a79c66914d1db2d9765758ad393624d18b76f Mon Sep 17 00:00:00 2001 From: YasinShaikh123 <123150391+YasinShaikh123@users.noreply.github.com> Date: Fri, 23 Aug 2024 12:23:44 +0530 Subject: [PATCH] drawar history --- src/Contexts/GlobalStateProvider.jsx | 228 ++------------- src/Pages/AccountDeletion/DeletionHistory.jsx | 74 ++--- src/Pages/AccountDeletion/DeletionRequest.jsx | 68 +++-- src/Pages/AccountDeletion/InvestorComment.jsx | 85 ++++++ .../DepositRequest/DepositRequestApprove.jsx | 15 +- .../DepositRequest/DepositRequestReject.jsx | 4 +- .../InvestorDetails/InvestorDetails.jsx | 2 +- .../InvestorDetails/ProfileView.jsx | 8 + .../DrawalRequest/PendingRequest.jsx | 5 +- .../WithDrawal/DrawalView/ViewHistory.jsx | 268 ++++++++++-------- src/Routes/Routes.js | 4 +- src/Services/drawal.request.service.js | 9 +- 12 files changed, 354 insertions(+), 416 deletions(-) create mode 100644 src/Pages/AccountDeletion/InvestorComment.jsx diff --git a/src/Contexts/GlobalStateProvider.jsx b/src/Contexts/GlobalStateProvider.jsx index 11a7dfa..e15b34b 100644 --- a/src/Contexts/GlobalStateProvider.jsx +++ b/src/Contexts/GlobalStateProvider.jsx @@ -962,112 +962,14 @@ const GlobalStateProvider = ({ children }) => { ]); const [deleteHistory, setDeleteHistory] = useState([ { - id: uuidv4(), - date: "2024-01-15", - Distribution: "Office supplies", - charge: "200.50", - year: "2024", - quarter: "Q1", - amount: 1500, - }, - { - id: uuidv4(), - date: "2024-02-10", - Distribution: "Marketing expenses", - charge: "450.00", - year: "2024", - quarter: "Q1", - amount: 2000, - }, - { - id: uuidv4(), - date: "2024-03-05", - Distribution: "Software subscription", - charge: "300.75", - year: "2024", - quarter: "Q1", - amount: 1200, - }, - { - id: uuidv4(), - date: "2024-04-18", - Distribution: "Travel expenses", - charge: "600.30", - year: "2024", - quarter: "Q2", - amount: 2500, - }, - { - id: uuidv4(), - date: "2024-05-22", - Distribution: "Consulting fees", - charge: "800.00", - year: "2024", - quarter: "Q2", - amount: 3000, - }, - { - id: uuidv4(), - date: "2024-06-14", - Distribution: "Office rent", - charge: "1200.25", - year: "2024", - quarter: "Q2", - amount: 3500, - }, - { - id: uuidv4(), - date: "2024-07-09", - Distribution: "Utilities", - charge: "150.40", - year: "2024", - quarter: "Q3", - amount: 1000, - }, - { - id: uuidv4(), - date: "2024-08-29", - Distribution: "Employee training", - charge: "500.00", - year: "2024", - quarter: "Q3", - amount: 1800, - }, - { - id: uuidv4(), - date: "2024-09-13", - Distribution: "Website maintenance", - charge: "350.65", - year: "2024", - quarter: "Q3", - amount: 1400, - }, - { - id: uuidv4(), - date: "2024-10-23", - Distribution: "Advertising", - charge: "900.50", - year: "2024", - quarter: "Q4", - amount: 2200, - }, - { - id: uuidv4(), - date: "2024-10-23", - Distribution: "Advertising", - charge: "900.50", - year: "2024", - quarter: "Q4", - amount: 2200, - }, - { - id: uuidv4(), - date: "2024-10-23", - Distribution: "Advertising", - charge: "900.50", - year: "2024", - quarter: "Q4", - amount: 2200, + id: 1, + firstName: "satyam", + lastName: "Bendal", + clientId: "QA00000003", + RequestedOn: "2024-08-21T08:12:08.000Z", + phoneNumber: "6387524874", + country: "Qatar", + status: "Approved", }, ]); const [investorRequest, setInvestorRequest] = useState([ @@ -1182,112 +1084,14 @@ const GlobalStateProvider = ({ children }) => { ]); const [deleteRequest, setDeleteRequest] = useState([ { - id: uuidv4(), - date: getRandomDate(startDate, endDate), - Distribution: "lorem ipsum dummy text", - charge: "500", - year: "2024", - quater: "Q 1", - amount: 1000, - }, - { - id: uuidv4(), - date: getRandomDate(startDate, endDate), - Distribution: "lorem ipsum dummy text", - charge: "500", - year: "2024", - quater: "Q 1", - amount: 1000, - }, - { - id: uuidv4(), - date: getRandomDate(startDate, endDate), - Distribution: "lorem ipsum dummy text", - charge: "500", - year: "2024", - quater: "Q 1", - amount: 1000, - }, - { - id: uuidv4(), - date: getRandomDate(startDate, endDate), - Distribution: "lorem ipsum dummy text", - charge: "500", - year: "2024", - quater: "Q 1", - amount: 1000, - }, - { - id: uuidv4(), - date: getRandomDate(startDate, endDate), - Distribution: "lorem ipsum dummy text", - charge: "500", - year: "2024", - quater: "Q 1", - amount: 1000, - }, - { - id: uuidv4(), - date: getRandomDate(startDate, endDate), - Distribution: "lorem ipsum dummy text", - charge: "500", - year: "2024", - quater: "Q 1", - amount: 1000, - }, - { - id: uuidv4(), - date: getRandomDate(startDate, endDate), - Distribution: "lorem ipsum dummy text", - charge: "500", - year: "2024", - quater: "Q 1", - amount: 1000, - }, - { - id: uuidv4(), - date: getRandomDate(startDate, endDate), - Distribution: "lorem ipsum dummy text", - charge: "500", - year: "2024", - quater: "Q 1", - amount: 1000, - }, - { - id: uuidv4(), - date: getRandomDate(startDate, endDate), - Distribution: "lorem ipsum dummy text", - charge: "500", - year: "2024", - quater: "Q 1", - amount: 1000, - }, - { - id: uuidv4(), - date: getRandomDate(startDate, endDate), - Distribution: "lorem ipsum dummy text", - charge: "500", - year: "2024", - quater: "Q 1", - amount: 1000, - }, - { - id: uuidv4(), - date: getRandomDate(startDate, endDate), - Distribution: "lorem ipsum dummy text", - charge: "500", - year: "2024", - quater: "Q 1", - amount: 1000, - }, - { - id: uuidv4(), - date: getRandomDate(startDate, endDate), - Distribution: "lorem ipsum dummy text", - charge: "500", - year: "2024", - quater: "Q 1", - amount: 1000, + id: 1, + firstName: "satyam", + lastName: "Bendal", + clientId: "QA00000003", + RequestedOn: "2024-08-21T08:12:08.000Z", + phoneNumber: "6387524874", + country: "Qatar", + // status: "Approved", }, ]); const [viewIO, setViewIO] = useState([ diff --git a/src/Pages/AccountDeletion/DeletionHistory.jsx b/src/Pages/AccountDeletion/DeletionHistory.jsx index ba11bc2..2b4eebd 100644 --- a/src/Pages/AccountDeletion/DeletionHistory.jsx +++ b/src/Pages/AccountDeletion/DeletionHistory.jsx @@ -36,38 +36,30 @@ const DeletionHistory = () => { setIsLoading(false); }, 1500); - // Cleanup the timer on component unmount + // Cleanup the timer on component unmount return () => clearTimeout(timer); }, []); // ====================================================[Table Filter]================================================================ const filteredData = deleteHistory.filter((item) => { // Filter by name (case insensitive) - const name = item.Distribution; + const name = item.firstName; const searchLower = searchTerm.toLowerCase(); const nameMatches = name.toLowerCase().includes(searchLower); - // Filter by status - // const status = item.status; - // const statusLower = status ? "active" : "inactive"; - - // const statusMatches = - // statusFilter === "all" || - // (statusFilter === "active" && status === true) || - // (statusFilter === "inactive" && status === false); - return nameMatches; }); // ====================================================[Table Setup]================================================================ const tableHeadRow = [ "Sr No.", - "Date", - "Distribution Amount", - "Charges (USD)", - "Year", - "Quater", - "Action", + "Request On", + "Client ID", + "First Name", + "Last Name", + "Country", + "Phone Number", + "Status" ]; const extractedArray = filteredData?.map((item, index) => ({ @@ -83,7 +75,7 @@ const DeletionHistory = () => { {index + 1}. ), - "Date": ( + "Request On": ( { {formatDate(item.date)} ), - "Distribution Amount": ( + "Client ID": ( { className="d-flex align-items-center web-text-small" fontWeight={'500'} > - {item.Distribution} + {item.clientId} ), - "Charges (USD)": ( + "First Name": ( { className="d-flex align-items-center web-text-small" fontWeight={'500'} > - {item.charge} + {item.firstName} {/* {formatDate(item.charge)} */} ), - Year: ( + "Last Name": ( { className="d-flex align-items-center web-text-small" fontWeight={'500'} > - {item.year} + {item.lastName} ), - Quater: ( + "Country": ( { className="d-flex align-items-center web-text-small" fontWeight={'500'} > - {item.quarter} + {item.country} ), - Action: ( - - - - - - + "Phone Number": ( + + {item.phoneNumber} + + ), + "Status": ( + + {item.status} + ), })); diff --git a/src/Pages/AccountDeletion/DeletionRequest.jsx b/src/Pages/AccountDeletion/DeletionRequest.jsx index a094386..9e01424 100644 --- a/src/Pages/AccountDeletion/DeletionRequest.jsx +++ b/src/Pages/AccountDeletion/DeletionRequest.jsx @@ -6,6 +6,7 @@ import { HStack, Input, Text, + useDisclosure, useToast, } from "@chakra-ui/react"; import React, { useContext, useEffect, useState } from "react"; @@ -15,6 +16,7 @@ import Pagination from "../../Components/Pagination"; import GlobalStateContext from "../../Contexts/GlobalStateContext"; import CustomAlertDialog from "../../Components/CustomAlertDialog"; import { formatDate } from "../../Components/Functions/UTCConvertor"; +import InvestorComment from "./InvestorComment"; // import { formatDate } from "../../Components/Functions/UTCConvertor"; const DeletionRequest = () => { @@ -28,6 +30,12 @@ const DeletionRequest = () => { const [mouseEntered, setMouseEntered] = useState(false); const [mouseEnteredId, setMouseEnteredId] = useState(""); + const { + isOpen: isOpen, + onOpen: onOpen, + onClose: onClose, + } = useDisclosure(); + useEffect(() => { // Simulate loading const timer = setTimeout(() => { @@ -41,7 +49,7 @@ const DeletionRequest = () => { // ====================================================[Table Filter]================================================================ const filteredData = deleteRequest.filter((item) => { // Filter by name (case insensitive) - const name = item.Distribution; + const name = item.firstName; const searchLower = searchTerm.toLowerCase(); const nameMatches = name.toLowerCase().includes(searchLower); @@ -60,12 +68,13 @@ const DeletionRequest = () => { // ====================================================[Table Setup]================================================================ const tableHeadRow = [ "Sr No.", - "Date", - "Distribution Amount", - "Charges (USD)", - "Year", - "Quater", - "Amount", + "Request On", + "Client ID", + "First Name", + "Last Name", + "Country", + "Phone Number", + "Status" ]; const extractedArray = filteredData?.map((item, index) => ({ @@ -81,7 +90,7 @@ const DeletionRequest = () => { {index + 1}. ), - "Date": ( + "Request On": ( { {formatDate(item.date)} ), - "Distribution Amount": ( + "Client ID": ( - {item.Distribution} + {item.clientId} ), - "Charges (USD)": ( + "First Name": ( { className="d-flex align-items-center web-text-small" fontWeight={'500'} > - {item.charge} + {item.firstName} {/* {formatDate(item.charge)} */} ), - Year: ( + "Last Name": ( { className="d-flex align-items-center web-text-small" fontWeight={'500'} > - {item.year} + {item.lastName} ), - Quater: ( - - {item.quater} + {item.country} ), - - Amount: ( - - {item.amount} + {item.phoneNumber} + + ), + "Status": ( + + Review ), })); @@ -213,6 +233,10 @@ const DeletionRequest = () => { alertHandler={handleDelete} isLoading={isLoading} /> + ); }; diff --git a/src/Pages/AccountDeletion/InvestorComment.jsx b/src/Pages/AccountDeletion/InvestorComment.jsx new file mode 100644 index 0000000..35c33ea --- /dev/null +++ b/src/Pages/AccountDeletion/InvestorComment.jsx @@ -0,0 +1,85 @@ +import { + Box, + Button, + FormControl, + FormLabel, + Modal, + ModalBody, + ModalCloseButton, + ModalContent, + ModalFooter, + ModalHeader, + ModalOverlay, + Textarea, +} from "@chakra-ui/react"; +import React from "react"; + +const InvestorComment = ({ isOpen, onClose }) => { + return ( +
+ + + + + + + + + Investor Comment +