diff --git a/components/analysis/AnalysisPopUp.tsx b/components/analysis/AnalysisPopUp.tsx index e858278..b1184d2 100644 --- a/components/analysis/AnalysisPopUp.tsx +++ b/components/analysis/AnalysisPopUp.tsx @@ -8,9 +8,9 @@ interface props { setIsfilteropen: Function setIsAddAccountPopupOpen: Function bankAccountList: any[] - + SetIsKycPermissionPopUpOpen: Function } -const AnalysisPopUp = ({ isanalysisopen, setIsanalysisopen, setIsAddAccountPopupOpen, setIsfilteropen, bankAccountList }: props) => { +const AnalysisPopUp = ({ isanalysisopen, setIsanalysisopen, setIsAddAccountPopupOpen, setIsfilteropen, bankAccountList,SetIsKycPermissionPopUpOpen }: props) => { const [dropfiles, setDropfiles] = useState(false) useEffect(() => { @@ -32,7 +32,7 @@ const AnalysisPopUp = ({ isanalysisopen, setIsanalysisopen, setIsAddAccountPopup padding={0} > {dropfiles ? : } + setIsanalysisopen={setIsanalysisopen} setIsAddAccountPopupOpen={setIsAddAccountPopupOpen} SetIsKycPermissionPopUpOpen={SetIsKycPermissionPopUpOpen} /> : } ) } diff --git a/components/analysis/selectType.tsx b/components/analysis/selectType.tsx index 87b59db..52b2a56 100644 --- a/components/analysis/selectType.tsx +++ b/components/analysis/selectType.tsx @@ -4,7 +4,9 @@ import Link from 'next/link' import { useRouter } from 'next/router' import { useState } from 'react' import Heading from '../reusable-components/Heading' - +import useStorage from '../../hooks/useStorage' +import api from '../datams' +import { useEffect } from 'react' const useStyles = createStyles((theme) => ({ wrapper: { backgroundColor: `#EEEEEE`, @@ -193,14 +195,45 @@ interface props { setIsfilteropen: Function bankAccountList: any[] setIsAddAccountPopupOpen: Function + SetIsKycPermissionPopUpOpen: Function } -export function AnalysisType({ setdropfiles, setIsanalysisopen, setIsfilteropen, bankAccountList, setIsAddAccountPopupOpen }: props) { +export function AnalysisType({ setdropfiles, setIsanalysisopen, setIsfilteropen, bankAccountList, setIsAddAccountPopupOpen,SetIsKycPermissionPopUpOpen }: props) { const { classes } = useStyles() const [click, setClick] = useState(false) const [type, setType] = useState(undefined) + const { getItem } = useStorage() + const [result, setResult] = useState(1) const [account, setAccount] = useState({ id: 1, }) + const GetKycStatus = () => { + const accessToken = getItem('access_token', 'session') + console.log(accessToken) + const user_id = getItem('user_id') + const accLength = JSON.stringify(getItem('accounts'))?.length + const response = api + .get(`/user/getkyc/`, { + headers: { + Authorization: `Bearer ${accessToken}`, + 'Content-Type': 'application/json', + }, + }) + .then((response) => { + response.data.message === 'KYC done' && setResult(1) + console.log(response.data.message); + + }) + .catch((err) => { + err.response.data.message === 'KYC not done' && setResult(0) + console.log(err.response.data.message) + }) + } + + useEffect(() => { + GetKycStatus() + console.log(result) + // setResult(0); + }, []) let fetchedAccount = [ { id: 1, name: 'Upload Transactions', src: `upi1` }, { id: 2, name: 'Fetch Transactions', src: `bank-building-white` }, @@ -222,7 +255,10 @@ export function AnalysisType({ setdropfiles, setIsanalysisopen, setIsfilteropen,
{ setdropfiles(true) setIsanalysisopen(false) - if (bankAccountList.length === 0) { + if(result===0){ + SetIsKycPermissionPopUpOpen(true); + } + else if (bankAccountList.length === 0) { setIsAddAccountPopupOpen(true) } else { setIsfilteropen(true) @@ -237,7 +273,7 @@ export function AnalysisType({ setdropfiles, setIsanalysisopen, setIsfilteropen, ); } }; - + return ( //
diff --git a/components/dashboard/ExportButton.tsx b/components/dashboard/ExportButton.tsx index 9105deb..8d61248 100644 --- a/components/dashboard/ExportButton.tsx +++ b/components/dashboard/ExportButton.tsx @@ -4,7 +4,6 @@ import React, { useState } from 'react' import useAccountStore from '../Store/Account' // import { useReactToPrint } from 'react-to-print' import { CSVLink } from 'react-csv' - const useStyles = createStyles((theme) => ({ button: { width: `120px`, @@ -90,9 +89,9 @@ export default function ExportButton() { Send an Email -
+ {/*
-
+
*/} ) } diff --git a/components/dashboard/LeftPane.tsx b/components/dashboard/LeftPane.tsx index 49f19c2..e7ae5d6 100644 --- a/components/dashboard/LeftPane.tsx +++ b/components/dashboard/LeftPane.tsx @@ -7,8 +7,8 @@ import useAccountStore from '../Store/Account' import CashCard from './CashLimitCard' import EodBalance from './EODBalanceCard' import RecentTransactions from './recenttransactions' - const FilterRow = styled.div` + display: flex; gap: 12px; justify-content: space-between; @@ -95,8 +95,10 @@ const LeftPane = ({ accountsList, useAccount }: Props) => { }, []) useEffect(() => { console.log('useAccount.Transaction', useAccount.Transaction) + console.log('selectedBankAccount', selectedBankAccount) }, [selectedBankAccount]) + console.log('useAccount',useAccount) const [account, setaccount] = useState(0); const uploaded = useAccountStore(state => state.uploaded) @@ -170,7 +172,7 @@ const LeftPane = ({ accountsList, useAccount }: Props) => { } {/* */} - + diff --git a/components/dashboard/RightPane.tsx b/components/dashboard/RightPane.tsx index 12bc81e..c838dc0 100644 --- a/components/dashboard/RightPane.tsx +++ b/components/dashboard/RightPane.tsx @@ -11,6 +11,8 @@ import useAccountStore from '../Store/Account' import dayjs from 'dayjs' import { useState } from 'react' import { useEffect } from 'react' +import Image from 'next/image' +import { Card } from '@mantine/core' const useStyles = createStyles((theme) => ({ header: { flexDirection: 'row', @@ -50,7 +52,36 @@ const useStyles = createStyles((theme) => ({ border: 'none', }, })) +const Empty=()=>{ + return ( + + + filter-icon + + +) +} const RightPane = () => { const { getItem } = useStorage() const { classes } = useStyles() @@ -122,12 +153,14 @@ const RightPane = () => { - + {transactions[0].description==='' && } + {transactions[0].description!=='' && } {/* */} + {/* { console.log('rendered6846')} */} diff --git a/components/dashboard/recenttransactions.tsx b/components/dashboard/recenttransactions.tsx index bcf8b3e..9b1946c 100644 --- a/components/dashboard/recenttransactions.tsx +++ b/components/dashboard/recenttransactions.tsx @@ -160,6 +160,7 @@ const RecentTransactions = (prop: { Recent Transactions
+ {prop.transactions?.map((t) => (
diff --git a/components/dashboard/recenttransactionsRightPane.tsx b/components/dashboard/recenttransactionsRightPane.tsx index b85d6bb..5f28e85 100644 --- a/components/dashboard/recenttransactionsRightPane.tsx +++ b/components/dashboard/recenttransactionsRightPane.tsx @@ -1,5 +1,5 @@ import { Card, Text, Group, Stack, HoverCard } from '@mantine/core' - +import { useEffect } from 'react' const palette = ['#D56EEA', '#26DD76', '#FFAA57', '#4198FF'] var transactions = [ @@ -155,13 +155,19 @@ const TransactionCard = (props: { } const RecentTransactions = () => { + useEffect(() => { + console.log(transactions.length) + + }, []) + return (
Recent Transactions
- {transactions?.map((t) => ( + {transactions.length===0 &&

No new transactions

} + {transactions.length!==0 && transactions?.map((t) => (
diff --git a/components/home/add-bank-account/AddAccountFormPopup.tsx b/components/home/add-bank-account/AddAccountFormPopup.tsx index 9097b4b..293c379 100644 --- a/components/home/add-bank-account/AddAccountFormPopup.tsx +++ b/components/home/add-bank-account/AddAccountFormPopup.tsx @@ -313,7 +313,7 @@ export function AddAccountFormPopup({ withCloseButton: true, autoClose: 5000, title: "Unsuccessful", - message: err.response.data?.message, + message: err?.response?.data?.message, color: 'red', icon: , loading: false, @@ -354,7 +354,7 @@ export function AddAccountFormPopup({ withCloseButton: true, autoClose: 5000, title: "Unsuccessful", - message: err.response.data?.message, + message: err?.response?.data?.message, color: 'red', icon: , loading: false, diff --git a/components/home/add-bank-account/AddBankAccountSection.tsx b/components/home/add-bank-account/AddBankAccountSection.tsx index 591c947..6437ff9 100644 --- a/components/home/add-bank-account/AddBankAccountSection.tsx +++ b/components/home/add-bank-account/AddBankAccountSection.tsx @@ -1,4 +1,9 @@ import styled from '@emotion/styled' +import { createStyles } from '@mantine/core' +import { useRouter } from 'next/router' +import { useState } from 'react' +import useStorage from '../../../hooks/useStorage' +import { useEffect } from 'react' import { Button, ButtonProps, @@ -6,7 +11,7 @@ import { Image, Loader, } from '@mantine/core' - +import api from '../../datams' const Oflex = styled.div` display: flex; flex-direction: row; @@ -130,17 +135,64 @@ interface Props { setIsAddAccountPopupOpen: Function bankAccountList: any[] loading: any + SetIsKycPermissionPopUpOpen:Function } export default function BankAccount({ bankAccountList, setIsAddAccountPopupOpen, loading, + SetIsKycPermissionPopUpOpen, }: Props) { + + const [click, setClick] = useState(false) + const [type, setType] = useState(undefined) + const { getItem } = useStorage() + const [result, setResult] = useState(1) + const [account, setAccount] = useState({ + id: 1, + }) + const GetKycStatus = () => { + const accessToken = getItem('access_token', 'session') + console.log(accessToken) + const user_id = getItem('user_id') + const accLength = JSON.stringify(getItem('accounts'))?.length + const response = api + .get(`/user/getkyc/`, { + headers: { + Authorization: `Bearer ${accessToken}`, + 'Content-Type': 'application/json', + }, + }) + .then((response) => { + response.data.message === 'KYC done' && setResult(1) + console.log(response.data.message); + + }) + .catch((err) => { + err.response.data.message === 'KYC not done' && setResult(0) + console.log(err.response.data.message) + }) + } + + useEffect(() => { + GetKycStatus() + console.log(result) + // setResult(0); + }, []) return ( Add Bank Account - setIsAddAccountPopupOpen(true)}> + + { + if(result===0){ + SetIsKycPermissionPopUpOpen(true) + } + else{ + setIsAddAccountPopupOpen(true) + } + + }}> Add Account @@ -162,7 +214,17 @@ export default function BankAccount({ })} - setIsAddAccountPopupOpen(true)}> + + { + if(result===0){ + SetIsKycPermissionPopUpOpen(true) + } + else{ + setIsAddAccountPopupOpen(true) + } + + } + }> add diff --git a/components/home/make-payment-section/index.tsx b/components/home/make-payment-section/index.tsx index d0d1501..f58468b 100644 --- a/components/home/make-payment-section/index.tsx +++ b/components/home/make-payment-section/index.tsx @@ -12,7 +12,7 @@ import { useEffect, useState } from 'react' import useStorage from '../../../hooks/useStorage' import api from '../../datams' import MakePaymentCard from './MakePaymentCards' - +import { useRouter } from 'next/router' const _StyledButton = styled(Button)` border-radius: 30px; color: white; @@ -43,6 +43,7 @@ export default function Payment({ setIsAddAccountPopupOpen, bankAccountList }: Props) { + const router=useRouter() const { getItem } = useStorage() const [result, setResult] = useState(1) const GetKycStatus = () => { @@ -63,13 +64,13 @@ export default function Payment({ // console.log(err.response.data.message) }) } - // const [accLength, setAccLength] = useState('[]') - // useEffect(() => { - // GetKycStatus() - // // setResult(0) - // setAccLength(getItem('accounts')) - // console.log(result) - // }, []) + const [accLength, setAccLength] = useState('[]') + useEffect(() => { + GetKycStatus() + // setResult(0) + setAccLength(getItem('accounts')) + console.log(result) + }, []) return (
@@ -88,7 +89,7 @@ export default function Payment({ style={{ justifyContent: 'space-evenly', alignItems: 'flex-start' }} my={12} > - {result === 0 && ( + {/* {result === 0 && (
{ SetIsKycPermissionPopUpOpen(true) @@ -100,9 +101,55 @@ export default function Payment({ alt="Bank Transfer" />
- )} + )} */} + +
{ + if(result===0){ + SetIsKycPermissionPopUpOpen(true) + } + else if(bankAccountList.length === 0){ + setIsAddAccountPopupOpen(true) + } + else{ + router.push('/bank-transfer') + } + + }} + > + + +
+ +
{ + if(result===0){ + SetIsKycPermissionPopUpOpen(true) + } + else if(bankAccountList.length === 0){ + setIsAddAccountPopupOpen(true) + } + else{ + + router.push('/UPI') + + } + + }} + > + +
+ - {result === 1 && bankAccountList.length !== 0 && ( + {/* {result === 1 && bankAccountList.length !== 0 && (
- )} + )} */} {/* {(result===0) ? (
{ /> dashClickHandler(accLength, kycStatus)} /> setisanalysisopen(true)} - /> + dashClickHandler={() => setisanalysisopen(true) } + /> { @@ -126,7 +127,8 @@ const Home: NextPage = () => { + isanalysisopen={isanalysisopen} setIsfilteropen={setIsfilteropen} setIsanalysisopen={setisanalysisopen} + SetIsKycPermissionPopUpOpen={setIsKycPermissionPopUpOpen} /> ) } diff --git a/public/icons/empty.png b/public/icons/empty.png new file mode 100644 index 0000000..66ae11f Binary files /dev/null and b/public/icons/empty.png differ