This commit is contained in:
2024-06-24 20:26:33 +05:30
24 changed files with 564 additions and 73 deletions

View File

@@ -1,5 +1,16 @@
import React from "react";
import { Table, TableContainer, Tbody, Td, Th, Thead, Tr, Skeleton, TableCaption, Tfoot } from "@chakra-ui/react";
import {
Table,
TableContainer,
Tbody,
Td,
Th,
Thead,
Tr,
Skeleton,
TableCaption,
Tfoot,
} from "@chakra-ui/react";
import EmptySearchList from "../EmptySearchList";
import Pagination from "../Pagination";
@@ -16,7 +27,7 @@ const DataTable = ({ data, isLoading, tableHeadRow, emptyMessage, totalPages })
<Thead backgroundColor="gray.50">
<Tr>
{tableHeadRow.map((heading, index) => (
<Th key={index} p={3} w={columnWidth}>
<Th key={index} p={3} w={"auto"} color={"#004118"}>
{isLoading ? <Skeleton height="20px" /> : heading}
{/* {heading} */}
</Th>
@@ -28,7 +39,15 @@ const DataTable = ({ data, isLoading, tableHeadRow, emptyMessage, totalPages })
? Array?.from({ length: 10 }).map((_, index) => (
<Tr key={index}>
{tableHeadRow.map((_, i) => (
<Td key={i} style={{ whiteSpace: "nowrap", textOverflow: "ellipsis" }} className="web-text-small" w={columnWidth}>
<Td
key={i}
style={{
whiteSpace: "nowrap",
textOverflow: "ellipsis",
}}
className="web-text-small"
w={columnWidth}
>
<Skeleton height="20px" mb={1} mt={1} />
</Td>
))}
@@ -37,7 +56,15 @@ const DataTable = ({ data, isLoading, tableHeadRow, emptyMessage, totalPages })
: data?.map((item, index) => (
<Tr key={index}>
{tableHeadRow.map((heading, i) => (
<Td color={"gray.600"} key={i} style={{ whiteSpace: "nowrap", textOverflow: "ellipsis" }} className="web-text-small" >
<Td
color={"gray.600"}
key={i}
style={{
whiteSpace: "nowrap",
textOverflow: "ellipsis",
}}
className="web-text-small"
>
{item[heading]}
</Td>
))}

View File

@@ -229,6 +229,7 @@ const DashboardLayout = () => {
}
alignItems="center"
overflow="hidden"
textAlign={"left"}
>
{title}
</Text>

View File

@@ -0,0 +1,12 @@
import { Box, Text } from "@chakra-ui/react";
import { OPACITY_ON_LOAD } from "../../Layout/animations";
const DeletionHistory = () => {
return (
<Box {...OPACITY_ON_LOAD} overflowY={"scroll"} height={"100vh"}>
<Text as={"h1"}>Account deletion request</Text>
</Box>
);
};
export default DeletionHistory;

View File

@@ -0,0 +1,12 @@
import { Box, Text } from "@chakra-ui/react";
import { OPACITY_ON_LOAD } from "../../Layout/animations";
const DeletionRequest = () => {
return (
<Box {...OPACITY_ON_LOAD} overflowY={"scroll"} height={"100vh"}>
<Text as={"h1"}>Pending deletion request</Text>
</Box>
);
};
export default DeletionRequest;

View File

@@ -0,0 +1,12 @@
import { Box, Text } from "@chakra-ui/react";
import { OPACITY_ON_LOAD } from "../../Layout/animations";
const Academy = () => {
return (
<Box {...OPACITY_ON_LOAD} overflowY={"scroll"} height={"100vh"}>
<Text as={"h1"}>Academy Page</Text>
</Box>
);
};
export default Academy;

View File

@@ -0,0 +1,12 @@
import { Box, Text } from "@chakra-ui/react";
import { OPACITY_ON_LOAD } from "../../Layout/animations";
const BankDetails = () => {
return (
<Box {...OPACITY_ON_LOAD} overflowY={"scroll"} height={"100vh"}>
<Text as={"h1"}>Bank Details</Text>
</Box>
);
};
export default BankDetails;

View File

@@ -0,0 +1,12 @@
import { Box, Text } from "@chakra-ui/react";
import { OPACITY_ON_LOAD } from "../../Layout/animations";
const BankInvestor = () => {
return (
<Box {...OPACITY_ON_LOAD} overflowY={"scroll"} height={"100vh"}>
<Text as={"h1"}>Admin Bank Investor Page</Text>
</Box>
);
};
export default BankInvestor;

View File

@@ -0,0 +1,12 @@
import { Box, Text } from "@chakra-ui/react";
import { OPACITY_ON_LOAD } from "../../Layout/animations";
const Contact = () => {
return (
<Box {...OPACITY_ON_LOAD} overflowY={"scroll"} height={"100vh"}>
<Text as={"h1"}>Contact Us Page</Text>
</Box>
);
};
export default Contact;

View File

@@ -0,0 +1,12 @@
import { Box, Text } from "@chakra-ui/react";
import { OPACITY_ON_LOAD } from "../../Layout/animations";
const Notification = () => {
return (
<Box {...OPACITY_ON_LOAD} overflowY={"scroll"} height={"100vh"}>
<Text as={"h1"}>Notification</Text>
</Box>
);
};
export default Notification;

12
src/Pages/Admin/Users.jsx Normal file
View File

@@ -0,0 +1,12 @@
import { Box, Text } from "@chakra-ui/react";
import { OPACITY_ON_LOAD } from "../../Layout/animations";
const Users = () => {
return (
<Box {...OPACITY_ON_LOAD} overflowY={"scroll"} height={"100vh"}>
<Text as={"h1"}>Users Page</Text>
</Box>
);
};
export default Users;

View File

@@ -0,0 +1,13 @@
import { Box, Text } from "@chakra-ui/react";
import { OPACITY_ON_LOAD } from "../../Layout/animations";
const Create = () => {
return (
<Box {...OPACITY_ON_LOAD} overflowY={"scroll"} height={"100vh"}>
<Text as={"h1"}> IO management Create</Text>
</Box>
);
};
export default Create;

View File

@@ -0,0 +1,13 @@
import { Box, Text } from "@chakra-ui/react";
import { OPACITY_ON_LOAD } from "../../Layout/animations";
const View = () => {
return (
<Box {...OPACITY_ON_LOAD} overflowY={"scroll"} height={"100vh"}>
<Text as={"h1"}> IO management View</Text>
</Box>
);
};
export default View;

View File

@@ -1,11 +0,0 @@
import { Box } from '@chakra-ui/react'
import React from 'react'
import { OPACITY_ON_LOAD } from '../../Layout/animations'
const Investment = () => {
return (
<Box {...OPACITY_ON_LOAD} bg={"green.100"} overflowY={"scroll"} height={"100vh"}></Box>
)
}
export default Investment

View File

@@ -0,0 +1,12 @@
import { Box, Text } from "@chakra-ui/react";
import { OPACITY_ON_LOAD } from "../../Layout/animations";
const InvestorPendingRequest = () => {
return (
<Box {...OPACITY_ON_LOAD} overflowY={"scroll"} height={"100vh"}>
<Text as={"h1"}>Investor pending request</Text>
</Box>
);
};
export default InvestorPendingRequest;

View File

@@ -0,0 +1,12 @@
import { Box, Text } from "@chakra-ui/react";
import { OPACITY_ON_LOAD } from "../../Layout/animations";
const upgradeHistory = () => {
return (
<Box {...OPACITY_ON_LOAD} overflowY={"scroll"} height={"100vh"}>
<Text as={"h1"}>Investor upgradation History</Text>
</Box>
);
};
export default upgradeHistory;

View File

@@ -0,0 +1,12 @@
import { Box, Text } from "@chakra-ui/react";
import { OPACITY_ON_LOAD } from "../../Layout/animations";
const InvestorDetails = () => {
return (
<Box {...OPACITY_ON_LOAD} overflowY={"scroll"} height={"100vh"}>
<Text as={"h1"}> Investor Details Page</Text>
</Box>
);
};
export default InvestorDetails;

View File

@@ -0,0 +1,12 @@
import { Box, Text } from "@chakra-ui/react";
import { OPACITY_ON_LOAD } from "../../Layout/animations";
const InvestorTransactions = () => {
return (
<Box {...OPACITY_ON_LOAD} overflowY={"scroll"} height={"100vh"}>
<Text as={"h1"}> Investor Transactions Page</Text>
</Box>
);
};
export default InvestorTransactions;

View File

@@ -1,11 +1,225 @@
import { Box } from '@chakra-ui/react'
import React from 'react'
import { OPACITY_ON_LOAD } from '../../../Layout/animations'
import {
Avatar,
Badge,
Box,
Button,
HStack,
Input,
Menu,
MenuButton,
MenuItem,
MenuList,
Portal,
Select,
Switch,
Tag,
Text,
} from "@chakra-ui/react";
import React, { useContext, useEffect, useState } from "react";
import { OPACITY_ON_LOAD } from "../../../Layout/animations";
import DataTable from "../../../Components/DataTable/DataTable";
import { HiDotsVertical } from "react-icons/hi";
import { Link, Link as RouterLink } from "react-router-dom";
import { AddIcon, EmailIcon } from "@chakra-ui/icons";
import Pagination from "../../../Components/Pagination";
import GlobalStateContext from "../../../Contexts/GlobalStateContext";
import CustomAlertDialog from "../../../Components/CustomAlertDialog";
const formatDate = (date) => new Date(date).toLocaleDateString(); // Simple date formatter
const ExchangeRate = () => {
return (
<Box {...OPACITY_ON_LOAD} bg={"green.200"} overflowY={"scroll"} height={"100vh"}></Box>
)
}
const { sponser, setSponser } = useContext(GlobalStateContext);
const [searchTerm, setSearchTerm] = useState("");
const [isLoading, setIsLoading] = useState(true);
const [deleteAlert, setDeleteAlert] = useState(false);
const [actionId, setActionId] = useState(false);
export default ExchangeRate
useEffect(() => {
// Simulate loading
const timer = setTimeout(() => {
setIsLoading(false);
}, 1500);
// Cleanup the timer on component unmount
return () => clearTimeout(timer);
}, []);
// ====================================================[Table Setup]================================================================
const tableHeadRow = [
"Sponser name",
"Address",
"Mobile no",
"Status",
"Created At",
];
const handleUpdateStatus = (id) => {
console.log(`Status updated for id: ${id}`);
// Add your status update logic here
};
// ====================================================[Table Filter]================================================================
const filteredData = sponser.filter((item) => {
// Filter by name (case insensitive)
const name = item.sponserName;
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;
});
const extractedArray = filteredData?.map((item) => ({
"Sponser name": (
<Text
as={"span"}
color={"gray.600"}
className="d-flex align-items-center fw-bold web-text-small"
>
{item.sponserName}
</Text>
),
Address: (
<Box w={350} isTruncated={true}>
<Text as={"span"} color={"teal.900"}>
{item.sponserAddress}
</Text>
</Box>
),
"Mobile no": (
<Box w={"auto"} isTruncated={true}>
<Text as={"span"} color={"teal.900"}>
{item.mobileNo}
</Text>
</Box>
),
Status:
// <Switch
// size={"sm"}
// colorScheme="teal"
// onChange={() => handleUpdateStatus(item.id)}
// isChecked={item.status}
// />
item?.status ? (
<Badge variant={"outline"} colorScheme="green">
Passed
</Badge>
) : (
<Badge variant={"outline"} colorScheme="red">
Not passes
</Badge>
),
"Created At": (
<span className="d-flex justify-content-between align-items-center">
<Text as={"span"} color={"gray.600"} className=" fw-bold">
{formatDate(item.createdAt)}
</Text>
<Menu>
<MenuButton className="link p-1 rounded-1">
<HiDotsVertical className="rubix-text-dark fs-6" />
</MenuButton>
<Portal>
<MenuList minWidth="80px">
<RouterLink to={`edit/${item.id}`}>
<MenuItem className="web-text-medium">Edit</MenuItem>
</RouterLink>
<RouterLink to={`view/${item.id}`}>
<MenuItem className="web-text-medium">View</MenuItem>
</RouterLink>
<MenuItem
onClick={() => {
setActionId(item?.id);
setDeleteAlert(true);
}}
className="web-text-medium"
>
Delete
</MenuItem>
</MenuList>
</Portal>
</Menu>
</span>
),
}));
const handleDelete = () => {
const updatedSponsors = sponser.filter(
(sponsor) => sponsor.id !== actionId
);
setTimeout(() => {
setSponser(updatedSponsors);
setDeleteAlert(false);
setIsLoading(false);
}, 100);
setIsLoading(true);
};
return (
<Box {...OPACITY_ON_LOAD} overflowY={"scroll"} height={"100vh"}>
<Box bg="white.500">
<HStack
display={"flex"}
justifyContent={"space-between"}
ps={1}
pe={1}
pb={4}
pt={4}
spacing="24px"
>
<Input
type="search"
width={300}
placeholder="Search..."
size="sm"
rounded="sm"
value={searchTerm}
onChange={(e) => setSearchTerm(e.target.value)}
/>
<HStack display={"flex"} alignItems={"center"}>
<Pagination totalItems={10} />
<Link to={"/sponser/add-sponser"}>
<Button
leftIcon={<AddIcon />}
colorScheme={"green"}
rounded={"sm"}
size={"sm"}
>
Add Exchange Rate
</Button>
</Link>
</HStack>
</HStack>
</Box>
<DataTable
emptyMessage={`We don't have any Sponers `}
tableHeadRow={tableHeadRow}
data={extractedArray}
isLoading={isLoading}
// totalPages={10}
/>
<CustomAlertDialog
onClose={() => setDeleteAlert(false)}
isOpen={deleteAlert}
message={"Are you sure you want to delete sponers?"}
alertHandler={handleDelete}
isLoading={isLoading}
/>
</Box>
);
};
export default ExchangeRate;

View File

@@ -0,0 +1,12 @@
import { Box, Text } from "@chakra-ui/react";
import { OPACITY_ON_LOAD } from "../../../Layout/animations";
const InvestmentType = () => {
return (
<Box {...OPACITY_ON_LOAD} overflowY={"scroll"} height={"100vh"}>
<Text as={"h1"}> Investment type page</Text>
</Box>
);
};
export default InvestmentType;

View File

@@ -0,0 +1,12 @@
import { Box, Text } from "@chakra-ui/react";
import { OPACITY_ON_LOAD } from "../../Layout/animations";
const PendingRequest = () => {
return (
<Box {...OPACITY_ON_LOAD} overflowY={"scroll"} height={"100vh"}>
<Text as={"h1"}>Pending Request Page</Text>
</Box>
);
};
export default PendingRequest;

View File

@@ -0,0 +1,12 @@
import { Box, Text } from "@chakra-ui/react";
import { OPACITY_ON_LOAD } from "../../Layout/animations";
const ViewHistory = () => {
return (
<Box {...OPACITY_ON_LOAD} overflowY={"scroll"} height={"100vh"}>
<Text as={"h1"}>View History Page</Text>
</Box>
);
};
export default ViewHistory;

View File

@@ -30,7 +30,7 @@ export const nav = [
{
title: "Sponser Master",
path: "/sponser",
icon:RiMoneyDollarBoxLine
icon: RiMoneyDollarBoxLine
},
{
title: "Investment Type",
@@ -39,8 +39,8 @@ export const nav = [
},
{
title: "Exchange Rate",
path: "/view",
icon:RiExchangeBoxLine
path: "/exchange-rate",
icon: RiExchangeBoxLine
},
],
type: "accordion",
@@ -51,13 +51,13 @@ export const nav = [
submenu: [
{
title: "Create IO",
path: "/Create IO",
icon:MdOutlineAddChart
path: "/create",
icon: MdOutlineAddChart
},
{
title: "View IO",
path: "/View IO",
icon:HiOutlineChartSquareBar
path: "/view",
icon: HiOutlineChartSquareBar
},
],
type: "accordion",
@@ -68,13 +68,13 @@ export const nav = [
submenu: [
{
title: "Investor Details",
path: "/Investor Details",
icon:TbListDetails
path: "/investor-details",
icon: TbListDetails
},
{
title: "Investor Transactions",
path: "/Investor Transactions",
icon:TbTransactionDollar
path: "/investor-transactions",
icon: TbTransactionDollar
},
],
type: "accordion",
@@ -88,13 +88,13 @@ export const nav = [
submenu: [
{
title: "Pending Request",
path: "/Pending Request",
icon:VscGitPullRequestGoToChanges
path: "/pending-request",
icon: RiMoneyDollarBoxLine
},
{
title: "View History",
path: "/View History",
icon:TbChartHistogram
path: "/view-history",
icon: RiExchangeBoxLine
}
],
type: "accordion",
@@ -105,13 +105,13 @@ export const nav = [
submenu: [
{
title: "Pending Request",
path: "/Pending Request",
icon:VscGitPullRequestGoToChanges
path: "/investor-request",
icon: RiMoneyDollarBoxLine
},
{
title: "View History",
path: "/View History",
icon:TbChartHistogram
path: "/upgrade-history",
icon: RiExchangeBoxLine
}
],
type: "accordion",
@@ -122,13 +122,13 @@ export const nav = [
submenu: [
{
title: "Pending Request",
path: "/Pending Request",
icon:VscGitPullRequestGoToChanges
path: "/deletion-request",
icon: RiMoneyDollarBoxLine
},
{
title: "View History",
path: "/View History",
icon:TbChartHistogram
path: "/deletion-history",
icon: RiExchangeBoxLine
}
],
type: "accordion",
@@ -137,38 +137,38 @@ export const nav = [
{
title: "MANAGE ADMIN",
type: "title",
},{
}, {
title: "Admin",
submenu: [
{
title: "Bank / Urban Investor",
path: "/Pending Request",
icon:TbReportMoney
path: "/bank-investor",
icon: TbReportMoney
},
{
title: "Academy",
path: "/Academy",
icon:GrManual
path: "/academy",
icon: SiAcademia
},
{
title: "Notification",
path: "/Notification",
icon:MdNotificationsNone
path: "/notification",
icon: MdNotificationsNone
},
{
title: "Contact Details",
path: "/Contact Details",
icon:LuContact
path: "/contact",
icon: LuContact
},
{
title: "Users",
path: "/Users",
icon:RiFileUserLine
path: "/users",
icon: RiFileUserLine
},
{
title: "Bank Details",
path: "/Bank Details",
icon:RiBankLine
path: "/bank-details",
icon: RiBankLine
}
],
type: "accordion",
@@ -195,17 +195,17 @@ export const nestedNav = [
{
title: "Sponser",
path: "/sponser",
icon:RiMoneyDollarBoxLine
icon: RiMoneyDollarBoxLine
},
{
title: "Exchange rate",
path: "/exchange-rate",
icon:RiExchangeBoxLine
icon: RiExchangeBoxLine
},
{
title: "Asset classes",
path: "/view",
icon:VscSymbolClass
icon: VscSymbolClass
},
],
type: "accordion",
@@ -217,17 +217,17 @@ export const nestedNav = [
{
title: "Sponser",
path: "/loop",
icon:TbBrandMedium
icon: TbBrandMedium
},
{
title: "Class",
path: "/class",
icon:TbBrandMedium
icon: TbBrandMedium
},
{
title: "View",
path: "/view",
icon:TbBrandMedium
icon: TbBrandMedium
},
],
type: "accordion",
@@ -235,24 +235,23 @@ export const nestedNav = [
},
]
},
,
{
title: "User",
submenu: [
{
title: "Sponser",
path: "/loop",
icon:TbBrandMedium
icon: TbBrandMedium
},
{
title: "Class",
path: "/class",
icon:TbBrandMedium
icon: TbBrandMedium
},
{
title: "View",
path: "/view",
icon:TbBrandMedium
icon: TbBrandMedium
},
],
type: "accordion",

View File

@@ -1,17 +1,58 @@
import Investment from "../Pages/Investment/Investment";
import DeletionHistory from "../Pages/AccountDeletion/DeletionHistory";
import DeletionRequest from "../Pages/AccountDeletion/DeletionRequest";
import Academy from "../Pages/Admin/Academy";
import BankDetails from "../Pages/Admin/BankDetails";
import BankInvestor from "../Pages/Admin/BankInvestor";
import Contact from "../Pages/Admin/Contact";
import Notification from "../Pages/Admin/Notification";
import Users from "../Pages/Admin/Users";
import Create from "../Pages/IO_Management/Create";
import View from "../Pages/IO_Management/View";
import InvestorPendingRequest from "../Pages/InvestorUpgrade/InvestorPendingRequest";
import upgradeHistory from "../Pages/InvestorUpgrade/UpgradeHistory";
import InvestorDetails from "../Pages/Investor_Management/InvestorDetails";
import InvestorTransactions from "../Pages/Investor_Management/InvestorTransactions";
import ExchangeRate from "../Pages/Master/ExchangeRate/ExchangeRate";
import InvestmentType from "../Pages/Master/InvestmentType/InvestmentType";
import AddSponser from "../Pages/Master/Sponser/AddSponser";
import Sponser from "../Pages/Master/Sponser/Sponsers";
import UnderConstruction from "../Pages/UnderConstruction";
import PendingRequest from "../Pages/WithDrawal/PendingRequest";
import ViewHistory from "../Pages/WithDrawal/ViewHistory";
export const RouteLink = [
// =============[ Tanami ]================
// ===============[ Management]===============
{ path: "/sponser", Component: Sponser },
{ path: "/sponser/add-sponser", Component: AddSponser },
{ path: "/exchange-rate", Component: ExchangeRate },
{ path: "/investment-type", Component: InvestmentType },
// ===============[ IO Management]===============
{ path: "/create", Component: Create },
{ path: "/view", Component: View },
// ===============[ Investor Management]===============
{ path: "/investor-details", Component: InvestorDetails },
{ path: "/investor-transactions", Component: InvestorTransactions },
{ path: "/exchange-rate", Component: UnderConstruction },
// ===============[ Withdrawal]===============
{ path: "/pending-request", Component: PendingRequest },
{ path: "/view-history", Component: ViewHistory },
// ===============[ Withdrawal]===============
{ path: "/upgrade-history", Component: upgradeHistory },
{ path: "/investor-request", Component: InvestorPendingRequest },
// ===============[ Deletion]===============
{ path: "/deletion-request", Component: DeletionRequest },
{ path: "/deletion-history", Component: DeletionHistory },
// ===============[ Admin]===============
{ path: "/bank-investor", Component: BankInvestor },
{ path: "/academy", Component: Academy },
{ path: "/notification", Component: Notification },
{ path: "/contact", Component: Contact },
{ path: "/users", Component: Users },
{ path: "/bank-details", Component: BankDetails },
];

View File

@@ -795,3 +795,17 @@ export const addFaq = Yup.object().shape({
// }
// })
});
// Tanami Schema
export const investmentSchema = Yup.object().shape({
name: Yup.string().required("Name is required"),
address: Yup.string().required("Type is required"),
mobile: Yup.string().required("Total Fund is required"),
bankDetails: Yup.string().required("Total Investor is required"),
bankAccount: Yup.string().required("Predicted Income is required"),
status: Yup.string()
.oneOf(["available", "upcoming", "closed"], "Invalid status")
.required("Status is required"),
});