Compare commits
16 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 30642bba14 | |||
| f5921612b8 | |||
| 38afece043 | |||
| d44447c6b3 | |||
| d942c6641a | |||
| beed565ba0 | |||
| 329e27b83d | |||
| 3145656d80 | |||
| 5098a45bd5 | |||
| 9e65a6e7d5 | |||
| 83ac1087f3 | |||
| 55b2bccdf0 | |||
| 0c51474dd2 | |||
| 8c7ffb52a5 | |||
| 6c698bc399 | |||
| 540ad6f9ad |
@@ -484,8 +484,7 @@ export default function Login() {
|
|||||||
|
|
||||||
{loginType == "full" && (
|
{loginType == "full" && (
|
||||||
<div className="pt-5 text-[#181c32] text-center font-semibold text-[13.975px] leading-[20.9625px]">
|
<div className="pt-5 text-[#181c32] text-center font-semibold text-[13.975px] leading-[20.9625px]">
|
||||||
This site is protected by hCaptcha and the our Privacy Policy
|
This site is protected by a Captcha. Our Privacy Policy and Terms of Service apply.
|
||||||
and Terms of Service apply.
|
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -283,10 +283,14 @@ export default function FamilyProfile({ familyData, className }) {
|
|||||||
|
|
||||||
// Get the current year
|
// Get the current year
|
||||||
// const currentYear = new Date().getFullYear() - process.env.REACT_APP_FAMILY_MINIMUM_AGE;
|
// const currentYear = new Date().getFullYear() - process.env.REACT_APP_FAMILY_MINIMUM_AGE;
|
||||||
const currentYear = new Date().getFullYear();
|
|
||||||
|
|
||||||
// Generate an array of years from the current year to (currentYear - 19)
|
// Calculate the current year and the year 3 years before the current year
|
||||||
const years = Array.from({ length: 19 }, (_, index) => currentYear - index);
|
const currentYear = new Date().getFullYear();
|
||||||
|
const startYear = currentYear - 3;
|
||||||
|
|
||||||
|
// Generate an array of years from 4 years before the current year to 18 years before the current year
|
||||||
|
const years = Array.from({ length: 15 }, (_, index) => startYear - index).reverse();
|
||||||
|
// const latestYears = years.slice(0, process.env.REACT_APP_FAMILY_YEAR_RANGE);
|
||||||
|
|
||||||
const months = [
|
const months = [
|
||||||
{ id: "1", name: "January" },
|
{ id: "1", name: "January" },
|
||||||
|
|||||||
@@ -4,9 +4,12 @@ import InputCom from '../../../Helpers/Inputs/InputCom'
|
|||||||
import { Form, Formik } from "formik";
|
import { Form, Formik } from "formik";
|
||||||
import * as Yup from "yup";
|
import * as Yup from "yup";
|
||||||
|
|
||||||
|
import {AmountTo2DP} from '../../../Helpers/PriceFormatter'
|
||||||
import usersService from '../../../../services/UsersService';
|
import usersService from '../../../../services/UsersService';
|
||||||
import LoadingSpinner from '../../../Spinners/LoadingSpinner';
|
import LoadingSpinner from '../../../Spinners/LoadingSpinner';
|
||||||
import { PriceFormatter } from '../../../Helpers/PriceFormatter';
|
import { PriceFormatter } from '../../../Helpers/PriceFormatter';
|
||||||
|
import { tableReload } from '../../../../store/TableReloads';
|
||||||
|
import { useDispatch } from 'react-redux';
|
||||||
|
|
||||||
const validationSchema = Yup.object().shape({
|
const validationSchema = Yup.object().shape({
|
||||||
// amount: Yup.string()
|
// amount: Yup.string()
|
||||||
@@ -22,10 +25,14 @@ const validationSchema = Yup.object().shape({
|
|||||||
amount: Yup.number('Please enter a number')
|
amount: Yup.number('Please enter a number')
|
||||||
.min(1, "Price must be greater than 0")
|
.min(1, "Price must be greater than 0")
|
||||||
.required("Amount is required"),
|
.required("Amount is required"),
|
||||||
|
comment: Yup.string()
|
||||||
|
.required("Comment is required"),
|
||||||
});
|
});
|
||||||
|
|
||||||
function FamilyAddFundPopout({action, situation, wallet, familyData}) {
|
function FamilyAddFundPopout({action, situation, wallet, familyData}) {
|
||||||
|
|
||||||
|
const dispatch = useDispatch()
|
||||||
|
|
||||||
const apiUrl = new usersService()
|
const apiUrl = new usersService()
|
||||||
|
|
||||||
const [startTransfer, setStartTransfer] = useState({loading:true, data: {}})
|
const [startTransfer, setStartTransfer] = useState({loading:true, data: {}})
|
||||||
@@ -36,19 +43,68 @@ function FamilyAddFundPopout({action, situation, wallet, familyData}) {
|
|||||||
// initial values for formik
|
// initial values for formik
|
||||||
let initialValues = {
|
let initialValues = {
|
||||||
amount: '',
|
amount: '',
|
||||||
from : startTransfer?.data?.origing_current_balance*0.01 || 'N/A',
|
from : AmountTo2DP(startTransfer?.data?.origing_current_balance*0.01),
|
||||||
to: `${familyData.firstname} ${familyData.lastname}`,
|
to: `${familyData.firstname} ${familyData.lastname}`,
|
||||||
comment: ''
|
comment: ''
|
||||||
};
|
};
|
||||||
|
// FUNCTION TO PERFORM FAMILY TRANSFER
|
||||||
const handleAddFund = (values) => {
|
const handleAddFund = (values) => {
|
||||||
setRequestStatus({loading:true, status:false, message:''})
|
setRequestStatus({loading:true, status:false, message:''})
|
||||||
setTimeout(()=>{
|
|
||||||
setRequestStatus({loading:false, status:false, message:''})
|
let senderBal = startTransfer?.data?.origing_current_balance || '' // SENDER'S ACCOUNT BALANCE
|
||||||
action() // TO CLOSE THE MODAL
|
let senderLimit = startTransfer?.data?.origing_transfer_limit || '' // SENDER'S TRANSFER LIMIT
|
||||||
}, 3000)
|
|
||||||
// let reqData = {...values}
|
let reqData = { // API REQUEST DATA
|
||||||
console.log(values)
|
family_uid : familyData.uid,
|
||||||
|
wallet_uid : wallet.wallet_uid,
|
||||||
|
origing_wallet_uid : startTransfer?.data?.origing_wallet_uid,
|
||||||
|
currency : startTransfer?.data?.currency,
|
||||||
|
amount : values.amount*100,
|
||||||
|
description : values.comment,
|
||||||
|
family_transfer_mode : 100,
|
||||||
|
action : 22014
|
||||||
|
}
|
||||||
|
|
||||||
|
if(!senderBal || !senderLimit){ // RETURNS UNAUTHORIZED, IF SENDER BAL OR LIMIT IS NOT AVAILABLE
|
||||||
|
setRequestStatus({loading:false, status:false, message:'Unauthorized, try again later'})
|
||||||
|
return setTimeout(()=>{
|
||||||
|
setRequestStatus({loading:false, status:false, message:''})
|
||||||
|
}, 5000)
|
||||||
|
}
|
||||||
|
|
||||||
|
if(values.amount > senderBal*0.01){ // CHECKS TO SEE IF SENDER IS SENDING MORE THAN HIS BALANCE
|
||||||
|
setRequestStatus({loading:false, status:false, message:'You cannot send more than your balance'})
|
||||||
|
return setTimeout(()=>{
|
||||||
|
setRequestStatus({loading:false, status:false, message:''})
|
||||||
|
}, 5000)
|
||||||
|
}
|
||||||
|
|
||||||
|
if(values.amount > senderLimit*0.01){ // CHECKS TO SEE IF SENDER IS SENDING MORE THAN HIS LIMIT
|
||||||
|
setRequestStatus({loading:false, status:false, message:`You cannot exceed ${senderLimit*0.01} ${startTransfer?.data?.origing_currency.charAt(0).toUpperCase() + startTransfer?.data?.origing_currency.slice(1).toLowerCase()}`})
|
||||||
|
return setTimeout(()=>{
|
||||||
|
setRequestStatus({loading:false, status:false, message:''})
|
||||||
|
}, 5000)
|
||||||
|
}
|
||||||
|
|
||||||
|
apiUrl.familyTransfer(reqData).then(({data}) => {
|
||||||
|
if(data.internal_return < 0 || data.credit_confirm == '' || data.pay_confirm == ''){
|
||||||
|
setRequestStatus({loading:false, status:false, message:'Transfer Failed'})
|
||||||
|
return setTimeout(()=>{
|
||||||
|
setRequestStatus({loading:false, status:false, message:''})
|
||||||
|
}, 5000)
|
||||||
|
}
|
||||||
|
setRequestStatus({loading:false, status:true, message:'Transfer Successful'})
|
||||||
|
setTimeout(()=>{
|
||||||
|
setRequestStatus({loading:false, status:false, message:''})
|
||||||
|
dispatch(tableReload({ type: "WALLETTABLE" })); // UPDATES PARENT WALLET ACCOUNT
|
||||||
|
action() // TO CLOSE THE MODAL
|
||||||
|
}, 5000)
|
||||||
|
}).catch(error => {
|
||||||
|
setRequestStatus({loading:false, status:false, message:'Network Error, try again'})
|
||||||
|
setTimeout(()=>{
|
||||||
|
setRequestStatus({loading:false, status:false, message:''})
|
||||||
|
}, 5000)
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
// LOAD FAMILY START TRANSFER
|
// LOAD FAMILY START TRANSFER
|
||||||
@@ -60,7 +116,6 @@ function FamilyAddFundPopout({action, situation, wallet, familyData}) {
|
|||||||
}
|
}
|
||||||
apiUrl.familyTransferStart(reqData).then(response => {
|
apiUrl.familyTransferStart(reqData).then(response => {
|
||||||
setStartTransfer({loading:false, data:response?.data })
|
setStartTransfer({loading:false, data:response?.data })
|
||||||
// console.log('reqData', response.data)
|
|
||||||
}).catch(err => {
|
}).catch(err => {
|
||||||
setStartTransfer({loading:false, data: {}})
|
setStartTransfer({loading:false, data: {}})
|
||||||
})
|
})
|
||||||
@@ -68,7 +123,7 @@ function FamilyAddFundPopout({action, situation, wallet, familyData}) {
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<ModalCom action={action} situation={situation}>
|
<ModalCom action={action} situation={situation}>
|
||||||
<div className="relative logout-modal-wrapper lg:w-[450px] h-full lg:h-auto bg-white dark:bg-dark-white lg:rounded-2xl">
|
<div className="relative logout-modal-wrapper lg:w-[500px] h-full lg:h-auto bg-white dark:bg-dark-white lg:rounded-2xl">
|
||||||
<div className="logout-modal-header w-full flex items-center justify-between lg:px-10 lg:py-8 px-[30px] py-[23px] border-b border-light-purple dark:border-[#5356fb29] ">
|
<div className="logout-modal-header w-full flex items-center justify-between lg:px-10 lg:py-8 px-[30px] py-[23px] border-b border-light-purple dark:border-[#5356fb29] ">
|
||||||
<h1 className="text-26 font-bold text-dark-gray dark:text-white tracking-wide">
|
<h1 className="text-26 font-bold text-dark-gray dark:text-white tracking-wide">
|
||||||
Add Fund
|
Add Fund
|
||||||
@@ -116,12 +171,12 @@ function FamilyAddFundPopout({action, situation, wallet, familyData}) {
|
|||||||
<div className="field w-full mb-[0.5rem]">
|
<div className="field w-full mb-[0.5rem]">
|
||||||
<InputCom
|
<InputCom
|
||||||
placeholder="0"
|
placeholder="0"
|
||||||
label="Amount:"
|
label={`Amount (${startTransfer?.data?.currency})`}
|
||||||
name="amount"
|
name="amount"
|
||||||
type="text"
|
type="text"
|
||||||
parentClass="flex items-center gap-1 w-full"
|
parentClass="flex items-center gap-1 w-full"
|
||||||
labelClass="flex-[0.2] mb-0"
|
labelClass="flex-[0.3] mb-0"
|
||||||
inputClass={`flex-[0.8] input-curve lg border border-[#dce4e9] ${props.errors.amount && props.touched.amount ? 'border border-red-500' : ''}`}
|
inputClass={`flex-[0.7] input-curve lg border border-[#dce4e9] ${props.errors.amount && props.touched.amount ? 'border border-red-500' : ''}`}
|
||||||
fieldClass="px-2 text-right"
|
fieldClass="px-2 text-right"
|
||||||
value={props.values.amount}
|
value={props.values.amount}
|
||||||
inputHandler={props.handleChange}
|
inputHandler={props.handleChange}
|
||||||
@@ -132,12 +187,12 @@ function FamilyAddFundPopout({action, situation, wallet, familyData}) {
|
|||||||
<div className="field w-full mb-[0.5rem]">
|
<div className="field w-full mb-[0.5rem]">
|
||||||
<InputCom
|
<InputCom
|
||||||
placeholder="From"
|
placeholder="From"
|
||||||
label="From:"
|
label={`From (${startTransfer?.data?.origing_currency})`}
|
||||||
name="from"
|
name="from"
|
||||||
type="text"
|
type="text"
|
||||||
parentClass="flex items-center gap-1 w-full"
|
parentClass="flex items-center gap-1 w-full"
|
||||||
labelClass="flex-[0.2] mb-0"
|
labelClass="flex-[0.3] mb-0"
|
||||||
inputClass={`flex-[0.8] input-curve lg border border-[#dce4e9]`}
|
inputClass={`flex-[0.7] input-curve lg border border-[#dce4e9]`}
|
||||||
fieldClass="px-2 text-right"
|
fieldClass="px-2 text-right"
|
||||||
value={props.values.from}
|
value={props.values.from}
|
||||||
disable={true}
|
disable={true}
|
||||||
@@ -152,8 +207,8 @@ function FamilyAddFundPopout({action, situation, wallet, familyData}) {
|
|||||||
name="to"
|
name="to"
|
||||||
type="text"
|
type="text"
|
||||||
parentClass="flex items-center gap-1 w-full"
|
parentClass="flex items-center gap-1 w-full"
|
||||||
labelClass="flex-[0.2] mb-0"
|
labelClass="flex-[0.3] mb-0"
|
||||||
inputClass={`flex-[0.8] input-curve lg border border-[#dce4e9]`}
|
inputClass={`flex-[0.7] input-curve lg border border-[#dce4e9]`}
|
||||||
fieldClass="px-2 text-right"
|
fieldClass="px-2 text-right"
|
||||||
value={props.values.to}
|
value={props.values.to}
|
||||||
disable={true}
|
disable={true}
|
||||||
@@ -165,14 +220,15 @@ function FamilyAddFundPopout({action, situation, wallet, familyData}) {
|
|||||||
<div className="w-full">
|
<div className="w-full">
|
||||||
<label
|
<label
|
||||||
htmlFor="Job Delivery Details"
|
htmlFor="Job Delivery Details"
|
||||||
className='className="input-label text-[#181c32] dark:text-white text-[13.975px] leading-[20.9625px] font-semibold flex items-center gap-1'
|
className="input-label text-[#181c32] dark:text-white text-[13.975px] leading-[20.9625px] font-semibold flex items-center gap-1"
|
||||||
>
|
>
|
||||||
Comment
|
Comment
|
||||||
|
{/* {props.errors.comment && props.touched.comment && <span className='text-sm text-red-500'>{' '}{props.errors.comment}</span>} */}
|
||||||
</label>
|
</label>
|
||||||
<textarea
|
<textarea
|
||||||
// id="Job Delivery Details"
|
// id="Job Delivery Details"
|
||||||
rows="2"
|
rows="2"
|
||||||
className={`input-field px-3 py-2 placeholder:text-base text-dark-gray dark:text-white w-full bg-slate-100 dark:bg-[#11131F] focus:ring-0 focus:outline-[#dce4e9] rounded-[10px] border`}
|
className={`input-field px-3 py-2 placeholder:text-base text-dark-gray dark:text-white w-full bg-slate-100 dark:bg-[#11131F] focus:ring-0 focus:outline-[#dce4e9] rounded-[10px] border ${props.errors.comment && props.touched.comment ? 'border border-red-500' : ''}`}
|
||||||
style={{ resize: "none" }}
|
style={{ resize: "none" }}
|
||||||
name="comment"
|
name="comment"
|
||||||
value={props.values.comment}
|
value={props.values.comment}
|
||||||
@@ -189,8 +245,8 @@ function FamilyAddFundPopout({action, situation, wallet, familyData}) {
|
|||||||
{requestStatus.message != "" &&
|
{requestStatus.message != "" &&
|
||||||
(!requestStatus.status ? (
|
(!requestStatus.status ? (
|
||||||
<div
|
<div
|
||||||
// className={`relative p-4 text-[#912741] bg-[#fcd9e2] border-[#fbc6d3] rounded-[0.475rem] text-md font-light leading-[19.5px] text-[13px]`}
|
className={`relative p-4 text-[#912741] bg-[#fcd9e2] border-[#fbc6d3] rounded-[0.475rem] text-md font-light leading-[19.5px] text-[13px]`}
|
||||||
className={`pb-1 absolute bottom-0 left-1/2 -translate-x-1/2 text-[#912741] rounded-[0.475rem] text-md font-light leading-[19.5px] text-[13px]`}
|
// className={`pb-1 absolute bottom-0 left-1/2 -translate-x-1/2 text-[#912741] rounded-[0.475rem] text-md font-light leading-[19.5px] text-[13px]`}
|
||||||
|
|
||||||
>
|
>
|
||||||
{requestStatus.message}
|
{requestStatus.message}
|
||||||
@@ -198,8 +254,8 @@ function FamilyAddFundPopout({action, situation, wallet, familyData}) {
|
|||||||
) : (
|
) : (
|
||||||
requestStatus.status && (
|
requestStatus.status && (
|
||||||
<div
|
<div
|
||||||
// className={`relative p-4 text-green-700 bg-slate-200 border-slate-800 rounded-[0.475rem] text-md font-light leading-[19.5px] text-[13px]`}
|
className={`relative p-4 text-green-700 bg-slate-200 border-slate-800 rounded-[0.475rem] text-md font-light leading-[19.5px] text-[13px]`}
|
||||||
className={`pb-1 absolute bottom-0 left-1/2 -translate-x-1/2 text-green-700 rounded-[0.475rem] text-md font-light leading-[19.5px] text-[13px]`}
|
// className={`pb-1 absolute bottom-0 left-1/2 -translate-x-1/2 text-green-700 rounded-[0.475rem] text-md font-light leading-[19.5px] text-[13px]`}
|
||||||
>
|
>
|
||||||
{requestStatus.message}
|
{requestStatus.message}
|
||||||
</div>
|
</div>
|
||||||
@@ -222,7 +278,8 @@ function FamilyAddFundPopout({action, situation, wallet, familyData}) {
|
|||||||
:
|
:
|
||||||
<button
|
<button
|
||||||
type="submit"
|
type="submit"
|
||||||
className="w-[150px] h-[48px] rounded-full text-base text-white bg-sky-500 hover:bg-sky-400"
|
className={`w-[150px] h-[48px] rounded-full text-base text-white bg-sky-500 hover:bg-sky-400 ${requestStatus.status ? 'opacity-50' : ''}`}
|
||||||
|
disabled={requestStatus.status}
|
||||||
>
|
>
|
||||||
Send
|
Send
|
||||||
</button>
|
</button>
|
||||||
|
|||||||
@@ -50,3 +50,29 @@ export const PriceFormatter = (
|
|||||||
</span>
|
</span>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
// FUNCTION TO RETURN AMOUNT TO TWO DECIMAL PLACES
|
||||||
|
export const AmountTo2DP = (
|
||||||
|
amount = "00",
|
||||||
|
) => {
|
||||||
|
// Convert the number to a string
|
||||||
|
let numStr = String(amount);
|
||||||
|
|
||||||
|
// Split the string into integer and decimal parts
|
||||||
|
let parts = numStr.split(".");
|
||||||
|
let integerPart = parts[0] || "";
|
||||||
|
let decimalPart = parts[1] || "";
|
||||||
|
|
||||||
|
// Add thousands separators to the integer part
|
||||||
|
let formattedInteger = integerPart.replace(/\B(?=(\d{3})+(?!\d))/g, ',');
|
||||||
|
|
||||||
|
// Truncate or pad the decimal part to two decimal points
|
||||||
|
let formattedDecimal = decimalPart.slice(0, 2).padEnd(2, "0");
|
||||||
|
|
||||||
|
// Combine the formatted integer and decimal parts
|
||||||
|
let formattedNumber = formattedInteger + '.' + formattedDecimal;
|
||||||
|
|
||||||
|
// return formattedNumber;
|
||||||
|
return formattedNumber;
|
||||||
|
};
|
||||||
@@ -80,14 +80,16 @@ function CompleteConfirmCredit({ onClose, confirmCredit }) {
|
|||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div className="flex items-center gap-8">
|
{isSuccess && (
|
||||||
<h1 className="text-xl font-bold text-dark-gray dark:text-white tracking-tighter my-1">
|
<div className="flex items-center gap-8">
|
||||||
Confirmation Number
|
<h1 className="text-xl font-bold text-dark-gray dark:text-white tracking-tighter my-1">
|
||||||
</h1>
|
Confirmation Number
|
||||||
<span className="text-xl font-bold text-dark-gray dark:text-white tracking-tighter my-1">
|
</h1>
|
||||||
{data?.confirmation}
|
<span className="text-xl font-bold text-dark-gray dark:text-white tracking-tighter my-1">
|
||||||
</span>
|
{data?.confirmation}
|
||||||
</div>
|
</span>
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
</>
|
</>
|
||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ const CreditPopup = ({ details, onClose, situation, walletItem }) => {
|
|||||||
|
|
||||||
const getTitle = () => {
|
const getTitle = () => {
|
||||||
if (confirmCredit?.show?.acceptConfirm?.state) {
|
if (confirmCredit?.show?.acceptConfirm?.state) {
|
||||||
if (confirmCredit?.data?.internal_return < 0) {
|
if (confirmCredit?.data?.internal_return <= 0) {
|
||||||
return "Credit Unsuccessful";
|
return "Credit Unsuccessful";
|
||||||
} else {
|
} else {
|
||||||
return "Credit Add Completed";
|
return "Credit Add Completed";
|
||||||
|
|||||||
@@ -1101,6 +1101,17 @@ class usersService {
|
|||||||
return this.postAuxEnd("/familytransferstart", postData);
|
return this.postAuxEnd("/familytransferstart", postData);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// FUNCTION TO PERFORM FAMILY TRANSFER
|
||||||
|
familyTransfer(reqData) {
|
||||||
|
var postData = {
|
||||||
|
uid: localStorage.getItem("uid"),
|
||||||
|
member_id: localStorage.getItem("member_id"),
|
||||||
|
sessionid: localStorage.getItem("session_token"),
|
||||||
|
...reqData,
|
||||||
|
};
|
||||||
|
return this.postAuxEnd("/familytransfer", 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)
|
||||||
|
|||||||
Reference in New Issue
Block a user