From 8be0bd93d2b73b86a9c76c2471a84b95ddc8dc39 Mon Sep 17 00:00:00 2001 From: priyanshuvish Date: Fri, 6 Sep 2024 16:04:08 +0530 Subject: [PATCH] Image upload in profile pending --- src/Components/HeaderMain.jsx | 6 +- src/Pages/Profile/EditProfile.jsx | 104 ++++++++++++++ src/Pages/Profile/Profile.jsx | 175 ++++++++++++++++++++++++ src/Pages/Report/AddNewReport.jsx | 2 +- src/Pages/Requests/AdvanceExpense.jsx | 63 +++++++++ src/Pages/Requests/Reimbursement.jsx | 63 +++++++++ src/Pages/Requests/Requests.jsx | 188 +++++--------------------- src/Routes/Routes.js | 5 + 8 files changed, 452 insertions(+), 154 deletions(-) create mode 100644 src/Pages/Profile/EditProfile.jsx create mode 100644 src/Pages/Profile/Profile.jsx create mode 100644 src/Pages/Requests/AdvanceExpense.jsx create mode 100644 src/Pages/Requests/Reimbursement.jsx diff --git a/src/Components/HeaderMain.jsx b/src/Components/HeaderMain.jsx index 18143b4..1e47937 100644 --- a/src/Components/HeaderMain.jsx +++ b/src/Components/HeaderMain.jsx @@ -125,9 +125,11 @@ const HeaderMain = ({ - + + Profile - + + Help & Support diff --git a/src/Pages/Profile/EditProfile.jsx b/src/Pages/Profile/EditProfile.jsx new file mode 100644 index 0000000..8fa559e --- /dev/null +++ b/src/Pages/Profile/EditProfile.jsx @@ -0,0 +1,104 @@ +import { Box, Text, HStack, Image, Input, Icon, Button } from '@chakra-ui/react'; +import React, { useRef } from 'react'; +import MiniHeader from '../../Components/MiniHeader'; +import { OPACITY_ON_LOAD } from '../../Layout/animations'; +import { BiCloudUpload } from "react-icons/bi"; +import PrimaryButton from '../../Components/Buttons/PrimaryButton'; +import SecondaryButton from '../../Components/Buttons/SecondaryButton'; + +const EditProfile = () => { + const inputRef = useRef(); + + // Trigger the hidden file input + const handleFileUploadClick = () => { + inputRef.current.click(); + }; + + // Handle saving profile (you may add logic to actually handle form submission) + const handleSaveProfile = () => { + console.log('Profile saved'); + // Add actual save logic here (e.g., API call) + }; + + return ( + + + + + + {/* Profile Picture and Upload */} + + Profile Picture + + + + + + Upload + + + + + {/* Editable Profile Information */} + + + + + + + + + + + + + + + + + ); +}; + +// Profile Field Component +// Profile Field Component +const ProfileField = ({ label, placeholder, defaultValue, labelColor = "#363636" }) => ( + + + {label} + + + +); + + +export default EditProfile; diff --git a/src/Pages/Profile/Profile.jsx b/src/Pages/Profile/Profile.jsx new file mode 100644 index 0000000..46d8dd0 --- /dev/null +++ b/src/Pages/Profile/Profile.jsx @@ -0,0 +1,175 @@ +import { Box, Text, HStack, Image, Input, Icon } from '@chakra-ui/react'; +import React, { useRef } from 'react'; +import { useNavigate } from 'react-router-dom'; +import MiniHeader from '../../Components/MiniHeader'; +import { OPACITY_ON_LOAD } from '../../Layout/animations'; +import { AiOutlineEdit } from "react-icons/ai"; +import { BiCloudUpload } from "react-icons/bi"; +import { RxLockClosed } from "react-icons/rx"; +import { RiArrowRightSLine } from "react-icons/ri"; +import { GoArrowSwitch } from "react-icons/go"; + +const Profile = () => { + const inputRef = useRef(); + const navigate = useNavigate(); + + // Trigger the hidden file input + const handleFileUploadClick = () => { + inputRef.current.click(); + }; + + // Handle navigation to edit profile page + const handleEditProfile = () => { + navigate('/profile/edit-profile'); + }; + + return ( + + + + + + + + + Edit + + + + + + + Profile Picture + + + + + + Upload + + + + + + + + + + + + + + + + + + + + Change Password + + + + + + + + + + + + + Switch Profile + + + + + + ); +}; + +const ProfileInfo = ({ label, value }) => ( + <> + + {label} + + + {value} + + +); + +export default Profile; diff --git a/src/Pages/Report/AddNewReport.jsx b/src/Pages/Report/AddNewReport.jsx index f7ad753..17ce5d0 100644 --- a/src/Pages/Report/AddNewReport.jsx +++ b/src/Pages/Report/AddNewReport.jsx @@ -43,7 +43,7 @@ const AddNewReport = () => { {requestsTable?.map((request, index) => - diff --git a/src/Pages/Requests/AdvanceExpense.jsx b/src/Pages/Requests/AdvanceExpense.jsx new file mode 100644 index 0000000..6206fad --- /dev/null +++ b/src/Pages/Requests/AdvanceExpense.jsx @@ -0,0 +1,63 @@ +import React from 'react'; +import { Box, VStack, Text, HStack, Button, Divider } from '@chakra-ui/react'; +import { CalendarIcon } from '@chakra-ui/icons'; +import NormalTable from "../../Components/DataTable/NormalTable"; +import PrimaryButton from "../../Components/Buttons/PrimaryButton"; + +const AdvanceExpense = ({ tableHeadRow, extractedArray, isLoading, onOpen }) => { + return ( + + + + Expenses + + + + + + + + + + + + + ); +}; + +export default AdvanceExpense; diff --git a/src/Pages/Requests/Reimbursement.jsx b/src/Pages/Requests/Reimbursement.jsx new file mode 100644 index 0000000..551a31e --- /dev/null +++ b/src/Pages/Requests/Reimbursement.jsx @@ -0,0 +1,63 @@ +import React from 'react'; +import { Box, VStack, HStack, Text, Button, Divider } from '@chakra-ui/react'; +import { CalendarIcon } from '@chakra-ui/icons'; +import NormalTable from "../../Components/DataTable/NormalTable"; +import PrimaryButton from "../../Components/Buttons/PrimaryButton"; + +const Reimbursement = ({ onOpen, tableHeadRow, extractedArray, isLoading }) => { + return ( + + + + Expenses + + + + + + + + + + + + + ); +}; + +export default Reimbursement; diff --git a/src/Pages/Requests/Requests.jsx b/src/Pages/Requests/Requests.jsx index f7fa210..dc75d0f 100644 --- a/src/Pages/Requests/Requests.jsx +++ b/src/Pages/Requests/Requests.jsx @@ -1,4 +1,4 @@ -import React from "react"; +import React, { useContext, useState, useEffect } from "react"; import { Box, Tabs, Tab, TabList, TabPanels, TabPanel, Button, @@ -12,42 +12,30 @@ import { Checkbox, useDisclosure } 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 Reimbursement from "./Reimbursement"; +import AdvanceExpense from "./AdvanceExpense"; import { MdOutlineRamenDining } from "react-icons/md"; -import { useNavigate } from "react-router-dom"; -import PrimaryButton from "../../Components/Buttons/PrimaryButton"; +import { OPACITY_ON_LOAD } from "../../Layout/animations"; +import { AiOutlineEdit } from "react-icons/ai"; +import { RiDeleteBin5Line } from "react-icons/ri"; +import MiniHeader from "../../Components/MiniHeader"; +import { FaRegFilePdf } from "react-icons/fa"; import AddReportModal from "./AddReportModal"; const Requests = () => { - const navigate = useNavigate() const { requestsTable } = useContext(GlobalStateContext); const [isLoading, setIsLoading] = useState(false); - const { isOpen, onOpen, onClose } = useDisclosure() + const { isOpen, onOpen, onClose } = useDisclosure(); + // Simulate loading effect 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 + const timer = setTimeout(() => setIsLoading(false), 500); return () => clearTimeout(timer); - }, []); // Empty dependency array means this effect runs once after the component mounts + }, []); - // ===============================[ Table Header ] + // Table headers const tableHeadRow = [ "Transaction Type", "Date", @@ -57,8 +45,7 @@ const Requests = () => { "Actions", ]; - // const extractedArray = requestsTable.map((item)=>({ })) - + // Extracted data for table const extractedArray = requestsTable.map((item, index) => ({ "Transaction Type": ( @@ -148,27 +135,21 @@ const Requests = () => { ), })); - return ( - + + {/* Mini header component */} - + + {/* Tabs for switching between AdvanceExpense and Reimbursement */} + - + { { + {/* Tab panels */} - - - - - Expenses - - - - - - - - - - - - - - + + - - - - - Expenses - - - - - - - - - - - - - - + + - - + ); diff --git a/src/Routes/Routes.js b/src/Routes/Routes.js index add1fce..a891fb4 100644 --- a/src/Routes/Routes.js +++ b/src/Routes/Routes.js @@ -7,6 +7,9 @@ import Requests from "../Pages/Requests/Requests"; import Benefit from "../Pages/Benefit/Benefit"; import Gifts from "../Pages/Gifts/Gifts"; import HelpAndSupport from "../Pages/HelpAndSupport/HelpAndSupport"; +import Profile from "../Pages/Profile/Profile"; +import EditProfile from "../Pages/Profile/EditProfile"; + export const RouteLink = [ @@ -19,4 +22,6 @@ export const RouteLink = [ { path: "/benefit", Component: Benefit }, { path: "/gifts", Component: Gifts }, { path: "/help-support", Component: HelpAndSupport }, + { path: "/profile", Component: Profile }, + { path: "/profile/edit-profile", Component: EditProfile }, ];