diff --git a/.env b/.env index 245811c..3dac4a9 100644 --- a/.env +++ b/.env @@ -9,11 +9,11 @@ REACT_APP_APPSITE="https://myfitapp.mermsemr.com" # REACT_APP_AUX_ENDPOINT="http://10.20.30.32:9083/svs/user" # REACT_APP_USERS_ENDPOINT="http://10.20.30.32:9083/svs/user" -REACT_APP_AUX_ENDPOINT="https://apigate.lotus.g1.wrenchboard.com/svs/user" -REACT_APP_USERS_ENDPOINT="https://apigate.lotus.g1.wrenchboard.com/svs/user" +#REACT_APP_AUX_ENDPOINT="https://apigate.lotus.g1.wrenchboard.com/svs/user" +#REACT_APP_USERS_ENDPOINT="https://apigate.lotus.g1.wrenchboard.com/svs/user" -#REACT_APP_AUX_ENDPOINT="https://apigate.lotus.g1.wrenchboard.com/en/wrench/api/v1" -#REACT_APP_USERS_ENDPOINT="https://apigate.lotus.g1.wrenchboard.com/en/wrench/api/v1" +REACT_APP_AUX_ENDPOINT="https://apigate.lotus.g1.wrenchboard.com/en/wrench/api/v1" +REACT_APP_USERS_ENDPOINT="https://apigate.lotus.g1.wrenchboard.com/en/wrench/api/v1" #"https://devapi.mermsemr.com/en/desktop/api/v2/myfituser" diff --git a/.env.development b/.env.development index 95c0a38..e7d957e 100644 --- a/.env.development +++ b/.env.development @@ -9,11 +9,11 @@ REACT_APP_APPSITE="https://myfitapp.mermsemr.com" # REACT_APP_AUX_ENDPOINT="http://10.20.30.32:9083/svs/user" # REACT_APP_USERS_ENDPOINT="http://10.20.30.32:9083/svs/user" -REACT_APP_AUX_ENDPOINT="https://apigate.lotus.g1.wrenchboard.com/svs/user" -REACT_APP_USERS_ENDPOINT="https://apigate.lotus.g1.wrenchboard.com/svs/user" +# REACT_APP_AUX_ENDPOINT="https://apigate.lotus.g1.wrenchboard.com/svs/user" +# REACT_APP_USERS_ENDPOINT="https://apigate.lotus.g1.wrenchboard.com/svs/user" -#REACT_APP_AUX_ENDPOINT="https://apigate.lotus.g1.wrenchboard.com/en/wrench/api/v1" -#REACT_APP_USERS_ENDPOINT="https://apigate.lotus.g1.wrenchboard.com/en/wrench/api/v1" +REACT_APP_AUX_ENDPOINT="https://apigate.lotus.g1.wrenchboard.com/en/wrench/api/v1" +REACT_APP_USERS_ENDPOINT="https://apigate.lotus.g1.wrenchboard.com/en/wrench/api/v1" #"https://devapi.mermsemr.com/en/desktop/api/v2/myfituser" diff --git a/src/components/Cards/AvailableJobsCard.jsx b/src/components/Cards/AvailableJobsCard.jsx index a76ae0b..25f0a66 100644 --- a/src/components/Cards/AvailableJobsCard.jsx +++ b/src/components/Cards/AvailableJobsCard.jsx @@ -125,7 +125,7 @@ export default function AvailableJobsCard({

( {datas.offer_code}) | - {datas.timeline_days} day(s) ago + {datas.timeline_days} day(s)

diff --git a/src/components/Helpers/Inputs/InputCom/index.jsx b/src/components/Helpers/Inputs/InputCom/index.jsx index c924a19..f05dd0d 100644 --- a/src/components/Helpers/Inputs/InputCom/index.jsx +++ b/src/components/Helpers/Inputs/InputCom/index.jsx @@ -51,11 +51,16 @@ export default function InputCom({ htmlFor={name} > {label} - {spanTag && ( + {spanTag && + spanTag == '*' ? + + {' '}{spanTag} + + : {spanTag} - )} + } )} {forgotPassword && ( diff --git a/src/components/MyWallet/AddFund.jsx b/src/components/MyWallet/AddFund.jsx index faf4003..92e4e31 100644 --- a/src/components/MyWallet/AddFund.jsx +++ b/src/components/MyWallet/AddFund.jsx @@ -1,15 +1,18 @@ import React, {useState} from 'react' import RecentActivityTable from './WalletComponent/RecentActivityTable' import LoadingSpinner from '../Spinners/LoadingSpinner' -import { useNavigate } from 'react-router-dom' +import { useNavigate, useLocation } from 'react-router-dom' import InputCom from '../Helpers/Inputs/InputCom' +import AddFundDollars from './AddFundDollars' + function AddFund({payment}) { const navigate = useNavigate() + const {currency} = useLocation()?.state //GETS THE USER CURRENCY FOR ADD FUND //STATE FOR CONTROLLED INPUT - let [input, setInput] = useState('0') + let [input, setInput] = useState('') let [inputError, setInputError] = useState('') @@ -23,15 +26,15 @@ function AddFund({payment}) { setInputError('') if(!input || input == '0'){ setInputError('Please Enter Amount') - return + return setTimeout(()=>{setInputError('')}, 5000) } if(isNaN(input)){ setInputError('Amount must be a Number') - return + return setTimeout(()=>{setInputError('')}, 5000) } - const stateData = {amount: Number(input)} + const stateData = {amount: Number(input), currency: 'naira'} navigate('confirm-add-fund', {state: stateData}) setInput('') @@ -79,18 +82,27 @@ function AddFund({payment}) {
{inputError &&

{inputError}

}

+ + {/* SHOWS THIS IF USER CURRENCY IS DOLLARS */} + {currency == 'US Dollars' && +
+ +
+ } + + {/* HIDES THIS BUTTON IF CURENCY IS NAIRA */} + {currency != 'US Dollars' &&
+ } + {/* HIDES THIS SECTION IF CURENCY IS NAIRA */} + {currency != 'US Dollars' &&
@@ -117,6 +132,7 @@ function AddFund({payment}) {
+ } ) } diff --git a/src/components/MyWallet/AddFundDollars.jsx b/src/components/MyWallet/AddFundDollars.jsx new file mode 100644 index 0000000..c79980a --- /dev/null +++ b/src/components/MyWallet/AddFundDollars.jsx @@ -0,0 +1,462 @@ +import React,{useState} from 'react' +import { useNavigate } from 'react-router-dom' +import InputCom from '../Helpers/Inputs/InputCom'; +import PaginatedList from '../Pagination/PaginatedList'; +import { handlePagingFunc } from '../Pagination/HandlePagination'; + +import { Form, Formik } from "formik"; +import * as Yup from "yup"; + +const validationSchema = Yup.object().shape({ + name: Yup.string() + .min(3, "Minimum 3 characters") + .max(50, "Maximum 50 characters") + .required("Name is required"), + cardNum: Yup.string() + .min(3, "Minimum 3 characters") + .max(25, "Maximum 25 characters") + .required("Card Number is required"), + code: Yup.string() + .min(3, "Minimum 3 characters") + .max(25, "Maximum 25 characters") + .required("Postal Code is required"), + state: Yup.string() + .min(3, "Minimum 3 characters") + .max(25, "Maximum 25 characters") + .required("State is required"), + address: Yup.string() + .min(3, "Minimum 3 characters") + .max(50, "Maximum 50 characters") + .required("Address is required"), + expirationYear: Yup.string() + .min(4, "Minimum 4 characters") + .max(4, "Maximum 4 characters") + .required("Expiration Year is required"), + expirationMonth: Yup.string() + .min(1, "Minimum 1 characters") + .max(2, "Maximum 2 characters") + .required("Expiration Month is required"), + cvv: Yup.string() + .min(3, "Minimum 3 characters") + .max(4, "Maximum 4 characters") + .required("CVV Year is required"), +}); + +const initialValues = { + name: '', + cardNum: '', + code: '', + state: '', + address: '', + expirationYear: '', + expirationMonth: '', + cvv: '' + }; + + +function AddFundDollars(props) { + const navigate = useNavigate() + + let [tab, setTab] = useState("previous"); //STATE FOR SWITCHING BETWEEN TABS + + let [prevCardDetails, setPrevCardDetails] = useState(null) // STATE TO HOLD PREVIOUS CARD SELECTED + + let previousCards = {data:[1,2]} //USER PREVIOUS CARDS // TO BE REPLACED LATER FROM DATA FROM API + + const [currentPage, setCurrentPage] = useState(0); + const indexOfFirstItem = Number(currentPage); + const indexOfLastItem = Number(indexOfFirstItem)+Number(process.env.REACT_APP_ITEM_PER_PAGE); + const currentPreviousCards = previousCards?.data?.slice(indexOfFirstItem, indexOfLastItem); + + const handlePagination = (e) => { + handlePagingFunc(e,setCurrentPage) + } + + // FUNCTION TO SUBMIT + const handleSubmit = (values, helpers) => { + props.setInputError('') + if(!props.input || props.input == '0'){ + props.setInputError('Please Enter Amount') + return setTimeout(()=>{props.setInputError('')}, 5000) + } + + if(isNaN(props.input)){ + props.setInputError('Amount must be a Number') + return setTimeout(()=>{props.setInputError('')}, 5000) + } + if(tab == 'previous'){ + const stateData = {amount: Number(props.input), currency: 'dollars'} + navigate('confirm-add-fund', {state: stateData}) // State will change later dummy for now + } + if(tab == 'new'){ + const stateData = {amount: Number(props.input), currency: 'dollars', ...values} + navigate('confirm-add-fund', {state: stateData}) // State will change later dummy for now + } + props.setInput('') + } + + return ( + <> +

Payment Method

+
+ {/* switch button */} +
+ + +
+ {/* END OF switch button */} + + {/* previous tab */} + {tab == 'previous' ? +
+ {previousCards?.data?.length ? + + + {currentPreviousCards.map((item, index)=>( + + + + + )) + } + +
+
+ +
+

Master Card

+

Bank **************3535

+

Verified

+
+
+
+ +
+ : +
+

No Previous Card Found!

+ +
+ } + {/* PAGINATION BUTTON */} +
+ = previousCards?.data?.length ? true : false} data={previousCards?.data} start={indexOfFirstItem} stop={indexOfLastItem} /> +
+ {/* END OF PAGINATION BUTTON */} +
+ : +
+
+ + {(props) => { + return ( +
+
+
+
+ {/* inputs starts here */} + {/* Name */} +
+ + {props.errors.name && props.touched.name && ( +

+ {props.errors.name} +

+ )} +
+ + {/* CARD NUMBER */} +
+ + {props.errors.cardNum && props.touched.cardNum && ( +

+ {props.errors.cardNum} +

+ )} +
+ {/* EXPIRE YEAR, YEAR AND CVV */} +
+
+
+
+ +
+
+ +
+
+ {props.errors.expirationMonth && props.touched.expirationMonth && ( +

+ {props.errors.expirationMonth} +

+ )} +
+
+
+
+ +
+
+ +
+
+ {props.errors.expirationYear && props.touched.expirationYear && ( +

+ {props.errors.expirationYear} +

+ )} +
+
+ + {props.errors.cvv && props.touched.cvv && ( +

+ {props.errors.cvv} +

+ )} +
+
+ {/* Address */} +
+ + {props.errors.address && props.touched.address && ( +

+ {props.errors.address} +

+ )} +
+ {/* postal code and state */} +
+
+ + {props.errors.code && props.touched.code && ( +

+ {props.errors.code} +

+ )} +
+
+ + {props.errors.state && props.touched.state && ( +

+ {props.errors.state} +

+ )} +
+
+
+
+
+ + {/*
+ {requestStatus.message != "" && ( +

+ {requestStatus.message} +

+ )} +
+
+ + + {" "} + Cancel + + + + {requestStatus.loading ? ( + + ) : ( + + )} +
+
+
*/} +
+ +
+
+ ); + }} +
+
+
+ } +
+ { tab == 'previous' && +
+ +
+ } + + ) +} + +export default AddFundDollars + + +// FORMS ARRAY OF EXPIRATION YEAR FOR CARD +const expireYear = [] +let currentYear = new Date().getFullYear() +for(let i=0; i<=6; i++){ + expireYear.push(currentYear + i) +} + +// FORMS ARRAY OF EXPIRATION MONTH FOR CARD +let month = ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'] +const expireMonth = [] +for(let i=0; iTransfer:'' } - + { navigate("/my-wallet", { replace: true }); - window.location.reload(true); }, 1000); }) .catch((err) => { @@ -102,11 +101,11 @@ function ConfirmAddFund({ payment }) { }, []); return ( -
+
{pageLoading ? ( ) : ( -
+

Confirm Add Fund To Account @@ -116,7 +115,7 @@ function ConfirmAddFund({ payment }) {
- + : + + }

)} -
+

Recent Activity diff --git a/src/components/Referral/Index.jsx b/src/components/Referral/Index.jsx index c162b16..08af400 100644 --- a/src/components/Referral/Index.jsx +++ b/src/components/Referral/Index.jsx @@ -1,13 +1,13 @@ -import React from 'react' -import Layout from '../Partials/Layout' -import ReferralDisplay from './ReferralDisplay' +import React from "react"; +import Layout from "../Partials/Layout"; +import ReferralDisplay from "./ReferralDisplay"; function Referral() { return ( - + - ) + ); } -export default Referral \ No newline at end of file +export default Referral; diff --git a/src/components/Referral/ReferralDisplay.jsx b/src/components/Referral/ReferralDisplay.jsx index 8b962b2..dff6591 100644 --- a/src/components/Referral/ReferralDisplay.jsx +++ b/src/components/Referral/ReferralDisplay.jsx @@ -10,25 +10,25 @@ import * as Yup from "yup"; import ReferralTable from "../MyWallet/WalletComponent/ReferralTable"; const validationSchema = Yup.object().shape({ - email: Yup.string() + ref_email: Yup.string() .email("Wrong email format") .min(3, "Minimum 3 characters") .max(50, "Maximum 50 characters") .required("Email is required"), - firstname: Yup.string() + ref_firstname: Yup.string() .min(3, "Minimum 3 characters") .max(25, "Maximum 25 characters") .required("Firstname is required"), - lastname: Yup.string() + ref_lastname: Yup.string() .min(3, "Minimum 3 characters") .max(25, "Maximum 25 characters") .required("Lastname is required"), }); const initialValues = { - firstname: "", - lastname: "", - email: "", + ref_firstname: "", + ref_lastname: "", + ref_email: "", }; function ReferralDisplay() { @@ -120,12 +120,9 @@ function ReferralDisplay() {

- - Refer a Friend - + Refer a Friend

-
@@ -146,17 +143,18 @@ function ReferralDisplay() { fieldClass="px-6" label="Firstname" type="text" - name="firstname" + name="ref_firstname" placeholder="Firstname" - value={props.values.firstname} + value={props.values.ref_firstname} inputHandler={props.handleChange} blurHandler={props.handleBlur} /> - {props.errors.firstname && props.touched.firstname && ( -

- {props.errors.firstname} -

- )} + {props.errors.ref_firstname && + props.touched.ref_firstname && ( +

+ {props.errors.ref_firstname} +

+ )}
{/* Lastname */} @@ -165,17 +163,18 @@ function ReferralDisplay() { fieldClass="px-6" label="Lastname" type="text" - name="lastname" + name="ref_lastname" placeholder="Lastname" - value={props.values.lastname} + value={props.values.ref_lastname} inputHandler={props.handleChange} blurHandler={props.handleBlur} /> - {props.errors.lastname && props.touched.lastname && ( -

- {props.errors.lastname} -

- )} + {props.errors.ref_lastname && + props.touched.ref_lastname && ( +

+ {props.errors.ref_lastname} +

+ )}

@@ -184,14 +183,16 @@ function ReferralDisplay() { fieldClass="px-6" label="Email" type="text" - name="email" + name="ref_email" placeholder="Email" - value={props.values.email} + value={props.values.ref_email} inputHandler={props.handleChange} blurHandler={props.handleBlur} /> - {props.errors.email && props.touched.email && ( -

{props.errors.email}

+ {props.errors.ref_email && props.touched.ref_email && ( +

+ {props.errors.ref_email} +

)}
@@ -205,7 +206,8 @@ function ReferralDisplay() { ) : ( )} @@ -220,14 +222,12 @@ function ReferralDisplay() { Referral List {referralList.loading ? ( - + ) : ( - + )}
- -
); } diff --git a/src/index.css b/src/index.css index 5c79024..fce17af 100644 --- a/src/index.css +++ b/src/index.css @@ -51,8 +51,11 @@ font-weight: bolder; } .siderCardDescription{ - margin: 20px 45px 10px 45px; - font-size: 20px; + margin: 10px 45px 10px 45px; + font-size: 18px; + background-color: aliceblue; + padding: 5px; + border-radius: 5px; } .siderCardButton{ margin-top: 10px; diff --git a/src/views/ReferralPage.jsx b/src/views/ReferralPage.jsx index 8247e86..1430548 100644 --- a/src/views/ReferralPage.jsx +++ b/src/views/ReferralPage.jsx @@ -1,12 +1,12 @@ -import React from 'react' -import Referral from '../components/Referral/Index' +import React from "react"; +import Referral from "../components/Referral/Index"; function ReferralPage() { return ( <> - + - ) + ); } -export default ReferralPage \ No newline at end of file +export default ReferralPage;