diff --git a/src/Contexts/GlobalStateProvider.jsx b/src/Contexts/GlobalStateProvider.jsx index f6cf43a..5b869eb 100644 --- a/src/Contexts/GlobalStateProvider.jsx +++ b/src/Contexts/GlobalStateProvider.jsx @@ -9,6 +9,7 @@ import { HiOutlineReceiptPercent } from "react-icons/hi2"; import { IoMdQrScanner } from "react-icons/io"; import { GrDocumentPdf } from "react-icons/gr"; import { AiOutlineFileGif } from "react-icons/ai"; +import DummyPdf from "../../src/assets/dummy-pdf.pdf" const getRandomDate = (start, end) => { const date = new Date( @@ -41,7 +42,9 @@ export const generateUniqueId = () => { const GlobalStateProvider = ({ children }) => { const [isAuthenticate, setIsAuthenticate] = useState(false); - const [ reportsHistory, setReportsHistory ] = useState([ + + + const [reportsHistory, setReportsHistory] = useState([ { "id": 1, "name": "Office Supplies - July 2024", @@ -213,13 +216,102 @@ const GlobalStateProvider = ({ children }) => { ] ) + + + const [requestsTable, setRequestTable] = useState([ + { + "id": 1, + "transactionType": "Dine In", + "date": "31- 02-2024 04.20 pm", + "walletType": "Food", + "document": `${DummyPdf}`, + "amountSpent": "₹ 5000" + }, + { + "id": 2, + "transactionType": "Dine In", + "date": "31- 02-2024 04.20 pm", + "walletType": "Food", + "document": `${DummyPdf}`, + "amountSpent": "₹ 5000" + }, + { + "id": 3, + "transactionType": "Dine In", + "date": "31- 02-2024 04.20 pm", + "walletType": "Food", + "document": `${DummyPdf}`, + "amountSpent": "₹ 5000" + }, + { + "id": 4, + "transactionType": "Dine In", + "date": "31- 02-2024 04.20 pm", + "walletType": "Food", + "document": `${DummyPdf}`, + "amountSpent": "₹ 5000" + }, + { + "id": 5, + "transactionType": "Dine In", + "date": "31- 02-2024 04.20 pm", + "walletType": "Food", + "document": `${DummyPdf}`, + "amountSpent": "₹ 5000" + }, + { + "id": 6, + "transactionType": "Dine In", + "date": "31- 02-2024 04.20 pm", + "walletType": "Food", + "document": `${DummyPdf}`, + "amountSpent": "₹ 5000" + }, + { + "id": 7, + "transactionType": "Dine In", + "date": "31- 02-2024 04.20 pm", + "walletType": "Food", + "document": `${DummyPdf}`, + "amountSpent": "₹ 5000" + }, + { + "id": 8, + "transactionType": "Dine In", + "date": "31- 02-2024 04.20 pm", + "walletType": "Food", + "document": `${DummyPdf}`, + "amountSpent": "₹ 5000" + }, + { + "id": 9, + "transactionType": "Dine In", + "date": "31- 02-2024 04.20 pm", + "walletType": "Food", + "document": `${DummyPdf}`, + "amountSpent": "₹ 5000" + }, + { + "id": 10, + "transactionType": "Dine In", + "date": "31- 02-2024 04.20 pm", + "walletType": "Food", + "document": `${DummyPdf}`, + "amountSpent": "₹ 5000" + }, + + ] + ) + return ( {children} diff --git a/src/Pages/Requests/Requests.jsx b/src/Pages/Requests/Requests.jsx index c3a48f5..1d48dbb 100644 --- a/src/Pages/Requests/Requests.jsx +++ b/src/Pages/Requests/Requests.jsx @@ -1,15 +1,346 @@ -import { Box } from "@chakra-ui/react"; import React from "react"; +import { + Box, Tabs, Tab, TabList, TabPanels, TabPanel, + Button, + Divider, + Icon, + Tag, + TagLabel, + Text, + VStack, + HStack, + Checkbox +} from "@chakra-ui/react"; +import { useContext, useEffect, useState } from "react"; +import GlobalStateContext from "../../Contexts/GlobalStateContext"; +import { OPACITY_ON_LOAD } from "../../Layout/animations"; +import { RiDeleteBin5Line } from "react-icons/ri"; +import { AiOutlineEdit } from "react-icons/ai"; +import { FaRegEye } from "react-icons/fa"; +import { PiReceipt } from "react-icons/pi"; +import { CalendarIcon } from "@chakra-ui/icons"; import MiniHeader from "../../Components/MiniHeader"; +import NormalTable from "../../Components/DataTable/NormalTable"; +import { FaRegFilePdf } from "react-icons/fa"; +import { MdOutlineRamenDining } from "react-icons/md"; const Requests = () => { + const { requestsTable } = useContext(GlobalStateContext); + const [isLoading, setIsLoading] = useState(false); + + useEffect(() => { + // Set isLoading to true + setIsLoading(true); + + // Simulate a 3-second delay + const timer = setTimeout(() => { + setIsLoading(false); // Set isLoading to false after 3 seconds + }, 500); + + // Cleanup the timer when the component unmounts or when the useEffect re-runs + return () => clearTimeout(timer); + }, []); // Empty dependency array means this effect runs once after the component mounts + + // ===============================[ Table Header ] + const tableHeadRow = [ + "Transaction Type", + "Date", + "Wallet Type", + "Document", + "Amount Spent", + "Actions", + ]; + + // const extractedArray = requestsTable.map((item)=>({ })) + + const extractedArray = requestsTable.map((item, index) => ({ + "Transaction Type": ( + + + + {item.transactionType} + + + ), + "Date": ( + + {item.date} + + ), + "Wallet Type": ( + + ), + + Document: ( + + ), + "Amount Spent": ( + + {item.amountSpent} + + ), + Actions: ( + + + + + ), + })); + + return ( - + + + + + + Advance Expense + + + Reimbursement + + + + + + + + + Expenses + + + + + + + + + + + + + + + + + + + + Expenses + + + + + + + + + + + + + + + + + + + + + ); }; diff --git a/src/assets/dummy-pdf.pdf b/src/assets/dummy-pdf.pdf new file mode 100644 index 0000000..8da27b5 Binary files /dev/null and b/src/assets/dummy-pdf.pdf differ