Compare commits

...

20 Commits

Author SHA1 Message Date
victorAnumudu 9f89376aa9 Hid text when session expires 2023-11-01 22:11:34 +01:00
ameye 4e91e47978 Merge branch 'session-implement' of WrenchBoard/Users-Wrench into master 2023-11-01 20:09:08 +00:00
ameye fcaa485b17 Merge branch 'history-header-removal' of WrenchBoard/Users-Wrench into master 2023-11-01 20:08:55 +00:00
victorAnumudu e4526652d3 Merge master into session-implement 2023-11-01 20:27:35 +01:00
victorAnumudu 64056bb2a4 changed payment to purchase 2023-11-01 18:45:25 +01:00
victorAnumudu e49c4d66f8 removed table headers if no record is found 2023-11-01 18:39:24 +01:00
ameye 8fdb939b72 Merge branch 'Family-Acc-layout-update' of WrenchBoard/Users-Wrench into master 2023-11-01 17:06:51 +00:00
victorAnumudu 79325450f3 session logout implemented 2023-11-01 18:04:47 +01:00
Chief Bube 7849a027b4 changed fill 2023-11-01 10:04:00 -07:00
ameye 38432a6d50 Merge branch 'Family-Acc-layout-update' of WrenchBoard/Users-Wrench into master 2023-11-01 16:08:13 +00:00
Chief Bube 83a54ff3ef . 2023-11-01 07:37:00 -07:00
Chief Bube 5e0fdffa1e done 2023-11-01 07:34:23 -07:00
ameye 11d2cb3e3a Merge branch 'Added-uid-to-completesignup' of WrenchBoard/Users-Wrench into master 2023-11-01 14:00:31 +00:00
ameye 93ac55b44b Merge branch 'error-page-style' of WrenchBoard/Users-Wrench into master 2023-11-01 14:00:23 +00:00
Chief Bube 237ce13a6c . 2023-11-01 06:40:13 -07:00
Chief Bube 4253174494 . 2023-11-01 06:31:05 -07:00
victorAnumudu da0ed0364b changed the height of the page 2023-11-01 13:43:51 +01:00
ameye 466175c49d Merge branch 'fixing-height-in-intrest-popup' of WrenchBoard/Users-Wrench into master 2023-11-01 10:39:10 +00:00
Chief Bube ed148ce267 Fixed Family Profile Break 2023-10-31 21:42:15 -07:00
ameye 6de795c07b Merge branch 'error-page' of WrenchBoard/Users-Wrench into master 2023-10-31 21:29:49 +00:00
13 changed files with 116 additions and 106 deletions
+15
View File
@@ -17,6 +17,10 @@ import { updateUserDetails } from "../../../store/UserDetails";
import ReCAPTCHA from "react-google-recaptcha"; import ReCAPTCHA from "react-google-recaptcha";
export default function Login() { export default function Login() {
const queryParams = new URLSearchParams(location?.search);
const sessionExpired = queryParams.get("sessionExpired")
const dispatch = useDispatch(); const dispatch = useDispatch();
const { state } = useLocation(); const { state } = useLocation();
@@ -241,6 +245,9 @@ export default function Login() {
</div> </div>
<div className="content-wrapper login shadow-md w-full lg:max-w-[530px] mx-auto flex justify-center items-center xl:bg-white dark:bg-dark-white 2xl:w-[828px] rounded-[0.475rem] sm:p-7 p-5"> <div className="content-wrapper login shadow-md w-full lg:max-w-[530px] mx-auto flex justify-center items-center xl:bg-white dark:bg-dark-white 2xl:w-[828px] rounded-[0.475rem] sm:p-7 p-5">
<div className="w-full"> <div className="w-full">
{/* HIDES THIS IF USER SESSION HAS EXPIRED */}
{sessionExpired != 'true' &&
<div className="title-area flex flex-col justify-center items-center relative text-center mb-7"> <div className="title-area flex flex-col justify-center items-center relative text-center mb-7">
{/* <h1 className="text-[#181c32] font-semibold dark:text-white mb-3 leading-[27.3px] text-[22.75px]"> {/* <h1 className="text-[#181c32] font-semibold dark:text-white mb-3 leading-[27.3px] text-[22.75px]">
Sign In to WrenchBoard Sign In to WrenchBoard
@@ -255,6 +262,14 @@ export default function Login() {
</Link> </Link>
</span> </span>
</div> </div>
}
{/* SHOWS THIS IF USER SESSION HAS EXPIRED */}
{sessionExpired == 'true' &&
<div className="w-full p-1 mb-7">
<p className="text-red-500 text-base text-center">Your session expired and will need to login again</p>
</div>
}
{/* switch login component */} {/* switch login component */}
<div className="ml-7 flex justify-start items-center gap-3"> <div className="ml-7 flex justify-start items-center gap-3">
@@ -6,6 +6,7 @@ import InputCom from "../../Helpers/Inputs/InputCom";
import AuthLayout from "../AuthLayout"; import AuthLayout from "../AuthLayout";
export default function SignUp() { export default function SignUp() {
// eslint-disable-next-line no-restricted-globals
const queryParams = new URLSearchParams(location?.search); const queryParams = new URLSearchParams(location?.search);
const country = queryParams.get("cnt")?.toUpperCase(); const country = queryParams.get("cnt")?.toUpperCase();
@@ -54,6 +54,8 @@ export default function VerifyLink() {
localStorage.setItem("member_id", `${data?.member_id}`); localStorage.setItem("member_id", `${data?.member_id}`);
localStorage.setItem("session_token", `${data?.session}`); localStorage.setItem("session_token", `${data?.session}`);
localStorage.setItem("session", `${data?.session}`); localStorage.setItem("session", `${data?.session}`);
localStorage.setItem("uid", data?.uid)
navigate("/", { replace: true }); navigate("/", { replace: true });
setLinkLoader(false); setLinkLoader(false);
+22 -6
View File
@@ -53,6 +53,7 @@ export default function FamilyTable({
family_uid, family_uid,
banner, banner,
enable_traking, enable_traking,
profile_picture,
}) => { }) => {
// Check for valid dates // Check for valid dates
const addedDate = added ? added.split(" ")[0] : "N/A"; const addedDate = added ? added.split(" ")[0] : "N/A";
@@ -60,7 +61,11 @@ export default function FamilyTable({
const key = `family-${family_uid}`; // Assign a unique key const key = `family-${family_uid}`; // Assign a unique key
const trackingStatus = const trackingStatus =
enable_traking === "0" ? "Stopped" : enable_traking === "100" ? "Active" : ""; enable_traking === "0"
? "Stopped"
: enable_traking === "100"
? "Active"
: "";
return ( return (
<tr <tr
@@ -71,7 +76,8 @@ export default function FamilyTable({
<div className="flex space-x-2 items-center w-full"> <div className="flex space-x-2 items-center w-full">
<div className="w-[60px] h-[60px] rounded-full overflow-hidden flex justify-center items-center flex-[0.1]"> <div className="w-[60px] h-[60px] rounded-full overflow-hidden flex justify-center items-center flex-[0.1]">
<img <img
src={localImgLoad(`images/icons/${banner}`)} src={profile_picture}
// src={profile_picture || localImgLoad(`images/icons/${banner}`)}
alt={`Avatar of ${firstname} ${lastname}`} alt={`Avatar of ${firstname} ${lastname}`}
className="w-full h-full" className="w-full h-full"
/> />
@@ -130,17 +136,27 @@ export default function FamilyTable({
}) })
} }
type="button" type="button"
className="w-20 h-11 flex justify-center items-center btn-gradient text-base rounded-full text-white" className="w-12 h-11 flex justify-center items-center btn-gradient text-base rounded-full text-white"
> >
Manage <svg
xmlns="http://www.w3.org/2000/svg"
viewBox="0 0 11 20"
id="Arrow"
className="w-[0.7rem]"
>
<path
fill-rule="evenodd"
d="M.366 19.708c.405.39 1.06.39 1.464 0l8.563-8.264a1.95 1.95 0 0 0 0-2.827L1.768.292A1.063 1.063 0 0 0 .314.282a.976.976 0 0 0-.011 1.425l7.894 7.617a.975.975 0 0 1 0 1.414L.366 18.295a.974.974 0 0 0 0 1.413"
// fill=""
className="color000000 svgShape fill-[#fff]"
></path>
</svg>
</button> </button>
</td> </td>
</tr> </tr>
); );
}; };
console.log(currentFamilyList);
return ( return (
<div <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 ${ 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 ${
@@ -49,12 +49,12 @@ export default function FamilyProfile({ familyData, className }) {
// initial values for formik // initial values for formik
let initialValues = { let initialValues = {
family_uid: familyData.uid, family_uid: familyData?.uid,
firstname: familyData.firstname, firstname: familyData?.firstname,
lastname: familyData.lastname, lastname: familyData?.lastname,
year: familyData.year, year: familyData?.year,
month: familyData.month, month: familyData?.month,
enable_traking: familyData.enable_traking, enable_traking: familyData?.enable_traking,
action: 22020, action: 22020,
}; };
+2 -2
View File
@@ -5,7 +5,7 @@ import React, {
useMemo, useMemo,
useState, useState,
} from "react"; } from "react";
import SiteService from "../../services/SiteService"; 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 Layout from "../Partials/Layout"; import Layout from "../Partials/Layout";
@@ -27,7 +27,7 @@ export default function FamilyAcc() {
last_name: "", last_name: "",
}); });
const apiCall = useMemo(() => new SiteService(), []); const apiCall = useMemo(() => new usersService(), []);
const popUpHandler = () => { const popUpHandler = () => {
setPopUp((prev) => !prev); setPopUp((prev) => !prev);
+2 -2
View File
@@ -16,11 +16,11 @@ export default function FourZeroFour() {
}, },
}; };
return ( return (
<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={`my-custom-bg-class flex justify-center items-center w-full min-h-screen before:content-[''] before:absolute before:inset-0 before:bg-[#cdcdcd]/[.8]`}>
<div className="relative pt-32 max-w-3xl"> <div className="relative pt-32 max-w-3xl">
{/* <Lottie options={defaultOptions} width={600} height={600} /> */} {/* <Lottie options={defaultOptions} width={600} height={600} /> */}
<div className="px-16 md:px-24 flex flex-col items-center justify-center gap-4"> <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' /> <img src={localImgLoad('images/404.png')} className="w-72" alt='404Image' />
<p className="mt-8 text-red-600 font-black text-4xl md:text-5xl tracking-wider text-center">Sorry!</p> <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 cant be found.</h1> <h1 className="text-black text-4xl md:text-5xl font-black tracking-wide text-center leading-tight">The page cant 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> <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>
+9 -20
View File
@@ -50,7 +50,7 @@ function RewardsTable() {
<div className='flex flex-col justify-between min-h-[500px]'> <div className='flex flex-col justify-between min-h-[500px]'>
{familyRewardHistory.loading ? {familyRewardHistory.loading ?
<LoadingSpinner size='16' color='sky-blue' height='h-[500px]' /> <LoadingSpinner size='16' color='sky-blue' height='h-[500px]' />
: : familyRewardHistory.data.length ?
<table className="wallet-activity w-full table-auto border-collapse text-left"> <table className="wallet-activity w-full table-auto border-collapse text-left">
<thead className='border-b-2'> <thead className='border-b-2'>
<tr className='text-slate-600'> <tr className='text-slate-600'>
@@ -60,8 +60,6 @@ function RewardsTable() {
<th className="p-2">Confirmation</th> <th className="p-2">Confirmation</th>
</tr> </tr>
</thead> </thead>
{familyRewardHistory.data.length ?
(
<tbody> <tbody>
{currentReward.map((item, index) => { {currentReward.map((item, index) => {
let date = new Date(item.added).toLocaleDateString() let date = new Date(item.added).toLocaleDateString()
@@ -84,24 +82,15 @@ function RewardsTable() {
} }
)} )}
</tbody> </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> </table>
:familyRewardHistory.error ?
<div className="p-2 text-slate-500 flex flex-col grow justify-center items-center">
<span>Opps! an error occurred. Please try again!</span>
</div>
:
<div className="p-2 text-slate-500 flex flex-col grow justify-center items-center">
<span>No Rewards History Found!</span>
</div>
} }
{/* PAGINATION BUTTON */} {/* PAGINATION BUTTON */}
+4 -4
View File
@@ -255,9 +255,9 @@ export default function History() {
{/* PURCHASE SECTION */} {/* PURCHASE SECTION */}
{tab == 'purchases' && {tab == 'purchases' &&
<div className="wallet w-full border-t"> <div className="wallet w-full border-t">
<h1 className="p-2 text-xl font-bold text-dark-gray dark:text-white tracking-wide">Purchases</h1> {/* <h1 className="p-2 text-xl font-bold text-dark-gray dark:text-white tracking-wide">Purchases</h1> */}
{purchaseHistory.loading ? {purchaseHistory.loading ?
<LoadingSpinner size='16' color='sky-blue' /> <LoadingSpinner size='16' color='sky-blue' height='h-[500px]' />
: :
<PurchasesTable purchase={purchaseHistory} /> <PurchasesTable purchase={purchaseHistory} />
} }
@@ -268,10 +268,10 @@ export default function History() {
{/* RECENT ACTIVITY SECTION */} {/* RECENT ACTIVITY SECTION */}
{tab == 'recent' && {tab == 'recent' &&
<div className="wallet w-full border-t"> <div className="wallet w-full border-t">
<h1 className="p-2 text-xl font-bold text-dark-gray dark:text-white tracking-wide">Recent Activity</h1> {/* <h1 className="p-2 text-xl font-bold text-dark-gray dark:text-white tracking-wide">Recent Activity</h1> */}
{/* <p className='text-base text-slate-500 dark:text-white'>Activity Report</p> */} {/* <p className='text-base text-slate-500 dark:text-white'>Activity Report</p> */}
{paymentHistory.loading ? {paymentHistory.loading ?
<LoadingSpinner size='16' color='sky-blue' /> <LoadingSpinner size='16' color='sky-blue' height='h-[500px]' />
: :
<RecentActivityTable payment={paymentHistory} /> <RecentActivityTable payment={paymentHistory} />
} }
@@ -16,45 +16,36 @@ function PurchasesTable({purchase}) {
return ( return (
<div className='flex flex-col justify-between min-h-[500px]'> <div className='flex flex-col justify-between min-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">Trx.</th>
<th className="p-2">Amount</th>
<th className="p-2">Fee</th>
</tr>
</thead>
{purchase.data.length ? {purchase.data.length ?
( <table className="wallet-activity w-full table-auto border-collapse text-left">
<tbody> <thead className='border-b-2'>
{currentPurchase.map((item, index) => ( <tr className='text-slate-600'>
<tr key={index} className='text-slate-500'> <th className="p-2">Trx.</th>
<td className="p-2">{item.added_date}<br /> <th className="p-2">Amount</th>
<b>{item.confirmation} </b> <th className="p-2">Fee</th>
</td> </tr>
<td className="p-2">{item.amount}</td> </thead>
<td className="p-2">{item.fee}</td> <tbody>
</tr> {currentPurchase.map((item, index) => (
))} <tr key={index} className='text-slate-500'>
</tbody> <td className="p-2">{item.added_date}<br />
) <b>{item.confirmation} </b>
</td>
<td className="p-2">{item.amount}</td>
<td className="p-2">{item.fee}</td>
</tr>
))}
</tbody>
</table>
:purchase.error ?
<div className="p-2 text-slate-500 flex flex-col grow justify-center items-center">
<span>Opps! an error occurred. Please try again!</span>
</div>
: :
purchase.error ? <div className="p-2 text-slate-500 flex flex-col grow justify-center items-center">
( <span>No Purchase History Found!</span>
<tbody> </div>
<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 Purchase History Found!</td>
</tr>
</tbody>
} }
</table>
{/* PAGINATION BUTTON */} {/* PAGINATION BUTTON */}
<PaginatedList onClick={handlePagination} prev={currentPage == 0 ? true : false} next={currentPage+Number(process.env.REACT_APP_ITEM_PER_PAGE) >= purchase?.data?.length ? true : false} data={purchase?.data} start={indexOfFirstItem} stop={indexOfLastItem} /> <PaginatedList onClick={handlePagination} prev={currentPage == 0 ? true : false} next={currentPage+Number(process.env.REACT_APP_ITEM_PER_PAGE) >= purchase?.data?.length ? true : false} data={purchase?.data} start={indexOfFirstItem} stop={indexOfLastItem} />
@@ -19,16 +19,16 @@ function RecentActivityTable({ payment }) {
return ( return (
<div className="flex flex-col justify-between min-h-[500px]"> <div className="flex flex-col justify-between min-h-[500px]">
<table className="wallet-activity w-full table-auto border-collapse text-left"> {payment?.data?.length > 0 ?
<thead className="border-b-2"> <table className="wallet-activity w-full table-auto border-collapse text-left">
<tr className="text-slate-600"> <thead className="border-b-2">
<th className="p-2">Date</th> <tr className="text-slate-600">
<th className="p-4">Trx.</th> <th className="p-2">Date</th>
<th className="p-2">Amnt./Fee</th> <th className="p-4">Trx.</th>
<th className="p-2">Status</th> <th className="p-2">Amnt./Fee</th>
</tr> <th className="p-2">Status</th>
</thead> </tr>
{payment?.data?.length > 0 ? ( </thead>
<tbody> <tbody>
{currentActivity.map((item, index) => ( {currentActivity.map((item, index) => (
<tr key={index} className="text-slate-500"> <tr key={index} className="text-slate-500">
@@ -46,24 +46,16 @@ function RecentActivityTable({ payment }) {
</tr> </tr>
))} ))}
</tbody> </tbody>
) : payment?.error ? ( </table>
<tbody> :payment.error ?
<tr className="text-slate-500"> <div className="p-2 text-slate-500 flex flex-col grow justify-center items-center">
<td className="p-2" colSpan={4}> <span>Opps! an error occurred. Please try again!</span>
Opps! an error occurred. Please try again! </div>
</td> :
</tr> <div className="p-2 text-slate-500 flex flex-col grow justify-center items-center">
</tbody> <span>No Payment History Found!</span>
) : ( </div>
<tbody> }
<tr className="text-slate-500">
<td className="p-2" colSpan={4}>
No Payment History Found!
</td>
</tr>
</tbody>
)}
</table>
{/* PAGINATION BUTTON */} {/* PAGINATION BUTTON */}
<PaginatedList <PaginatedList
+2 -2
View File
@@ -1,7 +1,7 @@
import { Field, Form, Formik } from "formik"; import { Field, Form, Formik } from "formik";
import React, { useCallback, useEffect, useMemo, useState } from "react"; import React, { useCallback, useEffect, useMemo, useState } from "react";
import * as Yup from "yup"; import * as Yup from "yup";
import SiteService from "../../services/SiteService"; import usersService from "../../services/UsersService";
import InputCom from "../Helpers/Inputs/InputCom/index"; import InputCom from "../Helpers/Inputs/InputCom/index";
import ModalCom from "../Helpers/ModalCom"; import ModalCom from "../Helpers/ModalCom";
import LoadingSpinner from "../Spinners/LoadingSpinner"; import LoadingSpinner from "../Spinners/LoadingSpinner";
@@ -36,7 +36,7 @@ const dispatch = useDispatch()
}, },
}); });
const apiCall = useMemo(() => new SiteService(), []); const apiCall = useMemo(() => new usersService(), []);
// member listing // member listing
const memberList = useCallback(async () => { const memberList = useCallback(async () => {
+4
View File
@@ -1237,6 +1237,10 @@ class usersService {
console.log(response); console.log(response);
// res = response; // res = response;
console.log("~~~~~~~ Toks2 POST ~~~~~~~~"); console.log("~~~~~~~ Toks2 POST ~~~~~~~~");
if(response.data.internal_return == '-9999'){
localStorage.clear()
window.location.href=`/login?sessionExpired=true`
}
return response; return response;
}) })
.catch((error) => { .catch((error) => {