virtual card display and banner and popout fixed

This commit was merged in pull request #838.
This commit is contained in:
victorAnumudu
2024-11-02 20:24:15 +01:00
parent dd4239312d
commit 11e356cda6
11 changed files with 763 additions and 40 deletions
+2 -2
View File
@@ -50,7 +50,7 @@ const FamilyWalletCon = () => {
};
useEffect(() => {
getPaymentHistory();
// getPaymentHistory();
getFamilyWalletBal()
}, [walletTable]);
@@ -74,7 +74,7 @@ const FamilyWalletCon = () => {
}>
<FamilyWalletBox
wallet={familyWalletBal}
payment={paymentHistory}
// payment={paymentHistory}
/>
</Suspense>
</Layout>
+29 -23
View File
@@ -34,33 +34,39 @@ function WalletAction({ walletItem, payment, openPopUp }) {
state: {},
}); // DETERMINES WHEN CONFIRM NAIRA WITHDRAWAL POPS UP
// console.log('Extra Actions', Object.keys(walletItem.extra_actions))
let extraActions = Object.keys(walletItem.extra_actions) // VARIABLE TO HOLD EXTRA ACTIONS VALUES
return (
<div className="counters w-full flex justify-between gap-2">
{/* EXTRA ACTIONS BTN */}
<div className="w-1/2 flex justify-start items-center">
<button
onClick={() => {
walletItem?.code == 'NAIRA' ?
setShowNairaWithdraw((prev) => ({ ...prev, show: true }))
: walletItem?.code == 'USD' ?
openVirtualPopUp({walletItem})
:
()=>{}
}}
className={`${
walletItem?.code != "NAIRA" && ""
} logout-btn btn-gradient text-white`}
>
{/* Spend */}
{walletItem?.code == 'NAIRA' ?
walletItem?.extra_actions?.SPEND_FROM_BALANCE[0]?.text
: walletItem?.code == 'USD' ?
walletItem?.extra_actions?.ADD_VIRTUAL_CARD[0]?.text
:
'View'
}
</button>
{/* <WalletExtraActionBtn /> // TO BE USED lATER */}
{(extraActions && extraActions?.length > 0) &&
extraActions.map((action, index) => (
<div key={index}>
<button
onClick={() => {
action == 'SPEND_FROM_BALANCE' ?
setShowNairaWithdraw((prev) => ({ ...prev, show: true }))
: action == 'ADD_VIRTUAL_CARD' ?
openVirtualPopUp({walletItem})
:
null
}}
className={`${
walletItem?.code != "NAIRA" && ""
} logout-btn btn-gradient text-white`}
>
{/* Spend */}
{walletItem?.extra_actions?.[action][0]?.text}
</button>
{/* <WalletExtraActionBtn /> // TO BE USED lATER */}
</div>
))
}
</div>
<div className="w-1/2 flex justify-end items-center">
<button
className="logout-btn btn-gradient text-white"
@@ -62,6 +62,11 @@ export default function WalletItemCard({ walletItem, payment, countries }) {
<p className="text-base sm:text-lg text-white tracking-wide mb-2 sm:mb-6">
Current Balance
</p>
{walletItem?.brand && walletItem?.card_last4 ? // FOR VIRTUAL CARD NUMBER ELSE WALLET BALANCE DISPLAY
<p className="text-2xl font-bold text-white dark:text-white leading-10">
{walletItem.brand} <span> **** **** ***** </span> {walletItem?.card_last4}
</p>
:
<p className="text-[44px] lg:text-[62px] font-bold text-white tracking-wide leading-10">
{PriceFormatter(
walletItem.amount * 0.01,
@@ -70,6 +75,7 @@ export default function WalletItemCard({ walletItem, payment, countries }) {
"text-[2rem]"
)}
</p>
}
</div>
</div>
</div>
@@ -39,6 +39,8 @@ const validationSchema = Yup.object().shape({
.required("Required"),
dob: Yup.string()
.required("Required"),
checked: Yup.bool() // use bool instead of boolean
.oneOf([true], "You must accept the terms and conditions")
});
const VirtualAddCardPopout = ({ details, onClose, situation, walletItem }) => {
@@ -70,7 +72,8 @@ const VirtualAddCardPopout = ({ details, onClose, situation, walletItem }) => {
city: userDetails?.city ? userDetails.city : '',
state: '',
zipCode: '',
dob: ''
dob: '',
checked: false
};
@@ -96,6 +99,7 @@ const VirtualAddCardPopout = ({ details, onClose, situation, walletItem }) => {
// }
// }
// }
let date = new Date(values.dob)
const reqData = {
request_type: '100',
address: values.address,
@@ -107,9 +111,9 @@ const VirtualAddCardPopout = ({ details, onClose, situation, walletItem }) => {
// dob_day: values.birthDay,
// dob_month: values.birthMonth,
// dob_year: values.birthYear,
dob_day: Number(new Date(values.dob).getDate()),
dob_month: Number(new Date(values.dob).getMonth()) + 1,
dob_year: Number(new Date(values.dob).getFullYear()),
dob_day: Number(date.getDate()),
dob_month: Number(date.getMonth()) + 1,
dob_year: Number(date.getFullYear()),
dob: values.dob
}
// console.log('Values', reqData)
@@ -535,6 +539,20 @@ const VirtualAddCardPopout = ({ details, onClose, situation, walletItem }) => {
</div>
</div>
</div>
<div className='p-4 w-full job-label'>
<div className='flex gap-4 items-center'>
<input
type='checkbox'
name="checked"
className='accent-purple w-4 h-4 p-2 text-purple bg-gray-100 border-gray-300 rounded focus:ring-purple'
onChange={props.handleChange}
/>
<p className='text-[14px] text-justify'>
I agree with the <span className='text-bue-600'>cardholder </span>
terms & conditions {props.errors.checked && props.touched.checked && <span className='text-[12px] text-red-500'>{props.errors.checked}</span>}
</p>
</div>
</div>
{requestStatus.message &&
<div className='px-4 my-1'>
<p className={`text-center text-base py-1 font-bold ${requestStatus.status ? 'bg-emerald-600 text-white' : 'bg-red-100 text-red-600'}`}>{requestStatus.message}</p>