Compare commits
15 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 436498bef9 | |||
| 086b1202a4 | |||
| a81ccdc4d7 | |||
| 33abbbcd2b | |||
| 04844af733 | |||
| 46d919090d | |||
| 8e67892f16 | |||
| a67d2b7bb4 | |||
| 99c0c24489 | |||
| 1a1d59a8c7 | |||
| 31dcfcfd0b | |||
| e9aa58f2f5 | |||
| 55fe2bf6d2 | |||
| 738eb1589e | |||
| 139e0c2827 |
Binary file not shown.
|
After Width: | Height: | Size: 71 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 67 KiB |
@@ -52,15 +52,20 @@ export default function FamilyTable({
|
||||
task_count,
|
||||
family_uid,
|
||||
banner,
|
||||
enable_traking,
|
||||
}) => {
|
||||
// Check for valid dates
|
||||
const addedDate = added ? added.split(" ")[0] : "N/A";
|
||||
const loginDate = last_login ? formatDateString(last_login) : "N/A";
|
||||
const key = `family-${family_uid}`; // Assign a unique key
|
||||
|
||||
const trackingStatus =
|
||||
enable_traking === "0" ? "Stopped" : enable_traking === "100" ? "Active" : "";
|
||||
|
||||
return (
|
||||
<tr
|
||||
className="bg-white dark:bg-dark-white border-b dark:border-[#5356fb29] hover:bg-gray-50"
|
||||
key={family_uid}
|
||||
className="bg-white dark:bg-dark-white border-b dark:border-[#5356fb29] hover:bg-gray-50"
|
||||
key={key}
|
||||
>
|
||||
<td className="py-4">
|
||||
<div className="flex space-x-2 items-center w-full">
|
||||
@@ -85,6 +90,23 @@ export default function FamilyTable({
|
||||
</div>
|
||||
</div>
|
||||
</td>
|
||||
|
||||
<td className="text-center py-4 px-2">
|
||||
<div className="flex space-x-1 items-center justify-center">
|
||||
<span
|
||||
className={`text-base font-medium whitespace-nowrap ${
|
||||
enable_traking === "0"
|
||||
? "text-[#FF0000] dark:text-[#FF6666]"
|
||||
: enable_traking === "100"
|
||||
? "text-[#00A000] dark:text-[#00FF00]"
|
||||
: "text-dark-gray dark:text-white"
|
||||
}`}
|
||||
>
|
||||
{trackingStatus}
|
||||
</span>
|
||||
</div>
|
||||
</td>
|
||||
|
||||
<td className="text-center py-4 px-2">
|
||||
<div className="flex space-x-1 items-center justify-center">
|
||||
<span className="text-base text-dark-gray dark:text-white font-medium whitespace-nowrap">
|
||||
@@ -92,6 +114,7 @@ export default function FamilyTable({
|
||||
</span>
|
||||
</div>
|
||||
</td>
|
||||
|
||||
<td className="text-right py-4 px-2 flex items-center justify-center">
|
||||
<button
|
||||
onClick={() =>
|
||||
@@ -116,6 +139,8 @@ export default function FamilyTable({
|
||||
);
|
||||
};
|
||||
|
||||
console.log(currentFamilyList);
|
||||
|
||||
return (
|
||||
<div
|
||||
className={`update-table w-full h-full p-4 bg-white dark:bg-dark-white overflow-y-auto rounded-2xl section-shadow min-h-[520px] flex flex-col justify-between ${
|
||||
@@ -134,6 +159,7 @@ export default function FamilyTable({
|
||||
<thead className="sticky top-0">
|
||||
<tr className="text-base text-thin-light-gray whitespace-nowrap border-b dark:border-[#5356fb29] default-border-bottom ">
|
||||
<th className="py-4">Name</th>
|
||||
<th className="py-4 text-center">Tracking</th>
|
||||
<th className="py-4 text-center">No of Tasks</th>
|
||||
<th className="py-4 text-right"></th>
|
||||
</tr>
|
||||
|
||||
@@ -2,6 +2,8 @@ import React from "react";
|
||||
// import Lottie from "react-lottie";
|
||||
import { useNavigate } from "react-router-dom";
|
||||
import * as animationData from "../../assets/images/Lotties/77618-website-404-error-animation.json";
|
||||
import { localImgLoad } from "../../lib";
|
||||
// import BgError from '../../assets/images/wrench-page-notfound.jpg'
|
||||
|
||||
export default function FourZeroFour() {
|
||||
const navigate = useNavigate();
|
||||
@@ -14,16 +16,21 @@ export default function FourZeroFour() {
|
||||
},
|
||||
};
|
||||
return (
|
||||
<div className="flex justify-center items-center w-full h-screen bg-[#232247]">
|
||||
<div>
|
||||
<div className={`my-custom-bg-class flex justify-center items-center w-full h-screen before:content-[''] before:absolute before:inset-0 before:bg-[#cdcdcd]/[.8]`}>
|
||||
<div className="relative pt-32 max-w-3xl">
|
||||
{/* <Lottie options={defaultOptions} width={600} height={600} /> */}
|
||||
<div className="flex justify-center">
|
||||
<div className="px-16 md:px-24 flex flex-col items-center justify-center gap-4">
|
||||
<img src={localImgLoad('images/404.png')} className="w-72" alt='404 Image' />
|
||||
<p className="mt-8 text-red-600 font-black text-4xl md:text-5xl tracking-wider text-center">Sorry!</p>
|
||||
<h1 className="text-black text-4xl md:text-5xl font-black tracking-wide text-center leading-tight">The page can’t be found.</h1>
|
||||
<p className="px-2 md:px-8 text-slate-700 text-base md:text-lg text-center">The page you're looking for isn't available. Use the go back button below</p>
|
||||
<button
|
||||
onClick={() => navigate(-1)}
|
||||
type="button"
|
||||
className="btn-gradient text-white text-lg w-[150px] h-[50px] rounded-full"
|
||||
className="px-4 md:px-8 border-2 border-[#2b70fa] rounded-lg text-[#007bff] text-base md:text-lg h-[48px] flex justify-center items-center gap-1"
|
||||
>
|
||||
Go Back
|
||||
<span>Go Back</span>
|
||||
<span className="pb-1">→</span>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -0,0 +1,114 @@
|
||||
import React, {useEffect, useState} from 'react'
|
||||
import Image from '../../assets/images/taskbanners/default.jpg'
|
||||
|
||||
import usersService from '../../services/UsersService';
|
||||
import { handlePagingFunc } from '../../components/Pagination/HandlePagination';
|
||||
import PaginatedList from '../../components/Pagination/PaginatedList';
|
||||
|
||||
import LoadingSpinner from '../Spinners/LoadingSpinner';
|
||||
|
||||
import { AmountTo2DP } from '../Helpers/PriceFormatter';
|
||||
|
||||
function RewardsTable() {
|
||||
|
||||
const apiCall = new usersService()
|
||||
|
||||
let [familyRewardHistory, setFamilyRewardHistory] = useState({ // FOR PURCHASE HISTORY
|
||||
loading: true,
|
||||
data: [],
|
||||
error: false
|
||||
})
|
||||
|
||||
const [currentPage, setCurrentPage] = useState(0);
|
||||
const indexOfFirstItem = Number(currentPage);
|
||||
const indexOfLastItem = Number(indexOfFirstItem)+Number(process.env.REACT_APP_ITEM_PER_PAGE);
|
||||
const currentReward = familyRewardHistory?.data?.slice(indexOfFirstItem, indexOfLastItem);
|
||||
|
||||
const handlePagination = (e) => {
|
||||
handlePagingFunc(e,setCurrentPage)
|
||||
}
|
||||
|
||||
|
||||
//FUNCTION TO GET FAMILY REWARD HISTORY
|
||||
const getFamilyRewardHistory = ()=>{
|
||||
apiCall.getFamilyRewardHx().then((res)=>{
|
||||
if(res.data.internal_return < 0){ // success but no data
|
||||
setFamilyRewardHistory(prev => ({...prev, loading: false}))
|
||||
return
|
||||
}
|
||||
setFamilyRewardHistory(prev => ({...prev, loading: false, data: res.data.result_list}))
|
||||
}).catch((error)=>{
|
||||
setFamilyRewardHistory(prev => ({...prev, loading: false, error: true}))
|
||||
})
|
||||
}
|
||||
|
||||
useEffect(()=>{
|
||||
getFamilyRewardHistory()
|
||||
}, [])
|
||||
|
||||
return (
|
||||
<div className='flex flex-col justify-between min-h-[500px]'>
|
||||
{familyRewardHistory.loading ?
|
||||
<LoadingSpinner size='16' color='sky-blue' height='h-[500px]' />
|
||||
:
|
||||
<table className="wallet-activity w-full table-auto border-collapse text-left">
|
||||
<thead className='border-b-2'>
|
||||
<tr className='text-slate-600'>
|
||||
<th className="p-2"></th>
|
||||
<th className="p-2">Amount</th>
|
||||
<th className="p-2">Date</th>
|
||||
<th className="p-2">Confirmation</th>
|
||||
</tr>
|
||||
</thead>
|
||||
{familyRewardHistory.data.length ?
|
||||
(
|
||||
<tbody>
|
||||
{currentReward.map((item, index) => {
|
||||
let date = new Date(item.added).toLocaleDateString()
|
||||
return (
|
||||
<tr key={index} className='text-slate-500'>
|
||||
<td className="p-2">
|
||||
<div className='flex items-center gap-2'>
|
||||
<img src={item.icon} className='min-w-[60px] max-w-[60px] min-h-[60px] max-h-[60px] rounded-full bg-slate-500' alt='Reward Logo' />
|
||||
<div className='flex flex-col'>
|
||||
<h1 className='text-lg font-bold'>Reward to {item.rec_firstname} {item.rec_lastname}</h1>
|
||||
<p className='text-sm'>{item.description}</p>
|
||||
</div>
|
||||
</div>
|
||||
</td>
|
||||
<td className="p-2">{AmountTo2DP(item.amount*0.01)} {item.currency}</td>
|
||||
<td className="p-2">{date}</td>
|
||||
<td className="p-2">{item.confirmation}</td>
|
||||
</tr>
|
||||
)
|
||||
}
|
||||
)}
|
||||
</tbody>
|
||||
)
|
||||
:
|
||||
familyRewardHistory.error ?
|
||||
(
|
||||
<tbody>
|
||||
<tr className='text-slate-500'>
|
||||
<td className="p-2" colSpan={4}>Opps! an error occurred. Please try again!</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
)
|
||||
:
|
||||
<tbody>
|
||||
<tr className='text-slate-500'>
|
||||
<td className="p-2" colSpan={4}>No Rewards History Found!</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
}
|
||||
</table>
|
||||
}
|
||||
|
||||
{/* PAGINATION BUTTON */}
|
||||
<PaginatedList onClick={handlePagination} prev={currentPage == 0 ? true : false} next={currentPage+Number(process.env.REACT_APP_ITEM_PER_PAGE) >= familyRewardHistory?.data?.length ? true : false} data={familyRewardHistory?.data} start={indexOfFirstItem} stop={indexOfLastItem} />
|
||||
{/* END OF PAGINATION BUTTON */}
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
||||
export default RewardsTable
|
||||
@@ -10,6 +10,7 @@ import usersService from "../../services/UsersService";
|
||||
import PurchasesTable from "../MyWallet/WalletComponent/PurchasesTable";
|
||||
import RecentActivityTable from "../MyWallet/WalletComponent/RecentActivityTable";
|
||||
import LoadingSpinner from "../Spinners/LoadingSpinner";
|
||||
import RewardsTable from "./RewardsTable";
|
||||
|
||||
export default function History() {
|
||||
|
||||
@@ -58,6 +59,9 @@ export default function History() {
|
||||
|
||||
useEffect(()=>{
|
||||
getPaymentHistory()
|
||||
}, [])
|
||||
|
||||
useEffect(()=>{
|
||||
getPurchaseHistory()
|
||||
}, [])
|
||||
|
||||
@@ -236,6 +240,15 @@ export default function History() {
|
||||
>
|
||||
Recent Activity
|
||||
</button>
|
||||
<button
|
||||
name="reward"
|
||||
onClick={(e) => setTab(e.target.name)}
|
||||
className={`px-4 py-1 rounded-t-2xl ${
|
||||
tab == "reward" ? "bg-[#4687ba] border-[2px] border-[#4687ba] text-white" : "bg-white text-[#000] border-t-[2px]"
|
||||
}`}
|
||||
>
|
||||
Rewards
|
||||
</button>
|
||||
</div>
|
||||
{/* END OF switch button */}
|
||||
<div className="history-tables w-full">
|
||||
@@ -265,6 +278,14 @@ export default function History() {
|
||||
</div>
|
||||
}
|
||||
{/* END OF RECENT ACTIVITY SECTION */}
|
||||
|
||||
{/* REWARD SECTION */}
|
||||
{tab == 'reward' &&
|
||||
<div className="wallet w-full border-t">
|
||||
<RewardsTable />
|
||||
</div>
|
||||
}
|
||||
{/* END OF REWARD SECTION */}
|
||||
</div>
|
||||
</div>
|
||||
{/*<HistoryTable />*/}
|
||||
|
||||
@@ -304,6 +304,12 @@ input[type="text"][dir="rtl"] {
|
||||
transform: rotate(360deg);
|
||||
}
|
||||
}
|
||||
|
||||
.my-custom-bg-class{
|
||||
background: url("./assets/images/wrench-page-notfound.jpg") center/cover;
|
||||
position: relative;
|
||||
}
|
||||
|
||||
/* TODO: =================================default end================================ */
|
||||
/* TODO: =================================update password================================ */
|
||||
.content-wrapper.thankyou-section {
|
||||
|
||||
@@ -496,6 +496,19 @@ class usersService {
|
||||
return this.postAuxEnd("/purchasehx", postData);
|
||||
}
|
||||
|
||||
// API FUNCTION TO GET FAMILY REWARD HISTORY
|
||||
getFamilyRewardHx() {
|
||||
var postData = {
|
||||
uid: localStorage.getItem("uid"),
|
||||
member_id: localStorage.getItem("member_id"),
|
||||
sessionid: localStorage.getItem("session_token"),
|
||||
offset: 1,
|
||||
limit: 20,
|
||||
action: 22011,
|
||||
};
|
||||
return this.postAuxEnd("/familyrewardhx", postData);
|
||||
}
|
||||
|
||||
// API FUNCTION TO GET PAYMENT HISTORY
|
||||
getPaymentHx() {
|
||||
var postData = {
|
||||
|
||||
Reference in New Issue
Block a user