Compare commits
4 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 70ada36c00 | |||
| e6e41de965 | |||
| 0fbbf38d6c | |||
| 040c79e2e5 |
@@ -15,9 +15,10 @@ export default function MarketPlace({ commonHeadData }) {
|
|||||||
const marketData = jobLists?.result_list;
|
const marketData = jobLists?.result_list;
|
||||||
const categories = jobLists?.categories;
|
const categories = jobLists?.categories;
|
||||||
const image_server = jobLists?.session_image_server;
|
const image_server = jobLists?.session_image_server;
|
||||||
|
console.log('Lenth', marketData?.length )
|
||||||
|
|
||||||
useEffect(()=>{
|
useEffect(()=>{
|
||||||
if(marketData?.length < 1 && !jobLists.loading){
|
if(!jobLists.loading && (marketData?.length < 1 || !marketData)){
|
||||||
dispatch(tableReload({ type: "MARKETTABLELIST" })); // reloads market page
|
dispatch(tableReload({ type: "MARKETTABLELIST" })); // reloads market page
|
||||||
}
|
}
|
||||||
},[])
|
},[])
|
||||||
|
|||||||
@@ -1,11 +1,14 @@
|
|||||||
import React, { useEffect, useState } from "react";
|
import React, { useEffect, useState } from "react";
|
||||||
import { useSelector } from "react-redux";
|
import { useSelector, useDispatch } from "react-redux";
|
||||||
import usersService from "../../services/UsersService";
|
import usersService from "../../services/UsersService";
|
||||||
import Layout from "../Partials/Layout";
|
import Layout from "../Partials/Layout";
|
||||||
import LoadingSpinner from "../Spinners/LoadingSpinner";
|
import LoadingSpinner from "../Spinners/LoadingSpinner";
|
||||||
import WalletBox from "./WalletBox";
|
import WalletBox from "./WalletBox";
|
||||||
|
import { tableReload } from '../../store/TableReloads';
|
||||||
|
|
||||||
const WalletRoutes = () => {
|
const WalletRoutes = () => {
|
||||||
|
const dispatch = useDispatch()
|
||||||
|
|
||||||
const apiCall = new usersService();
|
const apiCall = new usersService();
|
||||||
const { walletDetails } = useSelector((state) => state?.walletDetails); // WALLET STORE
|
const { walletDetails } = useSelector((state) => state?.walletDetails); // WALLET STORE
|
||||||
const { walletTable } = useSelector((state) => state.tableReload);
|
const { walletTable } = useSelector((state) => state.tableReload);
|
||||||
@@ -60,6 +63,12 @@ const WalletRoutes = () => {
|
|||||||
getPaymentHistory();
|
getPaymentHistory();
|
||||||
}, [walletTable]);
|
}, [walletTable]);
|
||||||
|
|
||||||
|
useEffect(()=>{
|
||||||
|
if(!walletDetails.loading && walletDetails?.data?.length < 1){
|
||||||
|
dispatch(tableReload({ type: "WALLETTABLE" })); // reloads wallet page
|
||||||
|
}
|
||||||
|
},[])
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Layout>
|
<Layout>
|
||||||
<WalletBox
|
<WalletBox
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ import usersService from "../../services/UsersService";
|
|||||||
import ConfirmNairaWithdraw from "./Popup/ConfirmNairaWithdraw";
|
import ConfirmNairaWithdraw from "./Popup/ConfirmNairaWithdraw";
|
||||||
import NairaWithdraw from "./Popup/NairaWithdraw";
|
import NairaWithdraw from "./Popup/NairaWithdraw";
|
||||||
import VirtualAddCardPopout from "./walletvirtual/VirtualAddCardPopout";
|
import VirtualAddCardPopout from "./walletvirtual/VirtualAddCardPopout";
|
||||||
|
import WalletExtraActionBtn from "./WalletExtraActionBtn";
|
||||||
|
|
||||||
function WalletAction({ walletItem, payment, openPopUp }) {
|
function WalletAction({ walletItem, payment, openPopUp }) {
|
||||||
|
|
||||||
@@ -38,15 +39,27 @@ function WalletAction({ walletItem, payment, openPopUp }) {
|
|||||||
<div className="w-1/2 flex justify-start items-center">
|
<div className="w-1/2 flex justify-start items-center">
|
||||||
<button
|
<button
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
walletItem.code == 'NAIRA' ? setShowNairaWithdraw((prev) => ({ ...prev, show: true })) : openVirtualPopUp({walletItem})
|
walletItem?.code == 'NAIRA' ?
|
||||||
|
setShowNairaWithdraw((prev) => ({ ...prev, show: true }))
|
||||||
|
: walletItem?.code == 'USD' ?
|
||||||
|
openVirtualPopUp({walletItem})
|
||||||
|
:
|
||||||
|
()=>{}
|
||||||
}}
|
}}
|
||||||
className={`${
|
className={`${
|
||||||
walletItem.code != "NAIRA" && ""
|
walletItem?.code != "NAIRA" && ""
|
||||||
} logout-btn btn-gradient text-white`}
|
} logout-btn btn-gradient text-white`}
|
||||||
>
|
>
|
||||||
{/* Spend */}
|
{/* Spend */}
|
||||||
{walletItem.code == 'NAIRA' ? walletItem?.extra_actions?.SPEND_FROM_BALANCE[0]?.text : walletItem?.extra_actions?.ADD_VIRTUAL_CARD[0]?.text}
|
{walletItem?.code == 'NAIRA' ?
|
||||||
|
walletItem?.extra_actions?.SPEND_FROM_BALANCE[0]?.text
|
||||||
|
: walletItem?.code == 'USD' ?
|
||||||
|
walletItem?.extra_actions?.ADD_VIRTUAL_CARD[0]?.text
|
||||||
|
:
|
||||||
|
'View'
|
||||||
|
}
|
||||||
</button>
|
</button>
|
||||||
|
{/* <WalletExtraActionBtn /> // TO BE USED lATER */}
|
||||||
</div>
|
</div>
|
||||||
<div className="w-1/2 flex justify-end items-center">
|
<div className="w-1/2 flex justify-end items-center">
|
||||||
<button
|
<button
|
||||||
|
|||||||
@@ -0,0 +1,18 @@
|
|||||||
|
import React from 'react'
|
||||||
|
|
||||||
|
export default function WalletExtraActionBtn() {
|
||||||
|
return (
|
||||||
|
<>
|
||||||
|
{/* <button
|
||||||
|
onClick={() => {
|
||||||
|
walletItem?.code == 'NAIRA' ? setShowNairaWithdraw((prev) => ({ ...prev, show: true })) : openVirtualPopUp({walletItem})
|
||||||
|
}}
|
||||||
|
className={`${
|
||||||
|
walletItem?.code != "NAIRA" && ""
|
||||||
|
} logout-btn btn-gradient text-white`}
|
||||||
|
>
|
||||||
|
{walletItem?.code == 'NAIRA' ? walletItem?.extra_actions?.SPEND_FROM_BALANCE[0]?.text : walletItem?.extra_actions?.ADD_VIRTUAL_CARD[0]?.text}
|
||||||
|
</button> */}
|
||||||
|
</>
|
||||||
|
)
|
||||||
|
}
|
||||||
@@ -58,12 +58,27 @@ export default function WalletHeader(props) {
|
|||||||
props.myWalletList.map((value, index) =>
|
props.myWalletList.map((value, index) =>
|
||||||
{
|
{
|
||||||
let image = value.code ? `${value.code.toLocaleLowerCase()}.svg` : 'default.png'
|
let image = value.code ? `${value.code.toLocaleLowerCase()}.svg` : 'default.png'
|
||||||
|
|
||||||
return(
|
return(
|
||||||
<li
|
<li
|
||||||
key={index}
|
key={value?.wallet_uid || index}
|
||||||
className="content-item py-4 border-b dark:border-[#5356fb29] border-light-purple hover:border-purple dark:hover:border-purple"
|
className="content-item py-4 border-b dark:border-[#5356fb29] border-light-purple hover:border-purple dark:hover:border-purple"
|
||||||
onClick={onWalletClick}
|
onClick={onWalletClick}
|
||||||
>
|
>
|
||||||
|
{value?.brand && value?.card_last4 ? // FOR VIRTUAL CARD NUMBER ELSE WALLET BALANCE DISPLAY
|
||||||
|
<div className="w-full">
|
||||||
|
<div className="account-name flex space-x-4 items-center mb-2 sm:mb-0">
|
||||||
|
<div className="icon w-14 h-14 transition duration-300 ease-in-out rounded-full flex justify-center items-center bg-light-purple dark:bg-dark-light-purple ">
|
||||||
|
<img src={value.icon} className="w-14 h-14" alt="currency icon" />
|
||||||
|
</div>
|
||||||
|
<div className="name">
|
||||||
|
<p className="text-2xl font-bold text-dark-gray dark:text-white">
|
||||||
|
{value.brand} <span> **** **** ***** </span> {value?.card_last4}
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
:
|
||||||
<div className="sm:flex justify-between items-center">
|
<div className="sm:flex justify-between items-center">
|
||||||
<div className="account-name flex space-x-4 items-center mb-2 sm:mb-0">
|
<div className="account-name flex space-x-4 items-center mb-2 sm:mb-0">
|
||||||
<div className="icon w-14 h-14 transition duration-300 ease-in-out rounded-full flex justify-center items-center bg-light-purple dark:bg-dark-light-purple ">
|
<div className="icon w-14 h-14 transition duration-300 ease-in-out rounded-full flex justify-center items-center bg-light-purple dark:bg-dark-light-purple ">
|
||||||
@@ -81,6 +96,7 @@ export default function WalletHeader(props) {
|
|||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
}
|
||||||
</li>
|
</li>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -45,7 +45,7 @@ const VirtualAddCardPopout = ({ details, onClose, situation, walletItem }) => {
|
|||||||
|
|
||||||
const { userDetails } = useSelector((state) => state.userDetails);
|
const { userDetails } = useSelector((state) => state.userDetails);
|
||||||
|
|
||||||
const countryCode = userDetails?.country
|
const countryCode = walletItem?.country
|
||||||
|
|
||||||
const userApi = new usersService()
|
const userApi = new usersService()
|
||||||
|
|
||||||
|
|||||||
@@ -211,6 +211,7 @@ const AuthRoute = ({ redirectPath = "/login", children }) => {
|
|||||||
getMyJobList();
|
getMyJobList();
|
||||||
}, [jobListTable, isLogin.status]);
|
}, [jobListTable, isLogin.status]);
|
||||||
|
|
||||||
|
//FUNCTION TO GET FULL USER WALLETS
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if((!loggedIn && !isLogin.status) || account_type == 'FAMILY'){ // DO NOT CALL THIS, IF USER ACCOUNT TYPE IS FAMILY
|
if((!loggedIn && !isLogin.status) || account_type == 'FAMILY'){ // DO NOT CALL THIS, IF USER ACCOUNT TYPE IS FAMILY
|
||||||
return
|
return
|
||||||
|
|||||||
Reference in New Issue
Block a user