diff --git a/package.json b/package.json index 38b779f..1cf8051 100644 --- a/package.json +++ b/package.json @@ -21,6 +21,7 @@ "framer-motion": "^11.1.5", "js-cookie": "^3.0.5", "react": "^18.2.0", + "react-beautiful-dnd": "^13.1.1", "react-dom": "^18.2.0", "react-hook-form": "^7.51.3", "react-icons": "^5.1.0", diff --git a/src/App.css b/src/App.css index 55cd0c9..04d8fe6 100644 --- a/src/App.css +++ b/src/App.css @@ -158,6 +158,11 @@ animation-iteration-count: 1; } +.table-scroll::-webkit-scrollbar{ + width: 2px !important; + height: 10px !important; +} + /* Total scrollbar width */ ::-webkit-scrollbar { width: 2px; @@ -167,14 +172,13 @@ /* The track (background) of the scrollbar */ ::-webkit-scrollbar-track { background: transparent; - border-radius: 10px; - + border-radius: 0px; } /* The draggable scrollbar handle */ ::-webkit-scrollbar-thumb { background: #0041184f; - border-radius: 10px; + border-radius: 0px; cursor: grabbing; } diff --git a/src/Components/DataTable/DataTable.jsx b/src/Components/DataTable/DataTable.jsx index f8864ed..355c136 100644 --- a/src/Components/DataTable/DataTable.jsx +++ b/src/Components/DataTable/DataTable.jsx @@ -1,4 +1,4 @@ -import React, { useContext } from "react"; +import React, { useContext, useState } from "react"; import { Table, TableContainer, @@ -10,6 +10,7 @@ import { Skeleton, TableCaption, } from "@chakra-ui/react"; +import { DragDropContext, Droppable, Draggable } from "react-beautiful-dnd"; import EmptySearchList from "../EmptySearchList"; import { useNavigate } from "react-router-dom"; @@ -17,88 +18,120 @@ import GlobalStateContext from "../../Contexts/GlobalStateContext"; const DataTable = ({ data, + setData, isLoading, tableHeadRow, emptyMessage, + centered, setMouseEntered, setMouseEnteredId, + caption, }) => { const navigate = useNavigate(); const { slideFromRight } = useContext(GlobalStateContext); + const handleDragEnd = (result) => { + if (!result.destination) return; + + const reorderedItems = Array.from(data); + const [removed] = reorderedItems.splice(result.source.index, 1); + reorderedItems.splice(result.destination.index, 0, removed); + + setData(reorderedItems) + }; + return ( - + {data?.length === 0 ? ( ) : ( - - Tanami v1.0 - - - {tableHeadRow.map((heading, index) => ( - - ))} - - - - {data?.map((item, index) => ( - { - // e.currentTarget.style.backgroundColor = "transparent"; // Change the background color on hover - // e.currentTarget.style.transition = "0.1s"; - // e.currentTarget.style.boxShadow = - // "rgba(0, 0, 0, 0.24) 0px 1px 8px"; - // setMouseEntered(true); - // setMouseEnteredId(item.id); - // }} - // onMouseLeave={(e) => { - // e.currentTarget.style.backgroundColor = "transparent"; // Revert to default background color on hover out - // e.currentTarget.style.transition = "0.3s"; - // e.currentTarget.style.boxShadow = "none"; - // setMouseEntered(false); - // }} - transition={"0.5s all"} - _hover={{ - bg: "green.50", - cursor: "pointer", - }} - key={index} - > - {tableHeadRow.map((heading, i) => ( - - ))} - - ))} - -
- - {heading} - -
navigate(`edit-sponser/${item.id}`) // Define the onClick handler for other cells - // } - > - - {item[heading]} - -
+ + + {(provided) => ( + + {caption} + + + {tableHeadRow.map((heading, index) => ( + + ))} + + + + {data?.map((item, index) => ( + item.id ? ( + + {(provided, snapshot) => ( + + {tableHeadRow.map((heading, i) => ( + + ))} + + )} + + ) : ( + + {tableHeadRow.map((heading, i) => ( + + ))} + + ) + ))} + {provided.placeholder} + +
+ {heading} +
+ + {item[heading]} + +
+ + {item[heading]} + +
+ )} +
+
)}
); diff --git a/src/Components/FormInputMain.jsx b/src/Components/FormInputMain.jsx index 8041352..ee67c64 100644 --- a/src/Components/FormInputMain.jsx +++ b/src/Components/FormInputMain.jsx @@ -9,7 +9,9 @@ const FormInputMain = ({ control, errors, onSubmit, - children, + children, + onCancle, + submitTitle, p, w }) => { @@ -83,16 +85,17 @@ const FormInputMain = ({ {children} - - + } diff --git a/src/Components/FormInputView.jsx b/src/Components/FormInputView.jsx index d3c7394..8519064 100644 --- a/src/Components/FormInputView.jsx +++ b/src/Components/FormInputView.jsx @@ -33,7 +33,7 @@ const FormInputView = ({ {label} - {value} + {value} ))} diff --git a/src/Contexts/GlobalStateProvider.jsx b/src/Contexts/GlobalStateProvider.jsx index 26be72f..c260bf5 100644 --- a/src/Contexts/GlobalStateProvider.jsx +++ b/src/Contexts/GlobalStateProvider.jsx @@ -8,8 +8,6 @@ import { CiWallet } from "react-icons/ci"; import { HiOutlineReceiptPercent } from "react-icons/hi2"; import { IoMdQrScanner } from "react-icons/io"; - - const getRandomDate = (start, end) => { const date = new Date( start.getTime() + Math.random() * (end.getTime() - start.getTime()) @@ -25,9 +23,7 @@ const GlobalStateProvider = ({ children }) => { const [memberIfo, setMemberInfo] = useState(); const [communityMembers, setCommityMembers] = useState(); const [slideFromRight, setSlideFormRight] = useState(false); - const { colorMode, toggleColorMode } = useColorMode(); - const [sponser, setSponser] = useState([ { id: 1, @@ -282,121 +278,255 @@ const GlobalStateProvider = ({ children }) => { createdAt: "6", }, ]); - + + const [investors, setInvestors] = useState([ + { + id: 1, + clientId: "BH00000001", + firstName: "Faisal", + lastName: "Aljalahma", + investedAmount: 100000, + percentage: "10.0%", + marketValue: 114050, + returnOnInvestment: "14.1%", + distribution: 5000, + totalReturn: 62025, + totalReturnOnInvestment: "24.1%", + }, + { + id: 2, + clientId: "BH00000002", + firstName: "Sara", + lastName: "Ahmed", + investedAmount: 150000, + percentage: "15.0%", + marketValue: 171075, + returnOnInvestment: "14.05%", + distribution: 7500, + totalReturn: 93038, + totalReturnOnInvestment: "25.5%", + }, + { + id: 3, + clientId: "BH00000003", + firstName: "Ali", + lastName: "Khan", + investedAmount: 200000, + percentage: "20.0%", + marketValue: 228100, + returnOnInvestment: "14.05%", + distribution: 10000, + totalReturn: 124050, + totalReturnOnInvestment: "31.0%", + }, + { + id: 4, + clientId: "BH00000004", + firstName: "Laila", + lastName: "Hassan", + investedAmount: 250000, + percentage: "25.0%", + marketValue: 285125, + returnOnInvestment: "14.05%", + distribution: 12500, + totalReturn: 155063, + totalReturnOnInvestment: "37.0%", + }, + { + id: 5, + clientId: "BH00000005", + firstName: "Omar", + lastName: "Rahman", + investedAmount: 300000, + percentage: "30.0%", + marketValue: 342150, + returnOnInvestment: "14.05%", + distribution: 15000, + totalReturn: 186075, + totalReturnOnInvestment: "43.0%", + }, + { + id: 6, + clientId: "BH00000006", + firstName: "Aisha", + lastName: "Saeed", + investedAmount: 350000, + percentage: "35.0%", + marketValue: 399175, + returnOnInvestment: "14.05%", + distribution: 17500, + totalReturn: 217088, + totalReturnOnInvestment: "49.0%", + }, + { + id: 7, + clientId: "BH00000007", + firstName: "Mohammed", + lastName: "Yousef", + investedAmount: 400000, + percentage: "40.0%", + marketValue: 456200, + returnOnInvestment: "14.05%", + distribution: 20000, + totalReturn: 248100, + totalReturnOnInvestment: "55.0%", + }, + { + id: 8, + clientId: "BH00000008", + firstName: "Fatima", + lastName: "Jaber", + investedAmount: 450000, + percentage: "45.0%", + marketValue: 513225, + returnOnInvestment: "14.05%", + distribution: 22500, + totalReturn: 279113, + totalReturnOnInvestment: "61.0%", + }, + { + id: 9, + clientId: "BH00000009", + firstName: "Yasin", + lastName: "Abdullah", + investedAmount: 500000, + percentage: "50.0%", + marketValue: 570250, + returnOnInvestment: "14.05%", + distribution: 25000, + totalReturn: 310125, + totalReturnOnInvestment: "67.0%", + }, + { + id: 10, + clientId: "BH00000010", + firstName: "Zara", + lastName: "Mustafa", + investedAmount: 550000, + percentage: "55.0%", + marketValue: 627275, + returnOnInvestment: "14.05%", + distribution: 27500, + totalReturn: 341138, + totalReturnOnInvestment: "73.0%", + }, + ]); + const [create, setCreate] = useState([ { id: 1, Type: "PDF", fileName: "Investment Private Company", - document:"Investment.pdf", + document: "Investment.pdf", status: true, }, { id: 2, Type: "PDF", fileName: "Investment Private", - document:"Investment.pdf", + document: "Investment.pdf", status: true, }, { id: 3, Type: "PDF", fileName: "Investment Private", - document:"Investment.pdf", + document: "Investment.pdf", status: true, }, { id: 4, Type: "PDF", fileName: "Investment Private", - document:"Investment.pdf", + document: "Investment.pdf", status: true, }, { id: 5, Type: "PDF", fileName: "Investment Private", - document:"Investment.pdf", + document: "Investment.pdf", status: true, }, { id: 6, Type: "PDF", fileName: "Investment Private", - document:"Investment.pdf", + document: "Investment.pdf", status: true, }, { id: 7, Type: "PDF", fileName: "Investment Private", - document:"Investment.pdf", + document: "Investment.pdf", status: true, }, ]); - const [keyMerits, setKeyMerits] = useState([ { id: 1, title: "Diversified Holdings", - subTitle: "Private equity portfolio of over 60 companies in various sectors and different countries around the world", - icon:, + subTitle: + "Private equity portfolio of over 60 companies in various sectors and different countries around the world", + icon: , status: true, }, { id: 2, title: "Top-Tier Manager", - subTitle: "KKR is a world-class global PE manager with over $570bn in assets under management", - icon:, + subTitle: + "KKR is a world-class global PE manager with over $570bn in assets under management", + icon: , status: true, }, { id: 3, title: "Strong performance", - subTitle: "Direct exposure to the KKR’s best performing Buyout and Growth funds", - icon:, + subTitle: + "Direct exposure to the KKR’s best performing Buyout and Growth funds", + icon: , status: true, }, { id: 4, title: "Leading Track Record", - subTitle: "Almost 50 year track record since 1977 of consistent, double-digit annual returns", - icon:, + subTitle: + "Almost 50 year track record since 1977 of consistent, double-digit annual returns", + icon: , status: true, }, ]); - const [iOArtifacts, setIOArtifacts] = useState([ { id: 1, type: "JPG", fileName: "Banner image", - document:"Banner.jpg", + document: "Banner.jpg", status: true, }, { id: 2, type: "JPG", fileName: "Banner image", - document:"Banner.jpg", + document: "Banner.jpg", status: true, }, { id: 3, type: "JPG", fileName: "Banner image", - document:"Banner.jpg", + document: "Banner.jpg", status: true, }, { id: 4, type: "JPG", fileName: "Banner image", - document:"Banner.jpg", + document: "Banner.jpg", status: true, }, ]); - const [investmentType, setInvestmentType] = useState([ { id: 1, @@ -441,7 +571,6 @@ const GlobalStateProvider = ({ children }) => { status: true, }, ]); - const [investment, setInvestment] = useState([ // { // banner_image: @@ -495,7 +624,6 @@ const GlobalStateProvider = ({ children }) => { // status: "Available" // }, ]); - const [rateExchange, setRateExchange] = useState([ { id: uuidv4(), @@ -596,7 +724,6 @@ const GlobalStateProvider = ({ children }) => { rate: 2.66, }, ]); - const [InvestorDetails, setInvestorDetails] = useState([ { id: 1, @@ -613,7 +740,6 @@ const GlobalStateProvider = ({ children }) => { Action: "Distribute", }, ]); - const [investorTransaction, setInvestorTransaction] = useState([ { id: 1, @@ -644,7 +770,6 @@ const GlobalStateProvider = ({ children }) => { Action: "Distribute", }, ]); - const [pendingRequest, setPendingRequest] = useState([ { id: uuidv4(), @@ -755,7 +880,6 @@ const GlobalStateProvider = ({ children }) => { amount: 1000, }, ]); - const [viewHistory, setViewHistory] = useState([ { id: uuidv4(), @@ -866,7 +990,6 @@ const GlobalStateProvider = ({ children }) => { amount: 2200, }, ]); - const [upgradeHistory, setUpgradeHistory] = useState([ { id: uuidv4(), @@ -977,7 +1100,6 @@ const GlobalStateProvider = ({ children }) => { amount: 2200, }, ]); - const [deleteHistory, setDeleteHistory] = useState([ { id: uuidv4(), @@ -1088,7 +1210,6 @@ const GlobalStateProvider = ({ children }) => { amount: 2200, }, ]); - const [investorRequest, setInvestorRequest] = useState([ { id: uuidv4(), @@ -1199,7 +1320,6 @@ const GlobalStateProvider = ({ children }) => { amount: 1000, }, ]); - const [deleteRequest, setDeleteRequest] = useState([ { id: uuidv4(), @@ -1310,7 +1430,6 @@ const GlobalStateProvider = ({ children }) => { amount: 1000, }, ]); - const [viewIO, setViewIO] = useState([ { id: 1, @@ -1357,7 +1476,6 @@ const GlobalStateProvider = ({ children }) => { toggleColorMode, slideFromRight, setSlideFormRight, - InvestorDetails, setInvestorDetails, investment, @@ -1387,7 +1505,9 @@ const GlobalStateProvider = ({ children }) => { keyMerits, setKeyMerits, iOArtifacts, - setIOArtifacts + setIOArtifacts, + investors, + setInvestors }} > {children} diff --git a/src/Layout/DefaultLayout.jsx b/src/Layout/DefaultLayout.jsx index b06f923..40df7f0 100644 --- a/src/Layout/DefaultLayout.jsx +++ b/src/Layout/DefaultLayout.jsx @@ -324,7 +324,7 @@ const DashboardLayout = () => { className="d-flex" pe={0.5} > - { zIndex={999} > - + */} {slideFromRight ? null : (