From ee8f905d3aa5445882d80bb299e6e2f8aef38b7c Mon Sep 17 00:00:00 2001 From: YasinShaikh123 <123150391+YasinShaikh123@users.noreply.github.com> Date: Fri, 16 Aug 2024 15:12:37 +0530 Subject: [PATCH] mobile view --- src/Components/CurrencyInput.jsx | 13 ++- src/Components/MobileView.jsx | 96 ++++++++++++++----- .../IO_Management/ViewIO/ViewIOTable.jsx | 7 +- src/Pages/IO_Management/ViewIO/ViewIOdata.jsx | 4 +- .../IO_Management/ViewIO/ViewIOdetails.jsx | 2 +- .../Master/ExchangeRate/ExchangeRate.jsx | 73 +++++++------- src/Routes/Routes.js | 4 - 7 files changed, 125 insertions(+), 74 deletions(-) diff --git a/src/Components/CurrencyInput.jsx b/src/Components/CurrencyInput.jsx index 45932c4..f2a46b1 100644 --- a/src/Components/CurrencyInput.jsx +++ b/src/Components/CurrencyInput.jsx @@ -1,8 +1,19 @@ import React, { forwardRef } from 'react'; import { Input } from "@chakra-ui/react"; +// export const formatCurrency = (value) => { +// if (!value) return ''; +// const [integer, decimal] = value.split('.'); +// const formattedInteger = integer.replace(/\B(?=(\d{3})+(?!\d))/g, ','); +// return decimal ? `${formattedInteger}.${decimal}` : formattedInteger; +// }; + export const formatCurrency = (value) => { - if (!value) return ''; + if (!value && value !== 0) return ''; // Handle null, undefined, and empty strings + + // Ensure the value is a string + value = value.toString(); + const [integer, decimal] = value.split('.'); const formattedInteger = integer.replace(/\B(?=(\d{3})+(?!\d))/g, ','); return decimal ? `${formattedInteger}.${decimal}` : formattedInteger; diff --git a/src/Components/MobileView.jsx b/src/Components/MobileView.jsx index be6b8a5..f2c461a 100644 --- a/src/Components/MobileView.jsx +++ b/src/Components/MobileView.jsx @@ -12,13 +12,47 @@ import { Stack, Text, } from "@chakra-ui/react"; -import React from "react"; +import React, { useEffect, useState } from "react"; import Mobile from "../assets/mobileWing.png"; import mobileBanner from "../assets/welcome.avif"; import { GrDownload } from "react-icons/gr"; import { LuClock } from "react-icons/lu"; +import { GiNetworkBars } from "react-icons/gi"; +import { GrLinkedinOption } from "react-icons/gr"; +import { FiInstagram } from "react-icons/fi"; +import { IoBatteryHalf } from "react-icons/io5"; +import { BiWifi } from "react-icons/bi"; +import { useGetIOByIdQuery } from "../Services/io.service"; +import { useParams } from "react-router-dom"; const MobileView = ({ isOpen, onClose, finalRef }) => { + + const [time, setTime] = useState(new Date()); + const params = useParams(); + const id = params?.id; + + const { + data, + isLoading: IObyIDisLoading, + error: IObyIDerror, + } = useGetIOByIdQuery(id, { skip: !id }); + + console.log(data); + + + + useEffect(() => { + const timer = setInterval(() => { + setTime(new Date()); + }, 1000); + + return () => clearInterval(timer); + }, []); + + const formatTime = (date) => { + return date.toLocaleTimeString([], { hour: '2-digit', minute: '2-digit', hour12: false }); + }; + return (
@@ -46,6 +80,18 @@ const MobileView = ({ isOpen, onClose, finalRef }) => { pt={"30px"} px={"15px"} > + + + + {formatTime(time)} + + {/* */} + + + + + + { "rgba(0, 0, 0, 0.15) 0px 2px 8px" } > - - - Stock - Closing Date Aug 23 2024 - + + Stock + + Closing Date Aug 23 2024 + { value={20} borderRadius={"3px"} /> - + 0.0% funded - + fugit eligendi dolore dolore et - + Sponsor name: - + Scott Simon - + Estimated return: - + A provident veniam - + Hoiding period: - + Eius eiusmod exericit - + Minimum investment: - + BHD 1 @@ -145,7 +191,7 @@ const MobileView = ({ isOpen, onClose, finalRef }) => { "rgba(0, 0, 0, 0.15) 0px 2px 8px" } > - Key Merits + Key Merits { "rgba(0, 0, 0, 0.15) 0px 2px 8px" } > - Investment Documents + Investment Documents - + Merrill Rocha @@ -193,19 +239,19 @@ const MobileView = ({ isOpen, onClose, finalRef }) => { "rgba(0, 0, 0, 0.15) 0px 2px 8px" } > - Videos + Videos - - + + diff --git a/src/Pages/IO_Management/ViewIO/ViewIOTable.jsx b/src/Pages/IO_Management/ViewIO/ViewIOTable.jsx index 12d42ab..81c084c 100644 --- a/src/Pages/IO_Management/ViewIO/ViewIOTable.jsx +++ b/src/Pages/IO_Management/ViewIO/ViewIOTable.jsx @@ -41,6 +41,7 @@ import { TABLE_PAGINATION } from "../../../Constants/Paginations"; import { formatCurrency } from "../../../Components/CurrencyInput"; import { IoIosPhonePortrait } from "react-icons/io"; import MobileView from "../../../Components/MobileView"; +import { FaMobileAlt } from "react-icons/fa"; // import { debounce } from "./AddIOCharges"; const formatDate = (date) => new Date(date).toLocaleDateString(); // Simple date formatter @@ -85,7 +86,7 @@ const ViewIOTable = () => { "Goal Amount", "Holding Period", "IO Status", - "Priority", + // "Priority", "Action", ]; @@ -190,7 +191,9 @@ const ViewIOTable = () => { "Priority": ( - View + + View + ), diff --git a/src/Pages/IO_Management/ViewIO/ViewIOdata.jsx b/src/Pages/IO_Management/ViewIO/ViewIOdata.jsx index bb20909..4dde58b 100644 --- a/src/Pages/IO_Management/ViewIO/ViewIOdata.jsx +++ b/src/Pages/IO_Management/ViewIO/ViewIOdata.jsx @@ -45,7 +45,7 @@ const ViewIOdata = () => { const navigate = useNavigate(); const [isEditing, setIsEditing] = useState(false); - + const tabs = [ { label: "IO Details", content: }, { label: "Investment documents", content: }, @@ -73,7 +73,7 @@ const ViewIOdata = () => { {tabs.map(({ label }, index) => ( - { const navigate = useNavigate(); const params = useParams(); diff --git a/src/Pages/Master/ExchangeRate/ExchangeRate.jsx b/src/Pages/Master/ExchangeRate/ExchangeRate.jsx index c459a86..04dcf56 100644 --- a/src/Pages/Master/ExchangeRate/ExchangeRate.jsx +++ b/src/Pages/Master/ExchangeRate/ExchangeRate.jsx @@ -38,7 +38,7 @@ import { formatCurrency } from "../../../Components/CurrencyInput"; const ExchangeRate = () => { const toast = useToast(); - const navigate = useNavigate() + const navigate = useNavigate(); const { slideFromRight, rateExchange, setRateExchange } = useContext(GlobalStateContext); const [searchTerm, setSearchTerm] = useState(""); @@ -52,14 +52,13 @@ const ExchangeRate = () => { const [pageSize, setPageSize] = useState(TABLE_PAGINATION?.size); const [currentPage, setCurrentPage] = useState(1); - const { - data, - isLoading: isExchangeRateLoading, - errors, - } = useGetAllExchangeRatesQuery({ page: currentPage, size: pageSize }) - - console.log(data?.data); + const { + data, + isLoading: isExchangeRateLoading, + errors, + } = useGetAllExchangeRatesQuery({ page: currentPage, size: pageSize }); + console.log(data?.data); // ====================================================[Table Setup]================================================================ const tableHeadRow = [ @@ -102,7 +101,7 @@ const ExchangeRate = () => { fontWeight={"600"} className="d-flex align-items-center fw- web-text-small" > - {item?.toCurrency?.currencyCode} + {item?.toCurrency?.currencyCode} ), "Effective from": ( @@ -119,7 +118,7 @@ const ExchangeRate = () => { Rate: ( { ), - Action: ( + Action: ( // @@ -138,32 +137,30 @@ const ExchangeRate = () => { id={item.id} // updateHistory={updateHistory} /> - - - - + + + ), })); @@ -187,7 +184,7 @@ const ExchangeRate = () => { { value={searchTerm} onChange={(e) => setSearchTerm(e.target.value)} /> - - diff --git a/src/Routes/Routes.js b/src/Routes/Routes.js index 3a35262..647a61b 100644 --- a/src/Routes/Routes.js +++ b/src/Routes/Routes.js @@ -49,10 +49,6 @@ export const RouteLink = [ { path: "/exchange-rate", Component: ExchangeRate }, { path: "/exchange-rate/currency-history/:id", Component: ExchangeHistory }, - - - - { path: "/investment-type", Component: InvestmentType }, { path: "/investment-type/add-investment/:id", Component: AddInvestmentType }, { path: "/investment-type/add-investment", Component: AddInvestmentType },