Compare commits
16 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 11dc8fc659 | |||
| 77c538ca79 | |||
| 6b473b5dc6 | |||
| 6aa11793a5 | |||
| 4f8edc3998 | |||
| 7dd805b804 | |||
| 2aa1219ea9 | |||
| c1a17949f7 | |||
| 24302c7435 | |||
| 27f4fda129 | |||
| 7ddef6d52d | |||
| 187ac61396 | |||
| 31297efb5b | |||
| f8d6475ff8 | |||
| 22a45ac15e | |||
| 0489be5e69 |
|
After Width: | Height: | Size: 32 KiB |
|
After Width: | Height: | Size: 18 KiB |
|
After Width: | Height: | Size: 84 KiB |
|
After Width: | Height: | Size: 16 KiB |
|
After Width: | Height: | Size: 5.3 KiB |
|
After Width: | Height: | Size: 4.1 KiB |
|
After Width: | Height: | Size: 3.6 KiB |
|
After Width: | Height: | Size: 2.9 KiB |
|
After Width: | Height: | Size: 5.2 KiB |
|
After Width: | Height: | Size: 1.7 KiB |
|
After Width: | Height: | Size: 3.8 KiB |
|
After Width: | Height: | Size: 5.3 KiB |
|
After Width: | Height: | Size: 2.3 KiB |
|
After Width: | Height: | Size: 3.1 KiB |
|
After Width: | Height: | Size: 713 B |
|
After Width: | Height: | Size: 1.6 KiB |
|
After Width: | Height: | Size: 15 KiB |
@@ -0,0 +1 @@
|
|||||||
|
{"name":"","short_name":"","icons":[{"src":"/android-chrome-192x192.png","sizes":"192x192","type":"image/png"},{"src":"/android-chrome-512x512.png","sizes":"512x512","type":"image/png"}],"theme_color":"#ffffff","background_color":"#ffffff","display":"standalone"}
|
||||||
|
After Width: | Height: | Size: 45 KiB |
|
After Width: | Height: | Size: 59 KiB |
|
After Width: | Height: | Size: 64 KiB |
|
After Width: | Height: | Size: 28 KiB |
|
After Width: | Height: | Size: 64 KiB |
|
After Width: | Height: | Size: 50 KiB |
|
After Width: | Height: | Size: 48 KiB |
|
After Width: | Height: | Size: 54 KiB |
|
After Width: | Height: | Size: 51 KiB |
|
After Width: | Height: | Size: 65 KiB |
|
After Width: | Height: | Size: 31 KiB |
|
After Width: | Height: | Size: 172 KiB |
@@ -1,38 +1,67 @@
|
|||||||
import React, { useState } from "react";
|
import React, { useEffect, useState } from "react";
|
||||||
import { Link } from "react-router-dom";
|
import { Link, useNavigate } from "react-router-dom";
|
||||||
import Layout from "../Partials/Layout";
|
import Layout from "../Partials/Layout";
|
||||||
import CommonHead from "../UserHeader/CommonHead";
|
import CommonHead from "../UserHeader/CommonHead";
|
||||||
|
import usersService from "../../services/UsersService";
|
||||||
|
import LoadingSpinner from "../Spinners/LoadingSpinner";
|
||||||
|
|
||||||
export default function BlogItem(props) {
|
export default function BlogItem(props) {
|
||||||
|
|
||||||
|
const apiCall = new usersService()
|
||||||
|
const navigate = useNavigate()
|
||||||
|
|
||||||
|
const [blogdata, setBlogdata] = useState({loading: true, data:{}})
|
||||||
|
|
||||||
const [selectTab, setValue] = useState("today");
|
const [selectTab, setValue] = useState("today");
|
||||||
const filterHandler = (value) => {
|
const filterHandler = (value) => {
|
||||||
setValue(value);
|
setValue(value);
|
||||||
};
|
};
|
||||||
|
const queryParams = new URLSearchParams(location?.search);
|
||||||
|
const blog_id = queryParams.get("blog_id");
|
||||||
|
|
||||||
|
useEffect(()=>{
|
||||||
|
if(!blog_id){
|
||||||
|
navigate('/',{replace:true})
|
||||||
|
}
|
||||||
|
apiCall.getSingleBlogData({blog_id}).then(res => {
|
||||||
|
setBlogdata({loading: false, data:res.data})
|
||||||
|
}).catch(error => {
|
||||||
|
setBlogdata({loading: false, data:{}})
|
||||||
|
console.log('ERROR', error)
|
||||||
|
})
|
||||||
|
},[blog_id])
|
||||||
return (
|
return (
|
||||||
<Layout>
|
<Layout>
|
||||||
<CommonHead
|
<CommonHead
|
||||||
commonHeadData={props.commonHeadData}
|
commonHeadData={props.commonHeadData}
|
||||||
/>
|
/>
|
||||||
<div className="notification-page w-full mb-10">
|
<div className="notification-page w-full mb-10">
|
||||||
<div className="notification-wrapper w-full">
|
<div className="notification-wrapper w-full bg-white p-8">
|
||||||
{/* heading */}
|
{blogdata.loading ?
|
||||||
<div className="sm:flex justify-between items-center mb-6">
|
<LoadingSpinner size='8' color='sky-blue' height='h-[100px]' />
|
||||||
<div className="mb-5 sm:mb-0">
|
:
|
||||||
<h1 className="text-26 font-bold text-dark-gray dark:text-white">
|
blogdata?.data?.blogdata && blogdata.data?.blogdata.length ?
|
||||||
<span
|
<div className="w-full">
|
||||||
className={`${selectTab === "today" ? "block" : "hidden"}`}
|
{/* heading */}
|
||||||
>
|
<div className="sm:flex justify-between items-center mb-6">
|
||||||
Title of this Blog Items
|
<div className="mb-5 sm:mb-0">
|
||||||
</span>
|
<h1 className="text-26 font-bold text-dark-gray dark:text-white">
|
||||||
</h1>
|
<span
|
||||||
</div>
|
className={`${selectTab === "today" ? "block" : "hidden"}`}
|
||||||
<div className="slider-btns flex space-x-4">
|
>
|
||||||
|
{blogdata.data?.blogdata?.[0]?.post_title}
|
||||||
</div>
|
</span>
|
||||||
|
</h1>
|
||||||
|
</div>
|
||||||
|
{/* <div className="slider-btns flex space-x-4">
|
||||||
|
</div> */}
|
||||||
|
</div>
|
||||||
|
<div dangerouslySetInnerHTML={{__html: blogdata.data?.blogdata?.[0]?.post_content}}>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div>
|
:
|
||||||
Blog Items Details need implenet
|
<h1 className="text-26 font-bold text-dark-gray dark:text-white">No Blog Found!</h1>
|
||||||
</div>
|
}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</Layout>
|
</Layout>
|
||||||
|
|||||||
@@ -91,8 +91,8 @@ export default function InputCom({
|
|||||||
placeholder={placeholder}
|
placeholder={placeholder}
|
||||||
value={value}
|
value={value}
|
||||||
onChange={inputHandler}
|
onChange={inputHandler}
|
||||||
className={`input-field placeholder:text-base text-dark-gray w-full h-full tracking-wide ${
|
className={`input-field placeholder:text-base text-dark-gray w-full h-full ${
|
||||||
inputBg ? inputBg : "bg-[#FAFAFA]"
|
inputBg ? inputBg : "bg-[#FAFAFA] tracking-wide"
|
||||||
} dark:bg-[#11131F] focus:ring-0 focus:outline-none ${fieldClass}`}
|
} dark:bg-[#11131F] focus:ring-0 focus:outline-none ${fieldClass}`}
|
||||||
type={type}
|
type={type}
|
||||||
id={name}
|
id={name}
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ export default function SearchCom({
|
|||||||
placeholder,
|
placeholder,
|
||||||
handleSearch,
|
handleSearch,
|
||||||
value,
|
value,
|
||||||
|
name,
|
||||||
}) {
|
}) {
|
||||||
return (
|
return (
|
||||||
<div
|
<div
|
||||||
@@ -22,6 +23,7 @@ export default function SearchCom({
|
|||||||
className={`w-full h-full focus:outline-0 focus:ring-0 dark:bg-dark-white dark:text-white ${
|
className={`w-full h-full focus:outline-0 focus:ring-0 dark:bg-dark-white dark:text-white ${
|
||||||
inputClasses || ""
|
inputClasses || ""
|
||||||
}`}
|
}`}
|
||||||
|
name={name}
|
||||||
type="text"
|
type="text"
|
||||||
onInput={handleSearch}
|
onInput={handleSearch}
|
||||||
value={value}
|
value={value}
|
||||||
|
|||||||
@@ -2,6 +2,11 @@ import React from "react";
|
|||||||
|
|
||||||
function CompleteConfirmCredit({ onClose, confirmCredit }) {
|
function CompleteConfirmCredit({ onClose, confirmCredit }) {
|
||||||
const { data } = confirmCredit;
|
const { data } = confirmCredit;
|
||||||
|
|
||||||
|
const backToWallet = () => {
|
||||||
|
onClose();
|
||||||
|
window.location.reload(true);
|
||||||
|
};
|
||||||
return (
|
return (
|
||||||
<div className="logout-modal-body w-full flex flex-col items-center">
|
<div className="logout-modal-body w-full flex flex-col items-center">
|
||||||
<div className="content-wrapper w-full h-[32rem]">
|
<div className="content-wrapper w-full h-[32rem]">
|
||||||
@@ -99,7 +104,7 @@ function CompleteConfirmCredit({ onClose, confirmCredit }) {
|
|||||||
<div className="md:p-8 p-4 add-fund-btn flex justify-end items-center py-4 gap-4">
|
<div className="md:p-8 p-4 add-fund-btn flex justify-end items-center py-4 gap-4">
|
||||||
<button
|
<button
|
||||||
className="px-4 h-11 flex justify-center items-center btn-gradient text-white text-base rounded-full w-[100px]"
|
className="px-4 h-11 flex justify-center items-center btn-gradient text-white text-base rounded-full w-[100px]"
|
||||||
onClick={onClose}
|
onClick={backToWallet}
|
||||||
>
|
>
|
||||||
Ok
|
Ok
|
||||||
</button>
|
</button>
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import { FlutterWaveButton, closePaymentModal } from "flutterwave-react-v3";
|
import { FlutterWaveButton, closePaymentModal } from "flutterwave-react-v3";
|
||||||
import React, { useState } from "react";
|
import React, { useState } from "react";
|
||||||
import { useDispatch } from "react-redux";
|
import { useDispatch, useSelector } from "react-redux";
|
||||||
import { useNavigate } from "react-router-dom";
|
import { useNavigate } from "react-router-dom";
|
||||||
import { toast } from "react-toastify";
|
import { toast } from "react-toastify";
|
||||||
import usersService from "../../../services/UsersService";
|
import usersService from "../../../services/UsersService";
|
||||||
@@ -99,6 +99,9 @@ function ConfirmAddFund({
|
|||||||
: __confirmData.card;
|
: __confirmData.card;
|
||||||
|
|
||||||
const apiURL = new usersService();
|
const apiURL = new usersService();
|
||||||
|
|
||||||
|
const { userDetails } = useSelector((state) => state?.userDetails);
|
||||||
|
|
||||||
const navigate = useNavigate();
|
const navigate = useNavigate();
|
||||||
const dispatch = useDispatch();
|
const dispatch = useDispatch();
|
||||||
|
|
||||||
@@ -112,7 +115,13 @@ function ConfirmAddFund({
|
|||||||
public_key: process.env.REACT_APP_FLUTTERWAVE_APIKEY,
|
public_key: process.env.REACT_APP_FLUTTERWAVE_APIKEY,
|
||||||
tx_ref: Date.now(),
|
tx_ref: Date.now(),
|
||||||
currency: "NGN",
|
currency: "NGN",
|
||||||
|
amount: Number(__confirmData.amount),
|
||||||
payment_options: "card,mobilemoney,ussd",
|
payment_options: "card,mobilemoney,ussd",
|
||||||
|
customer: {
|
||||||
|
email: userDetails.email,
|
||||||
|
phone_number: userDetails.phone,
|
||||||
|
name: `${userDetails.lastname} ${userDetails.firstname}`,
|
||||||
|
},
|
||||||
customizations: {
|
customizations: {
|
||||||
title: "WrenchBoard",
|
title: "WrenchBoard",
|
||||||
description: "Topup Payment",
|
description: "Topup Payment",
|
||||||
@@ -132,7 +141,7 @@ function ConfirmAddFund({
|
|||||||
|
|
||||||
const onSuccessPayment = () => {
|
const onSuccessPayment = () => {
|
||||||
setRequestStatus({ message: "", loading: true, status: false });
|
setRequestStatus({ message: "", loading: true, status: false });
|
||||||
const reqData = { amount: __confirmData?.account, currency: "NGN" };
|
const reqData = { amount: Number(__confirmData?.amount), currency: "NGN" };
|
||||||
|
|
||||||
apiURL
|
apiURL
|
||||||
.startTopUp(reqData)
|
.startTopUp(reqData)
|
||||||
@@ -151,9 +160,12 @@ function ConfirmAddFund({
|
|||||||
status: true,
|
status: true,
|
||||||
});
|
});
|
||||||
toast.success("Account Topup was successful");
|
toast.success("Account Topup was successful");
|
||||||
setTimeout(() => {
|
onClose()
|
||||||
navigate("/my-wallet", { replace: true });
|
dispatch(tableReload({ type: "WALLETTABLE" }));
|
||||||
}, 1000);
|
navigate("/my-wallet", { replace: true });
|
||||||
|
// setTimeout(() => {
|
||||||
|
// navigate("/my-wallet", { replace: true });
|
||||||
|
// }, 1000);
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
.catch((err) => {
|
.catch((err) => {
|
||||||
@@ -205,6 +217,7 @@ function ConfirmAddFund({
|
|||||||
},
|
},
|
||||||
data: _response,
|
data: _response,
|
||||||
}));
|
}));
|
||||||
|
dispatch(tableReload({ type: "WALLETTABLE" }));
|
||||||
}, 1500);
|
}, 1500);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
setConfirmCredit((prev) => ({
|
setConfirmCredit((prev) => ({
|
||||||
@@ -256,7 +269,6 @@ function ConfirmAddFund({
|
|||||||
}
|
}
|
||||||
|
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
dispatch(tableReload({ type: "WALLETTABLE" }));
|
|
||||||
setConfirmCredit((prev) => ({
|
setConfirmCredit((prev) => ({
|
||||||
...prev,
|
...prev,
|
||||||
show: {
|
show: {
|
||||||
@@ -265,6 +277,7 @@ function ConfirmAddFund({
|
|||||||
},
|
},
|
||||||
data: _response,
|
data: _response,
|
||||||
}));
|
}));
|
||||||
|
dispatch(tableReload({ type: "WALLETTABLE" }));
|
||||||
}, 1500);
|
}, 1500);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
setConfirmCredit((prev) => ({
|
setConfirmCredit((prev) => ({
|
||||||
@@ -278,8 +291,6 @@ function ConfirmAddFund({
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
// console.log(confirmCredit?.data);
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="content-wrapper w-full h-[32rem]">
|
<div className="content-wrapper w-full h-[32rem]">
|
||||||
<div className="w-full mb-10">
|
<div className="w-full mb-10">
|
||||||
|
|||||||
@@ -1,15 +1,20 @@
|
|||||||
import React, { useState } from "react";
|
import { useState } from "react";
|
||||||
import { useNavigate } from "react-router-dom";
|
import { useNavigate } from "react-router-dom";
|
||||||
import { toast } from "react-toastify";
|
import { toast } from "react-toastify";
|
||||||
|
import usersService from "../../../services/UsersService";
|
||||||
import InputCom from "../../Helpers/Inputs/InputCom";
|
import InputCom from "../../Helpers/Inputs/InputCom";
|
||||||
import ModalCom from "../../Helpers/ModalCom";
|
import ModalCom from "../../Helpers/ModalCom";
|
||||||
import LoadingSpinner from "../../Spinners/LoadingSpinner";
|
import LoadingSpinner from "../../Spinners/LoadingSpinner";
|
||||||
|
|
||||||
import usersService from "../../../services/UsersService";
|
function ConfirmNairaWithdraw({
|
||||||
|
payment,
|
||||||
function ConfirmNairaWithdraw({ payment, wallet, action, situation, state }) {
|
wallet,
|
||||||
|
action,
|
||||||
|
situation,
|
||||||
|
state,
|
||||||
|
setShowNairaWithdraw,
|
||||||
|
}) {
|
||||||
const apiURL = new usersService();
|
const apiURL = new usersService();
|
||||||
|
|
||||||
const navigate = useNavigate();
|
const navigate = useNavigate();
|
||||||
|
|
||||||
let [requestStatus, setRequestStatus] = useState({
|
let [requestStatus, setRequestStatus] = useState({
|
||||||
@@ -17,7 +22,6 @@ function ConfirmNairaWithdraw({ payment, wallet, action, situation, state }) {
|
|||||||
loading: false,
|
loading: false,
|
||||||
status: false,
|
status: false,
|
||||||
});
|
});
|
||||||
let [pageLoading, setPageLoading] = useState(true);
|
|
||||||
|
|
||||||
//FUNCTION TO HANDLE SUBMIT
|
//FUNCTION TO HANDLE SUBMIT
|
||||||
const handleSubmit = () => {
|
const handleSubmit = () => {
|
||||||
@@ -25,19 +29,68 @@ function ConfirmNairaWithdraw({ payment, wallet, action, situation, state }) {
|
|||||||
let reqData = {
|
let reqData = {
|
||||||
amount: Number(state.amount * 100),
|
amount: Number(state.amount * 100),
|
||||||
Fee: Number(state.fee),
|
Fee: Number(state.fee),
|
||||||
recipient_uid: Number(state.details?.recipient_uid),
|
|
||||||
wallet_uid: wallet.wallet_uid,
|
wallet_uid: wallet.wallet_uid,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
if (state?.choice === "prev") {
|
||||||
|
reqData.recipient_uid = state.details?.recipient_uid;
|
||||||
|
reqData.mode = 100;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (state?.choice === "new") {
|
||||||
|
reqData.account_no = state?.details?.accountNumber;
|
||||||
|
reqData.account_type = Number(state?.details?.accountType);
|
||||||
|
reqData.bank_uid = state?.details?.bank_uid;
|
||||||
|
reqData.country = state?.details?.country;
|
||||||
|
reqData.state = state?.details?.state;
|
||||||
|
reqData.city = state?.details?.city;
|
||||||
|
reqData.mode = 500;
|
||||||
|
}
|
||||||
|
|
||||||
apiURL
|
apiURL
|
||||||
.sendMoney(reqData)
|
.sendMoney(reqData)
|
||||||
.then((res) => {
|
.then((res) => {
|
||||||
if (res.data.internal_return < 0) {
|
if (res.data.internal_return < 0) {
|
||||||
setRequestStatus({
|
if (res.data?.status_message?.toLowerCase().includes("limit")) {
|
||||||
message: "Could not perform transaction",
|
setRequestStatus({
|
||||||
loading: false,
|
message: "You have exceeded the transfer limit",
|
||||||
status: false,
|
loading: false,
|
||||||
});
|
status: false,
|
||||||
return;
|
});
|
||||||
|
} else if (
|
||||||
|
res.data?.status_message?.toLowerCase().includes("not_found")
|
||||||
|
) {
|
||||||
|
setRequestStatus({
|
||||||
|
message: "Sorry, wallet not found",
|
||||||
|
loading: false,
|
||||||
|
status: false,
|
||||||
|
});
|
||||||
|
} else if (
|
||||||
|
res.data?.status_message
|
||||||
|
?.toLowerCase()
|
||||||
|
.includes("recipient_add_error")
|
||||||
|
) {
|
||||||
|
setRequestStatus({
|
||||||
|
message: res.data?.error,
|
||||||
|
loading: false,
|
||||||
|
status: false,
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
setRequestStatus({
|
||||||
|
message: "Could not perform transaction",
|
||||||
|
loading: false,
|
||||||
|
status: false,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
return setTimeout(
|
||||||
|
() =>
|
||||||
|
setRequestStatus({
|
||||||
|
message: "",
|
||||||
|
loading: false,
|
||||||
|
status: false,
|
||||||
|
}),
|
||||||
|
1500
|
||||||
|
);
|
||||||
}
|
}
|
||||||
setRequestStatus({
|
setRequestStatus({
|
||||||
message: "transfer successful",
|
message: "transfer successful",
|
||||||
@@ -59,7 +112,13 @@ function ConfirmNairaWithdraw({ payment, wallet, action, situation, state }) {
|
|||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
console.log(state)
|
const getBack = () => {
|
||||||
|
action();
|
||||||
|
setShowNairaWithdraw({
|
||||||
|
show: true,
|
||||||
|
data: {},
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<ModalCom action={action} situation={situation} className="edit-popup">
|
<ModalCom action={action} situation={situation} className="edit-popup">
|
||||||
@@ -115,17 +174,40 @@ function ConfirmNairaWithdraw({ payment, wallet, action, situation, state }) {
|
|||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{/* RECIPIENT ACC: */}
|
{state?.choice === "prev" && (
|
||||||
<div className="field w-full mb-3">
|
<>
|
||||||
<InputCom
|
{/* RECIPIENT ACC: */}
|
||||||
fieldClass="px-6"
|
<div className="field w-full mb-3">
|
||||||
label="Recipient Acc:"
|
<InputCom
|
||||||
type="text"
|
fieldClass="px-6"
|
||||||
name="recipient"
|
label="Recipient Acc:"
|
||||||
value={state?.details.recipient || ""}
|
type="text"
|
||||||
disable={true}
|
name="recipient"
|
||||||
/>
|
value={state?.details?.recipient || ""}
|
||||||
</div>
|
disable={true}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
</>
|
||||||
|
)}
|
||||||
|
|
||||||
|
{state?.choice === "new" && (
|
||||||
|
<>
|
||||||
|
{/* RECIPIENT ACC: */}
|
||||||
|
<div className="field w-full mb-3">
|
||||||
|
<InputCom
|
||||||
|
fieldClass="px-6"
|
||||||
|
label="Bank Acc:"
|
||||||
|
type="text"
|
||||||
|
name="bank"
|
||||||
|
value={
|
||||||
|
`${state?.details?.name} ${state?.details?.country}` ||
|
||||||
|
""
|
||||||
|
}
|
||||||
|
disable={true}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
</>
|
||||||
|
)}
|
||||||
|
|
||||||
{/* PROCESSING FEE: */}
|
{/* PROCESSING FEE: */}
|
||||||
<div className="field w-full mb-3">
|
<div className="field w-full mb-3">
|
||||||
@@ -165,33 +247,33 @@ function ConfirmNairaWithdraw({ payment, wallet, action, situation, state }) {
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<hr />
|
<hr />
|
||||||
{requestStatus.message && (
|
<p
|
||||||
<p
|
className={`text-base ${
|
||||||
className={`text-base ${
|
requestStatus.status ? "text-green-500" : "text-red-500"
|
||||||
requestStatus.status ? "text-green-500" : "text-red-500"
|
} px-4 md:px-8 py-4 h-5`}
|
||||||
} px-4 md:px-8 py-4`}
|
>
|
||||||
>
|
{requestStatus.message && requestStatus.message}
|
||||||
{requestStatus.message}
|
</p>
|
||||||
</p>
|
|
||||||
)}
|
|
||||||
<div className="px-4 md:px-8 py-4 add-fund-btn flex justify-end items-center gap-2">
|
<div className="px-4 md:px-8 py-4 add-fund-btn flex justify-end items-center gap-2">
|
||||||
<button
|
<button
|
||||||
type="button"
|
type="button"
|
||||||
onClick={action}
|
onClick={state?.choice === "prev" ? getBack : action}
|
||||||
className="border-gradient text-base tracking-wide px-4 py-2 rounded-full"
|
className="border-gradient text-base tracking-wide px-4 py-2 rounded-full"
|
||||||
>
|
>
|
||||||
<span className="text-gradient">Cancel</span>
|
<span className="text-gradient">
|
||||||
|
{state?.choice === "prev" ? "Back" : "Cancel"}
|
||||||
|
</span>
|
||||||
|
</button>
|
||||||
|
<button
|
||||||
|
onClick={handleSubmit}
|
||||||
|
className="btn-gradient text-base tracking-wide px-4 py-2 rounded-full text-white cursor-pointer min-w-[100px]"
|
||||||
|
>
|
||||||
|
{requestStatus.loading ? (
|
||||||
|
<LoadingSpinner size="6" color="sky-blue" />
|
||||||
|
) : (
|
||||||
|
"Transfer"
|
||||||
|
)}
|
||||||
</button>
|
</button>
|
||||||
{requestStatus.loading ? (
|
|
||||||
<LoadingSpinner size="8" color="sky-blue" />
|
|
||||||
) : (
|
|
||||||
<button
|
|
||||||
onClick={handleSubmit}
|
|
||||||
className="btn-gradient text-base tracking-wide px-4 py-2 rounded-full text-white cursor-pointer"
|
|
||||||
>
|
|
||||||
Transfer
|
|
||||||
</button>
|
|
||||||
)}
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -6,32 +6,33 @@ import InputCom from "../../Helpers/Inputs/InputCom";
|
|||||||
import ModalCom from "../../Helpers/ModalCom";
|
import ModalCom from "../../Helpers/ModalCom";
|
||||||
import LoadingSpinner from "../../Spinners/LoadingSpinner";
|
import LoadingSpinner from "../../Spinners/LoadingSpinner";
|
||||||
|
|
||||||
const initialValues = {
|
|
||||||
amount: "",
|
|
||||||
comment: "",
|
|
||||||
previousAccount: {
|
|
||||||
recipientID: "",
|
|
||||||
},
|
|
||||||
newAccount: {
|
|
||||||
country: "",
|
|
||||||
bank: "",
|
|
||||||
accountNumber: "",
|
|
||||||
accountType: "",
|
|
||||||
state: "",
|
|
||||||
city: "",
|
|
||||||
},
|
|
||||||
};
|
|
||||||
|
|
||||||
function NairaWithdraw({
|
function NairaWithdraw({
|
||||||
wallet,
|
wallet,
|
||||||
action,
|
action,
|
||||||
situation,
|
situation,
|
||||||
|
state,
|
||||||
setShowConfirmNairaWithdraw,
|
setShowConfirmNairaWithdraw,
|
||||||
}) {
|
}) {
|
||||||
const apiCall = new usersService(); // API CLASS CALL
|
const apiCall = new usersService();
|
||||||
const navigate = useNavigate();
|
|
||||||
const [tab, setTab] = useState("previous");
|
const [tab, setTab] = useState("previous");
|
||||||
let [requestStatus, setRequestStatus] = useState(false);
|
let [requestStatus, setRequestStatus] = useState(false);
|
||||||
|
|
||||||
|
const initialValues = {
|
||||||
|
amount: state?.amount || "",
|
||||||
|
comment: state?.comment || "",
|
||||||
|
previousAccount: {
|
||||||
|
recipientID: state?.previousAccount?.recipientID || "",
|
||||||
|
},
|
||||||
|
newAccount: {
|
||||||
|
country: state?.newAccount?.amount || "",
|
||||||
|
bank: state?.newAccount?.amount || "",
|
||||||
|
accountNumber: state?.newAccount?.amount || "",
|
||||||
|
accountType: state?.newAccount?.amount || "",
|
||||||
|
state: state?.newAccount?.amount || "",
|
||||||
|
city: state?.newAccount?.amount || "",
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
const [errorMsgs, setErrorMsgs] = useState(initialValues);
|
const [errorMsgs, setErrorMsgs] = useState(initialValues);
|
||||||
|
|
||||||
let [sendMoneyFee, setSendMoneyFee] = useState({
|
let [sendMoneyFee, setSendMoneyFee] = useState({
|
||||||
@@ -65,7 +66,7 @@ function NairaWithdraw({
|
|||||||
|
|
||||||
// Handling card change
|
// Handling card change
|
||||||
const handleBankOptions = (event) => {
|
const handleBankOptions = (event) => {
|
||||||
const { name, value } = event.target;
|
const { value } = event.target;
|
||||||
setBankName((prev) => ({ loading: true, data: [] }));
|
setBankName((prev) => ({ loading: true, data: [] }));
|
||||||
apiCall
|
apiCall
|
||||||
.getCountryBank({ country: value })
|
.getCountryBank({ country: value })
|
||||||
@@ -167,13 +168,9 @@ function NairaWithdraw({
|
|||||||
//FUNCTION TO HANDLE SUBMIT
|
//FUNCTION TO HANDLE SUBMIT
|
||||||
const handleSubmit = async (values, helpers) => {
|
const handleSubmit = async (values, helpers) => {
|
||||||
try {
|
try {
|
||||||
// Validate the form using Yup validation schema
|
|
||||||
// await validationSchema.validate(values, { abortEarly: false });
|
|
||||||
// If validation passes, proceed with form submission
|
|
||||||
console.log("Form data is valid!", values);
|
|
||||||
if (!values?.amount) {
|
if (!values?.amount) {
|
||||||
setErrorMsgs({ amount: "Please enter an amount" });
|
setErrorMsgs({ amount: "amount required" });
|
||||||
setTimeout(() => setErrorMsgs({ amount: "" }), 1000);
|
setTimeout(() => setErrorMsgs({ amount: "" }), 3000);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (values?.comment?.length >= 50) {
|
if (values?.comment?.length >= 50) {
|
||||||
@@ -210,12 +207,13 @@ function NairaWithdraw({
|
|||||||
const stateData = {
|
const stateData = {
|
||||||
amount: values.amount,
|
amount: values.amount,
|
||||||
comment: values.comment,
|
comment: values.comment,
|
||||||
|
choice: "prev",
|
||||||
wallet_uid: wallet.wallet_uid,
|
wallet_uid: wallet.wallet_uid,
|
||||||
...sendMoneyFee,
|
...sendMoneyFee,
|
||||||
details: { ...recipientDetails[0] },
|
details: { ...recipientDetails[0] },
|
||||||
};
|
};
|
||||||
|
|
||||||
setTimeout(() => {
|
return setTimeout(() => {
|
||||||
setRequestStatus(false);
|
setRequestStatus(false);
|
||||||
// navigate("confirm-withdraw-naira", { state: stateData });
|
// navigate("confirm-withdraw-naira", { state: stateData });
|
||||||
action();
|
action();
|
||||||
@@ -226,11 +224,50 @@ function NairaWithdraw({
|
|||||||
if (tab === "new") {
|
if (tab === "new") {
|
||||||
const { accountNumber, accountType, bank, city, country, state } =
|
const { accountNumber, accountType, bank, city, country, state } =
|
||||||
values?.newAccount;
|
values?.newAccount;
|
||||||
|
|
||||||
|
if (
|
||||||
|
!accountNumber ||
|
||||||
|
!accountType ||
|
||||||
|
!bank ||
|
||||||
|
!city ||
|
||||||
|
!country ||
|
||||||
|
!state
|
||||||
|
) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
setRequestStatus(true);
|
||||||
|
|
||||||
|
// Ensure bankDetails is an array and not undefined
|
||||||
|
const bankDetails = bankName.data?.filter(
|
||||||
|
(item) => item.bank_uid === bank
|
||||||
|
);
|
||||||
|
|
||||||
|
// Ensure bankDetails is not empty
|
||||||
|
if (!bankDetails || bankDetails.length === 0) {
|
||||||
|
// Handle the case when bankDetails is empty or undefined
|
||||||
|
setRequestStatus(false);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
const stateData = {
|
||||||
|
amount: values.amount,
|
||||||
|
comment: values.comment,
|
||||||
|
choice: "new",
|
||||||
|
wallet_uid: wallet.wallet_uid,
|
||||||
|
...sendMoneyFee,
|
||||||
|
details: { ...bankDetails[0], ...values?.newAccount },
|
||||||
|
};
|
||||||
|
|
||||||
|
return setTimeout(() => {
|
||||||
|
setRequestStatus(false);
|
||||||
|
action();
|
||||||
|
setShowConfirmNairaWithdraw({ show: true, state: stateData });
|
||||||
|
}, 1000);
|
||||||
}
|
}
|
||||||
} catch (errors) {
|
} catch (errors) {
|
||||||
// If validation fails, handle the validation errors
|
// If validation fails, handle the validation errors
|
||||||
throw new Error("Validation errors:", errors);
|
throw new Error("Validation errors:", errors);
|
||||||
//
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -275,11 +312,7 @@ function NairaWithdraw({
|
|||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
<div className="add-fund w-full md:p-8 p-4 bg-white dark:bg-dark-white h-full rounded-2xl">
|
<div className="add-fund w-full md:p-8 p-4 bg-white dark:bg-dark-white h-full rounded-2xl">
|
||||||
<Formik
|
<Formik initialValues={initialValues} onSubmit={handleSubmit}>
|
||||||
initialValues={initialValues}
|
|
||||||
// validationSchema={validationSchema}
|
|
||||||
onSubmit={handleSubmit}
|
|
||||||
>
|
|
||||||
{(props) => {
|
{(props) => {
|
||||||
return (
|
return (
|
||||||
<Form className="transfer-fund-info">
|
<Form className="transfer-fund-info">
|
||||||
@@ -289,8 +322,8 @@ function NairaWithdraw({
|
|||||||
<InputCom
|
<InputCom
|
||||||
fieldClass="px-4"
|
fieldClass="px-4"
|
||||||
parentClass="flex items-center gap-1 justify-between"
|
parentClass="flex items-center gap-1 justify-between"
|
||||||
labelClass="flex-[0.2] mb-0"
|
labelClass="flex-[0.3] mb-0"
|
||||||
inputClass="flex-[0.8] max-w-[12rem]"
|
inputClass="flex-[0.7] max-w-[12rem]"
|
||||||
label="Amount:"
|
label="Amount:"
|
||||||
type="number"
|
type="number"
|
||||||
name="amount"
|
name="amount"
|
||||||
@@ -301,12 +334,8 @@ function NairaWithdraw({
|
|||||||
blurHandler={(e) => {
|
blurHandler={(e) => {
|
||||||
getSendMoneyFee(e);
|
getSendMoneyFee(e);
|
||||||
}}
|
}}
|
||||||
|
error={errorMsgs.amount && errorMsgs.amount}
|
||||||
/>
|
/>
|
||||||
{errorMsgs?.amount && (
|
|
||||||
<p className="sm:text-sm text-[12px] text-red-500 sm:text-left text-right sm:translate-y-0 translate-y-1">
|
|
||||||
{errorMsgs.amount}
|
|
||||||
</p>
|
|
||||||
)}
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div className="field w-full">
|
<div className="field w-full">
|
||||||
@@ -485,7 +514,7 @@ function NairaWithdraw({
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div className="h-[7.6rem]"></div>
|
<div className="h-[7.8rem]"></div>
|
||||||
</>
|
</>
|
||||||
)}
|
)}
|
||||||
|
|
||||||
@@ -503,12 +532,13 @@ function NairaWithdraw({
|
|||||||
<span className="text-red-500">*</span>
|
<span className="text-red-500">*</span>
|
||||||
</label>
|
</label>
|
||||||
<select
|
<select
|
||||||
className="w-full text-base p-2 text-dark-gray dark:text-white border border-slate-300 outline-0 flex-[0.6] rounded-full h-[42px] overflow-hidden relative font-medium leading-6 bg-clip-padding"
|
className="w-full text-base p-2 text-dark-gray dark:text-white border border-slate-300 outline-0 flex-[0.6] rounded-full h-[42px] overflow-hidden relative font-medium leading-6 bg-clip-padding tracking-[1.5px]"
|
||||||
name="newAccount.country"
|
name="newAccount.country"
|
||||||
value={props.values.newAccount?.country}
|
value={props.values.newAccount?.country}
|
||||||
onChange={
|
onChange={(e) => {
|
||||||
props.handleChange || handleBankOptions
|
props.handleChange(e);
|
||||||
}
|
handleBankOptions(e);
|
||||||
|
}}
|
||||||
>
|
>
|
||||||
{allCountries.loading ? (
|
{allCountries.loading ? (
|
||||||
<option
|
<option
|
||||||
@@ -558,7 +588,7 @@ function NairaWithdraw({
|
|||||||
<div className="add-recipient w-full flex items-center flex-1">
|
<div className="add-recipient w-full flex items-center flex-1">
|
||||||
<label
|
<label
|
||||||
htmlFor="newAccount.bank"
|
htmlFor="newAccount.bank"
|
||||||
className="input-label text-[#181c32] dark:text-white text-base font-semibold inline-flex flex-[0.4]"
|
className="input-label text-[#181c32] dark:text-white text-base font-semibold inline-flex flex-[0.4] tracking-[1.5px]"
|
||||||
>
|
>
|
||||||
Bank Name{" "}
|
Bank Name{" "}
|
||||||
<span className="text-red-500">*</span>
|
<span className="text-red-500">*</span>
|
||||||
@@ -589,7 +619,7 @@ function NairaWithdraw({
|
|||||||
<option
|
<option
|
||||||
key={index}
|
key={index}
|
||||||
className="text-slate-500 text-lg"
|
className="text-slate-500 text-lg"
|
||||||
value={item.code}
|
value={item.bank_uid}
|
||||||
>
|
>
|
||||||
{item.name}
|
{item.name}
|
||||||
</option>
|
</option>
|
||||||
@@ -623,11 +653,12 @@ function NairaWithdraw({
|
|||||||
<span className="text-red-500">*</span>
|
<span className="text-red-500">*</span>
|
||||||
</label>
|
</label>
|
||||||
<InputCom
|
<InputCom
|
||||||
fieldClass="px-6"
|
fieldClass="px-6 tracking-[1.5px]"
|
||||||
inputClass="flex items-center max-w-[15rem]"
|
inputClass="flex items-center max-w-[15rem]"
|
||||||
type="text"
|
type="text"
|
||||||
name="newAccount.accountNumber"
|
name="newAccount.accountNumber"
|
||||||
placeholder="Account No"
|
placeholder="Account No"
|
||||||
|
maxLength={10}
|
||||||
value={props.values.newAccount?.accountNumber}
|
value={props.values.newAccount?.accountNumber}
|
||||||
inputHandler={props.handleChange}
|
inputHandler={props.handleChange}
|
||||||
blurHandler={props.handleBlur}
|
blurHandler={props.handleBlur}
|
||||||
@@ -649,7 +680,7 @@ function NairaWithdraw({
|
|||||||
Type <span className="text-red-500">*</span>
|
Type <span className="text-red-500">*</span>
|
||||||
</label>
|
</label>
|
||||||
<select
|
<select
|
||||||
className="w-full text-base p-2 text-dark-gray dark:text-white border border-slate-300 outline-0 flex-[0.6] rounded-full h-[42px] overflow-hidden relative font-medium leading-6 bg-clip-padding flex-grow"
|
className="w-full text-base p-2 text-dark-gray dark:text-white border border-slate-300 outline-0 flex-[0.6] rounded-full h-[42px] overflow-hidden relative font-medium leading-6 bg-clip-padding flex-grow tracking-[1.5px]"
|
||||||
name="newAccount.accountType"
|
name="newAccount.accountType"
|
||||||
value={props.values.newAccount?.accountType}
|
value={props.values.newAccount?.accountType}
|
||||||
onChange={props.handleChange}
|
onChange={props.handleChange}
|
||||||
@@ -708,7 +739,7 @@ function NairaWithdraw({
|
|||||||
State <span className="text-red-500">*</span>
|
State <span className="text-red-500">*</span>
|
||||||
</label>
|
</label>
|
||||||
<InputCom
|
<InputCom
|
||||||
fieldClass="px-6"
|
fieldClass="px-6 tracking-[1.5px]"
|
||||||
inputClass="max-w-[10rem]"
|
inputClass="max-w-[10rem]"
|
||||||
type="text"
|
type="text"
|
||||||
name="newAccount.state"
|
name="newAccount.state"
|
||||||
@@ -733,7 +764,7 @@ function NairaWithdraw({
|
|||||||
City <span className="text-red-500">*</span>
|
City <span className="text-red-500">*</span>
|
||||||
</label>
|
</label>
|
||||||
<InputCom
|
<InputCom
|
||||||
fieldClass="px-6"
|
fieldClass="px-6 tracking-[1.5px]"
|
||||||
type="text"
|
type="text"
|
||||||
inputClass="max-w-[10rem]"
|
inputClass="max-w-[10rem]"
|
||||||
name="newAccount.city"
|
name="newAccount.city"
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ import LoadingSpinner from "../Spinners/LoadingSpinner";
|
|||||||
const WalletBox = lazy(() => import("./WalletBox"));
|
const WalletBox = lazy(() => import("./WalletBox"));
|
||||||
|
|
||||||
const WalletRoutes = () => {
|
const WalletRoutes = () => {
|
||||||
const apiCall = useMemo(() => new usersService(), []);
|
const apiCall = new usersService();
|
||||||
const { walletTable } = useSelector((state) => state.tableReload);
|
const { walletTable } = useSelector((state) => state.tableReload);
|
||||||
const [walletList, setWalletList] = useState({
|
const [walletList, setWalletList] = useState({
|
||||||
loading: true,
|
loading: true,
|
||||||
@@ -25,29 +25,23 @@ const WalletRoutes = () => {
|
|||||||
data: [],
|
data: [],
|
||||||
});
|
});
|
||||||
|
|
||||||
const getWalletList = useCallback(() => {
|
const getWalletList = () => {
|
||||||
return apiCall
|
apiCall
|
||||||
.getUserWallets()
|
.getUserWallets()
|
||||||
.then((res) => {
|
.then((res) => {
|
||||||
if (res.data.internal_return < 0) {
|
if (res.data.internal_return < 0) {
|
||||||
setWalletList({ loading: false, data: [] });
|
setWalletList({ loading: false, data: [] });
|
||||||
} else {
|
} else {
|
||||||
setWalletList({ loading: true, data: [] });
|
setWalletList({ loading: false, data: res.data?.result_list });
|
||||||
|
|
||||||
setTimeout(
|
|
||||||
() =>
|
|
||||||
setWalletList({ loading: false, data: res.data?.result_list }),
|
|
||||||
500
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
.catch(() => {
|
.catch(() => {
|
||||||
setWalletList({ loading: false, data: [] });
|
setWalletList({ loading: false, data: [] });
|
||||||
});
|
});
|
||||||
}, [apiCall]);
|
}
|
||||||
|
|
||||||
const getPaymentHistory = useCallback(() => {
|
const getPaymentHistory = () => {
|
||||||
return apiCall
|
apiCall
|
||||||
.getPaymentHx()
|
.getPaymentHx()
|
||||||
.then((res) => {
|
.then((res) => {
|
||||||
if (res.data.internal_return < 0) {
|
if (res.data.internal_return < 0) {
|
||||||
@@ -59,19 +53,23 @@ const WalletRoutes = () => {
|
|||||||
.catch(() => {
|
.catch(() => {
|
||||||
setPaymentHistory({ loading: false, data: [] });
|
setPaymentHistory({ loading: false, data: [] });
|
||||||
});
|
});
|
||||||
}, [apiCall]);
|
}
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
const fetchData = async () => {
|
// const fetchData = async () => {
|
||||||
await Promise.all([getWalletList(), getPaymentHistory()]);
|
// await Promise.all([getWalletList(), getPaymentHistory()]);
|
||||||
};
|
// };
|
||||||
|
|
||||||
if (walletList.loading) {
|
// if (walletList.loading) {
|
||||||
fetchData();
|
// fetchData();
|
||||||
}
|
// }
|
||||||
}, [walletTable, walletList.loading]);
|
getWalletList()
|
||||||
|
getPaymentHistory()
|
||||||
|
}, [walletTable]);
|
||||||
|
|
||||||
console.log(walletTable);
|
|
||||||
|
|
||||||
|
console.log('TESTING',walletTable);
|
||||||
return (
|
return (
|
||||||
<Layout>
|
<Layout>
|
||||||
<Suspense fallback={<LoadingSpinner size="16" color="sky-blue" />}>
|
<Suspense fallback={<LoadingSpinner size="16" color="sky-blue" />}>
|
||||||
|
|||||||
@@ -1,10 +1,13 @@
|
|||||||
import React, { useCallback, useState } from "react";
|
import React, { useCallback, useState } from "react";
|
||||||
|
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 usersService from "../../services/UsersService";
|
|
||||||
|
|
||||||
function WalletAction({ walletItem, payment, openPopUp }) {
|
function WalletAction({ walletItem, payment, openPopUp }) {
|
||||||
const [showNairaWithdraw, setShowNairaWithdraw] = useState(false); // DETERMINES WHEN NAIRA WITHDRAWAL POPS UP
|
const [showNairaWithdraw, setShowNairaWithdraw] = useState({
|
||||||
|
show: false,
|
||||||
|
state: {},
|
||||||
|
}); // DETERMINES WHEN NAIRA WITHDRAWAL POPS UP
|
||||||
const [countries, setCountries] = useState([]);
|
const [countries, setCountries] = useState([]);
|
||||||
const [showConfirmNairaWithdraw, setShowConfirmNairaWithdraw] = useState({
|
const [showConfirmNairaWithdraw, setShowConfirmNairaWithdraw] = useState({
|
||||||
show: false,
|
show: false,
|
||||||
@@ -34,7 +37,7 @@ function WalletAction({ walletItem, payment, openPopUp }) {
|
|||||||
<div className="w-1/2 flex justify-center items-center">
|
<div className="w-1/2 flex justify-center items-center">
|
||||||
<button
|
<button
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
setShowNairaWithdraw(true);
|
setShowNairaWithdraw((prev) => ({ ...prev, show: true }));
|
||||||
}}
|
}}
|
||||||
className={`${
|
className={`${
|
||||||
walletItem.code != "NAIRA" && "invisible"
|
walletItem.code != "NAIRA" && "invisible"
|
||||||
@@ -57,13 +60,17 @@ function WalletAction({ walletItem, payment, openPopUp }) {
|
|||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{showNairaWithdraw && (
|
{showNairaWithdraw.show && (
|
||||||
<NairaWithdraw
|
<NairaWithdraw
|
||||||
wallet={walletItem}
|
wallet={walletItem}
|
||||||
action={() => {
|
action={() => {
|
||||||
setShowNairaWithdraw((prev) => !prev);
|
setShowNairaWithdraw((prev) => ({
|
||||||
|
...prev,
|
||||||
|
show: !prev.show,
|
||||||
|
}));
|
||||||
}}
|
}}
|
||||||
situation={showNairaWithdraw}
|
situation={showNairaWithdraw.show}
|
||||||
|
state={showNairaWithdraw.state}
|
||||||
setShowConfirmNairaWithdraw={setShowConfirmNairaWithdraw}
|
setShowConfirmNairaWithdraw={setShowConfirmNairaWithdraw}
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
@@ -78,6 +85,7 @@ function WalletAction({ walletItem, payment, openPopUp }) {
|
|||||||
show: !prev.show,
|
show: !prev.show,
|
||||||
}));
|
}));
|
||||||
}}
|
}}
|
||||||
|
setShowNairaWithdraw={setShowNairaWithdraw}
|
||||||
situation={showConfirmNairaWithdraw.show}
|
situation={showConfirmNairaWithdraw.show}
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
|
|||||||
@@ -35,7 +35,6 @@ export default function Notification() {
|
|||||||
const indexOfLastItem = Number(indexOfFirstItem) + Number(process.env.REACT_APP_ITEM_PER_PAGE);
|
const indexOfLastItem = Number(indexOfFirstItem) + Number(process.env.REACT_APP_ITEM_PER_PAGE);
|
||||||
const currentNotifications = notificationData?.slice(indexOfFirstItem, indexOfLastItem);
|
const currentNotifications = notificationData?.slice(indexOfFirstItem, indexOfLastItem);
|
||||||
|
|
||||||
console.log('TESTING', currentNotifications)
|
|
||||||
const filterHandler = (value) => {
|
const filterHandler = (value) => {
|
||||||
setValue(value);
|
setValue(value);
|
||||||
switch(value){
|
switch(value){
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import React, { useContext, useEffect, useMemo, useState } from "react";
|
import React, { useContext, useEffect, useMemo, useState } from "react";
|
||||||
import { Link, useLocation } from "react-router-dom";
|
import { Link, useLocation, useNavigate } from "react-router-dom";
|
||||||
import bank1 from "../../assets/images/bank-1.png";
|
import bank1 from "../../assets/images/bank-1.png";
|
||||||
import bank2 from "../../assets/images/bank-2.png";
|
import bank2 from "../../assets/images/bank-2.png";
|
||||||
import bank3 from "../../assets/images/bank-3.png";
|
import bank3 from "../../assets/images/bank-3.png";
|
||||||
@@ -26,9 +26,11 @@ export default function Header({ logoutModalHandler, sidebarHandler }) {
|
|||||||
const [moneyPopup, setPopup] = useToggle(false);
|
const [moneyPopup, setPopup] = useToggle(false);
|
||||||
const darkMode = useContext(DarkModeContext);
|
const darkMode = useContext(DarkModeContext);
|
||||||
const { userDetails } = useSelector((state) => state?.userDetails);
|
const { userDetails } = useSelector((state) => state?.userDetails);
|
||||||
|
const { walletTable } = useSelector((state) => state.tableReload); // DETERMINES WHEN WALLET RELOADS
|
||||||
const [myWalletList, setMyWalletList] = useState([]);
|
const [myWalletList, setMyWalletList] = useState([]);
|
||||||
const api = useMemo(() => new usersService(), []);
|
const api = useMemo(() => new usersService(), []);
|
||||||
const dispatch = useDispatch();
|
const dispatch = useDispatch();
|
||||||
|
const navigate = useNavigate()
|
||||||
|
|
||||||
const { notifications } = useSelector((state) => state?.notifications); // NOTIFICATION STORE
|
const { notifications } = useSelector((state) => state?.notifications); // NOTIFICATION STORE
|
||||||
|
|
||||||
@@ -43,7 +45,7 @@ export default function Header({ logoutModalHandler, sidebarHandler }) {
|
|||||||
};
|
};
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
getMyWalletList();
|
getMyWalletList();
|
||||||
}, []);
|
}, [walletTable]);
|
||||||
|
|
||||||
const handlerBalance = () => {
|
const handlerBalance = () => {
|
||||||
setbalanceValue.toggle();
|
setbalanceValue.toggle();
|
||||||
@@ -317,9 +319,14 @@ export default function Header({ logoutModalHandler, sidebarHandler }) {
|
|||||||
<Link
|
<Link
|
||||||
to="/notification"
|
to="/notification"
|
||||||
className="text-purple text-sm font-medium"
|
className="text-purple text-sm font-medium"
|
||||||
|
onClick={handlerNotification}
|
||||||
>
|
>
|
||||||
See all Notification
|
See all Notification
|
||||||
</Link>
|
</Link>
|
||||||
|
{/* <button className="text-purple text-sm font-medium" onClick={()=>{
|
||||||
|
handlerNotification()
|
||||||
|
navigate('/notification', {replace: true})
|
||||||
|
}}>See all Notification</button> */}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -1,9 +1,65 @@
|
|||||||
|
import { useEffect, useState } from "react";
|
||||||
|
|
||||||
import ProductCardStyleTwo from "../../Cards/ProductCardStyleTwo";
|
import ProductCardStyleTwo from "../../Cards/ProductCardStyleTwo";
|
||||||
import DataIteration from "../../Helpers/DataIteration";
|
import DataIteration from "../../Helpers/DataIteration";
|
||||||
import SearchCom from "../../Helpers/SearchCom";
|
import SearchCom from "../../Helpers/SearchCom";
|
||||||
import localImgLoad from "../../../lib/localImgLoad";
|
import localImgLoad from "../../../lib/localImgLoad";
|
||||||
|
|
||||||
|
import usersService from "../../../services/UsersService";
|
||||||
|
import LoadingSpinner from "../../Spinners/LoadingSpinner";
|
||||||
|
|
||||||
export default function QuestionsTab({ className, products }) {
|
export default function QuestionsTab({ className, products }) {
|
||||||
|
const apiCall = new usersService()
|
||||||
|
|
||||||
|
const [requestStatus, setRequestStatus] = useState({loading: false, status: false, message: ''})
|
||||||
|
|
||||||
|
const [error, setError] = useState({question: '', searchPhrase: ''})
|
||||||
|
|
||||||
|
const [questions, setQuestions] = useState({loading: true, data: []})
|
||||||
|
|
||||||
|
const [askQuestion, setAskQuestion] = useState({question: '', searchPhrase: ''})
|
||||||
|
|
||||||
|
const changeAskQuestion = ({target: {name, value}}) => {
|
||||||
|
setAskQuestion(prev => ({...prev, [name]: value}))
|
||||||
|
setRequestStatus({loading: false, status: false, message: ''})
|
||||||
|
}
|
||||||
|
|
||||||
|
const onSearch = () => {
|
||||||
|
setError({question: '', searchPhrase: ''}) // sets error to false
|
||||||
|
if(!askQuestion.question){
|
||||||
|
return setError(prev => ({...prev, question: 'Select a question'}))
|
||||||
|
}
|
||||||
|
if(!askQuestion.searchPhrase){
|
||||||
|
return setError(prev => ({...prev, searchPhrase: 'Enter search parameter'}))
|
||||||
|
}
|
||||||
|
if(askQuestion.searchPhrase.length > 60){
|
||||||
|
return setError(prev => ({...prev, searchPhrase: 'Max of 60 characters'}))
|
||||||
|
}
|
||||||
|
|
||||||
|
setRequestStatus({loading: true, status: false, message: ''})
|
||||||
|
let reqData = {
|
||||||
|
question_key: '',
|
||||||
|
question: ''
|
||||||
|
}
|
||||||
|
apiCall.askResourcesResult().then(res => {
|
||||||
|
console.log(res.data.choices[0].text)
|
||||||
|
if(!res.data || res.data?.choices?.length < 1){
|
||||||
|
setRequestStatus({loading: false, status: false, message: 'No result found!'})
|
||||||
|
}
|
||||||
|
setRequestStatus({loading: false, status: false, message: res.data?.choices[0].text})
|
||||||
|
}).catch(error => {
|
||||||
|
setRequestStatus({loading: false, status: false, message: 'No result found!'})
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
useEffect(()=>{
|
||||||
|
apiCall.getResourceList().then(res => {
|
||||||
|
setQuestions({loading: false, data: res.data?.ask_categories?.data})
|
||||||
|
}).catch(error => {
|
||||||
|
setQuestions({loading: false, data: []})
|
||||||
|
console.log('ERROR', error)
|
||||||
|
})
|
||||||
|
}, [])
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<div className={`onsale-tab-wrapper w-full ${className || ""}`}>
|
<div className={`onsale-tab-wrapper w-full ${className || ""}`}>
|
||||||
@@ -16,29 +72,49 @@ export default function QuestionsTab({ className, products }) {
|
|||||||
</div>
|
</div>
|
||||||
<div className="p-8 bg-white rounded-2xl h-full">
|
<div className="p-8 bg-white rounded-2xl h-full">
|
||||||
<div className="input-wrapper border border-[#f5f8fa] dark:border-[#5e6278] w-full rounded-full h-[42px] overflow-hidden relative font-medium leading-6 bg-clip-padding text-[#5e6278] dark:text-gray-100 bg-[#f5f8fa] dark:bg-[#5e6278] text-base">
|
<div className="input-wrapper border border-[#f5f8fa] dark:border-[#5e6278] w-full rounded-full h-[42px] overflow-hidden relative font-medium leading-6 bg-clip-padding text-[#5e6278] dark:text-gray-100 bg-[#f5f8fa] dark:bg-[#5e6278] text-base">
|
||||||
<select className="input-field px-2 placeholder:text-base text-dark-gray w-full h-full tracking-wide dark:bg-[#11131F] bg-[#fafafa] focus:ring-0 focus:outline-none">
|
<select value={askQuestion.question} name='question' onChange={changeAskQuestion} className="input-field px-2 placeholder:text-base text-dark-gray w-full h-full tracking-wide dark:bg-[#11131F] bg-[#fafafa] focus:ring-0 focus:outline-none">
|
||||||
<option className="rounded-full">Find answer on:</option>
|
{questions.loading ?
|
||||||
|
<option value='' className="">Loading...</option>
|
||||||
|
:
|
||||||
|
<>
|
||||||
|
<option value='' className="">Find answer on:</option>
|
||||||
|
{questions.data.length > 0 && questions.data.map((item, index)=>(
|
||||||
|
<option key={index} value={item.question_key} className="">{item.name}</option>
|
||||||
|
))}
|
||||||
|
</>
|
||||||
|
}
|
||||||
|
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
|
{error.question && <p className="text-red-500 text-[12px]">{error.question}</p>}
|
||||||
{/* filter-search */}
|
{/* filter-search */}
|
||||||
<div className="w-full my-5 border-2 rounded-full">
|
<div className="w-full my-5 border-2 rounded-full">
|
||||||
<SearchCom />
|
<SearchCom
|
||||||
|
name={'searchPhrase'}
|
||||||
|
value={askQuestion.searchPhrase}
|
||||||
|
handleSearch={changeAskQuestion}
|
||||||
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
{error.searchPhrase && <p className="text-red-500 text-[12px]">{error.searchPhrase}</p>}
|
||||||
<div className="w-full flex justify-end items-center border-b-2 pb-4">
|
<div className="w-full flex justify-end items-center border-b-2 pb-4">
|
||||||
<button
|
<button
|
||||||
|
onClick={onSearch}
|
||||||
|
disabled={requestStatus.loading}
|
||||||
className="btn-gradient text-base tracking-wide px-4 py-2 rounded-full text-white cursor-pointer"
|
className="btn-gradient text-base tracking-wide px-4 py-2 rounded-full text-white cursor-pointer"
|
||||||
>
|
>
|
||||||
Search
|
Search
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
|
<div className="search_result my-2 max-h-[400px] overflow-auto">
|
||||||
|
{requestStatus.loading ?
|
||||||
|
<LoadingSpinner size='8' color='sky-blue' height='h-[100px]' />
|
||||||
|
:
|
||||||
|
<p className="py-2 text-sm font-bold text-dark-gray dark:text-white tracking-wide">{requestStatus.message}</p>
|
||||||
|
}
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
{/* <div className="content-section w-full-width">
|
|
||||||
<div className="grid lg:grid-cols-3 sm:grid-cols-2 grid-cols-1 gap-[30px]">
|
|
||||||
</div>
|
|
||||||
</div> */}
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</>
|
</>
|
||||||
|
|||||||
@@ -100,7 +100,7 @@ export default function RecomendedSliders({ className, bannerData }) {
|
|||||||
<div className="slider-content">
|
<div className="slider-content">
|
||||||
<SliderCom settings={settings} selector={sellSlider}>
|
<SliderCom settings={settings} selector={sellSlider}>
|
||||||
{bannerData.map((item, index) => (
|
{bannerData.map((item, index) => (
|
||||||
<Link key={index} to={`/${item.link_path}`}>
|
<Link key={index} to={item.link_path == 'blog-page' ? `/${item.link_path}?blog_id=${item.blog_id}` : `/${item.link_path}`}>
|
||||||
<div className="item">
|
<div className="item">
|
||||||
<div
|
<div
|
||||||
className={`commonHeaderSliderItem flex gap-1 flex-col justify-between items-center ${item.short_style}`}
|
className={`commonHeaderSliderItem flex gap-1 flex-col justify-between items-center ${item.short_style}`}
|
||||||
|
|||||||
@@ -0,0 +1,21 @@
|
|||||||
|
const checkAndSetError = (field, value, setErrorFunc, errorMessage) => {
|
||||||
|
const isNotEmpty = () => {
|
||||||
|
if (!value) {
|
||||||
|
setErrorFunc({ [field]: errorMessage });
|
||||||
|
setTimeout(() => setErrorFunc({ [field]: "" }), 1000);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
const textCount = () => {
|
||||||
|
if (!value) {
|
||||||
|
setErrorFunc({ [field]: errorMessage });
|
||||||
|
setTimeout(() => setErrorFunc({ [field]: "" }), 1000);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
return { isNotEmpty, textCount };
|
||||||
|
};
|
||||||
|
|
||||||
|
export default checkAndSetError;
|
||||||
@@ -1,5 +1,13 @@
|
|||||||
import ClearCookies from "./ClearCookies";
|
import ClearCookies from "./ClearCookies";
|
||||||
|
import checkAndSetError from "./checkAndSetError";
|
||||||
|
import formattedDate from "./fomattedDate";
|
||||||
import getTimeAgo from "./getTimeAgo";
|
import getTimeAgo from "./getTimeAgo";
|
||||||
import localImgLoad from "./localImgLoad";
|
import localImgLoad from "./localImgLoad";
|
||||||
|
|
||||||
export {ClearCookies, getTimeAgo, localImgLoad}
|
export {
|
||||||
|
ClearCookies,
|
||||||
|
checkAndSetError,
|
||||||
|
formattedDate,
|
||||||
|
getTimeAgo,
|
||||||
|
localImgLoad,
|
||||||
|
};
|
||||||
|
|||||||
@@ -411,6 +411,19 @@ class usersService {
|
|||||||
};
|
};
|
||||||
return this.postAuxEnd("/resources", postData);
|
return this.postAuxEnd("/resources", postData);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ASK QUESTION RESOURCES
|
||||||
|
askResourcesResult(reqData) {
|
||||||
|
var postData = {
|
||||||
|
uuid: localStorage.getItem("uid"),
|
||||||
|
member_id: localStorage.getItem("member_id"),
|
||||||
|
sessionid: localStorage.getItem("session_token"),
|
||||||
|
action: 22010,
|
||||||
|
...reqData,
|
||||||
|
};
|
||||||
|
return this.postAuxEnd("/askresources", postData);
|
||||||
|
}
|
||||||
|
|
||||||
getMyWiatingJobList() {
|
getMyWiatingJobList() {
|
||||||
// jobs you have shown inteterest in
|
// jobs you have shown inteterest in
|
||||||
var postData = {
|
var postData = {
|
||||||
@@ -480,7 +493,6 @@ class usersService {
|
|||||||
member_id: localStorage.getItem("member_id"),
|
member_id: localStorage.getItem("member_id"),
|
||||||
sessionid: localStorage.getItem("session_token"),
|
sessionid: localStorage.getItem("session_token"),
|
||||||
action: 33020,
|
action: 33020,
|
||||||
mode: 100,
|
|
||||||
...reqData,
|
...reqData,
|
||||||
};
|
};
|
||||||
return this.postAuxEnd("/sendmoney", postData);
|
return this.postAuxEnd("/sendmoney", postData);
|
||||||
@@ -992,6 +1004,18 @@ class usersService {
|
|||||||
return this.postAuxEnd("/payremcard", postData);
|
return this.postAuxEnd("/payremcard", postData);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// FUNCTION TO GET SINGLE BLOG ITEM
|
||||||
|
getSingleBlogData(reqData) {
|
||||||
|
var postData = {
|
||||||
|
uid: localStorage.getItem("uid"),
|
||||||
|
member_id: localStorage.getItem("member_id"),
|
||||||
|
sessionid: localStorage.getItem("session_token"),
|
||||||
|
limit: 4,
|
||||||
|
...reqData,
|
||||||
|
};
|
||||||
|
return this.postAuxEnd("/blogdata", postData);
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
- 20:27:30.118 FLOG_MAX [757411]: REQ_STRING(username)
|
- 20:27:30.118 FLOG_MAX [757411]: REQ_STRING(username)
|
||||||
- 20:27:30.118 FLOG_MAX [757411]: REQ_STRING(password)
|
- 20:27:30.118 FLOG_MAX [757411]: REQ_STRING(password)
|
||||||
|
|||||||